Underdogger Posted February 22, 2013 Share Posted February 22, 2013 (edited) Hello, EverybodyI found StringRegExp got something wrong on XP...It appeared error msg..Subscript used with non-Array variable..But it can run normally on my x64 win7 system...#include <IE.au3> $oHTTP = _IECreate("http://invoice.etax.nat.gov.tw/", 0, 0, 1, 0) $HTMLSource = _IEDocReadHTML($oHTTP) $open = FileOpen("test.txt",1) FileWrite("test.txt",$HTMLSource) FileClose($open) _IEQuit($oHTTP) $getDate = StringRegExp(FileRead("test.txt"), '<h2>(.*?)</h2>', 3) MsgBox(0,"",$getDate[0])Very simple code..But cannot run on XP system..But It can run normally on my computer.. Edited February 22, 2013 by Underdogger Link to comment Share on other sites More sharing options...
kylomas Posted February 22, 2013 Share Posted February 22, 2013 (edited) Underdogger, Check to see that you actually have a file (test.txt). The error message is telling you that $getDate is not an array. kylomas Edited February 22, 2013 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 22, 2013 Moderators Share Posted February 22, 2013 Underdogger, Can you just use the standard forum font in future please - there is no need to embolden and colour your text. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
BrewManNH Posted February 22, 2013 Share Posted February 22, 2013 Your regex pattern is wrong for that web page, this is the corrected line. $getDate = StringRegExp(FileRead("test.txt"), '<H2>(.*?)</H2>', 3) Unless you tell it to be case insensitive, the pattern has to match exactly, the H2 and /H2 are in upper case on the page downloaded. Underdogger 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Underdogger Posted February 22, 2013 Author Share Posted February 22, 2013 Your regex pattern is wrong for that web page, this is the corrected line. $getDate = StringRegExp(FileRead("test.txt"), '<H2>(.*?)</H2>', 3) Unless you tell it to be case insensitive, the pattern has to match exactly, the H2 and /H2 are in upper case on the page downloaded. Yes, It's absolutely solved!! Best Regard. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 22, 2013 Moderators Share Posted February 22, 2013 Underdogger, Thank you. M23 Underdogger 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kylomas Posted February 22, 2013 Share Posted February 22, 2013 Your regex pattern is wrong for that web page, this is the corrected line. $getDate = StringRegExp(FileRead("test.txt"), '<H2>(.*?)</H2>', 3) Unless you tell it to be case insensitive, the pattern has to match exactly, the H2 and /H2 are in upper case on the page downloaded. Curious that it works on one platform and not the other! Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Underdogger Posted February 22, 2013 Author Share Posted February 22, 2013 Underdogger,Thank you. M23YOU'RE WELCOME~ Link to comment Share on other sites More sharing options...
BrewManNH Posted February 22, 2013 Share Posted February 22, 2013 Curious that it works on one platform and not the other!It didn't work on my Windows 7 x64 machine, so I'm not sure how it worked on his. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Underdogger Posted February 22, 2013 Author Share Posted February 22, 2013 It didn't work on my Windows 7 x64 machine, so I'm not sure how it worked on his.I don't know why it get this value "<h2> </h2>"....in my system..but get "<H2> </H2>" in my the other XP system Link to comment Share on other sites More sharing options...
kylomas Posted February 22, 2013 Share Posted February 22, 2013 Regardless, if you want to cover all bases use a case insensitivity assertion on the regexp, like this'(?i)<H2>(.*?)</H2>'kylomas Underdogger 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
BrewManNH Posted February 22, 2013 Share Posted February 22, 2013 Strangely enough, when I view that page's source in both IE and Chrome, all the HTML tags are in lower case, so I'm not sure why they're in upper case when running the script. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Underdogger Posted February 22, 2013 Author Share Posted February 22, 2013 Regardless, if you want to cover all bases use a case insensitivity assertion on the regexp, like this'(?i)<H2>(.*?)</H2>'kylomasYes, this is the great method!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now