Hodahel Posted March 31, 2013 Author Share Posted March 31, 2013 This code works now.. #include #include #include #include Local $file = FileOpen(@scriptdir & "\address.txt", 0) ; <--------- file is in same dir as script ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read file to array local $aLines _FileReadToArray(@scriptdir & "\address.txt", $aLines) ;Call("address") ; <--------------------- invoke functions directly, not with call address() ; <--------------------- like this Func address() for $1 = 1 to $aLines[0] if $aLines[$1] = '' then continueloop local $oIE = _IECreate($aLines[$1],0,1,1,1) ; page to open if @error <> 0 then ConsoleWrite('Error code = ' & @error & @LF) ;do this... ;do that.. ;_IEQuit($oIE) ;close the Internet Explorer next EndFunc ;==>address FileClose($file) instead of if @error <> 0 then ConsoleWrite('Error code = ' & @error & @LF) i want it to process the NEXT LINE instead.. if @error <> 0 then Next $1 ;process next line instead of going to rest of script.. TIA Link to comment Share on other sites More sharing options...
water Posted March 31, 2013 Share Posted March 31, 2013 How about ContinueLoop? Hodahel 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Hodahel Posted April 2, 2013 Author Share Posted April 2, 2013 How about ContinueLoop? it's using ContinueLoop.. if $aLines[$1] = '' then continueloop Link to comment Share on other sites More sharing options...
kylomas Posted April 2, 2013 Share Posted April 2, 2013 hodahel, I think water is saying that the "if error" stmt can use continue loop. I am writing a message to the console then falling through (which continues the loop). The choice is yours. kylomas Hodahel 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...
Hodahel Posted April 10, 2013 Author Share Posted April 10, 2013 Hi, I'm already here: _IENavigate($oIE, $aLines[$1]&"mysite1.org", 0) ; navigate to site #1 if @error <> 0 Then _IENavigate($oIE, $aLines[$1]&"/mysite2.org") ; navigate to site#2 My problem is if site #1 is offline, I want it to navigate to site #2. But my code stops only of "page not found" never navigate to site #2. Link to comment Share on other sites More sharing options...
water Posted April 10, 2013 Share Posted April 10, 2013 (edited) Something like this: _IENavigate($oIE, $aLines[$1] & "/mysite1.org", 0) ; navigate to site #1 _IELoadWait($oIE, 0, 60000) ; Wait for 1 minute If @error Then _IENavigate($oIE, $aLines[$1] & "/mysite2.org") ; navigate to site#2 Edited April 10, 2013 by water Hodahel 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Hodahel Posted April 10, 2013 Author Share Posted April 10, 2013 Doesn't work.. Link to comment Share on other sites More sharing options...
water Posted April 10, 2013 Share Posted April 10, 2013 If you run it from SciTE what do you get in the output pane? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Hodahel Posted April 10, 2013 Author Share Posted April 10, 2013 OK I got it!I should wait for the @error being past by _IELoadWait line.._IENavigate($oIE, $aLines[$1]&"/mysite.org", 0) _IELoadWait($oIE, 0, 15000) ; Wait for 15 seconds if @error <> 1 Then _IEQuit($oIE) ; If there's an error closed IE continueloop ;and continue looping..Thanks water! Link to comment Share on other sites More sharing options...
water Posted April 10, 2013 Share Posted April 10, 2013 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Hodahel Posted April 12, 2013 Author Share Posted April 12, 2013 Now, I have an IE form with form name "My Site" a single input field named Input_Field1, I want to read the value of this field and display on message box.. $IEName = _IECreate("www.mysite.com", 0,1,1,1) ; navigate to www.mysite.com $oForm = _IEFormGetObjByName ($IEName, "My Site") ; get form name which is "My Site" $name = _IEGetObjByName($oForm,"Input_Field1") ; name of input field $InputVal = _IEFormElementGetValue($name) ; get the value of Input_Field1 MsgBox(0,"Input Field Value is",$InputVal) My problem is the message box display is always 0, did I missed something?? Link to comment Share on other sites More sharing options...
water Posted April 12, 2013 Share Posted April 12, 2013 If you run this script from SciTE do you get any error messages in the output pane? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Hodahel Posted April 12, 2013 Author Share Posted April 12, 2013 (edited) OK, I manage to figure it out..: Now my problem is.. this code will work $IEName = _IECreate("www.mysite.com", 0,1,1,1) ; navigate to www.mysite.com $oForm = _IEFormGetObjByName ($IEName, "My Site") ; get form name which is "My Site" $name = _IEGetObjByName($oForm,"Input_Field1") ; name of input field $InputVal = _IEFormElementGetValue($name) ; get the value of Input_Field1 MsgBox(0,"Input Field Value is",$InputVal) But if I'll used _IENavigate it doesn't.. $Site1 = _IECreate("www.mysite.com", 0,1,1,1) ; open www.mysite.com $Site2 = _EINavigate($Site1, "www.mysite2.com",0) ;Navigate to site2 $oForm = _IEFormGetObjByName ($IEName, "My Site") ; get form name which is "My Site" $name = _IEGetObjByName($oForm,"Input_Field1") ; name of input field $InputVal = _IEFormElementGetValue($name) ; get the value of Input_Field1 MsgBox(0,"Input Field Value is",$InputVal) BTW, If I want to SAVE the value of $InputVal instead displaying it on message box.. EDIT: Done it with FileWriteLine Edited April 12, 2013 by Hodahel Link to comment Share on other sites More sharing options...
aguynamedray Posted September 2, 2013 Share Posted September 2, 2013 (edited) Hello, My problem here is that, I want to display all text in the text file but the code below only display the first line. Is that possible? GUICtrlSetData($Edit1 , FileReadLine($file)) ; reads only the first line of the file Full Code #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("About", 324, 370, 302, 218) $GroupBox1 = GUICtrlCreateGroup("", 8, 8, 305, 297) $Edit1 = GUICtrlCreateEdit("", 24, 32, 281, 257) GUICtrlSetData(-1, "Edit1") GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("&OK", 124, 312, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Local $file = FileOpen("D:\Inventory\error.txt") If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf GUICtrlSetData($Edit1 , FileReadLine($file)) ; reads only the first line of the file FileClose($file) EndSwitch WEnd Edited September 2, 2013 by aguynamedray Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 2, 2013 Moderators Share Posted September 2, 2013 aguynamedray,Use FileRead in place of FileReadLine. 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...
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