
hispeed_mike
Active Members-
Posts
77 -
Joined
-
Last visited
Everything posted by hispeed_mike
-
Hi, Odd way to word this: I have a script to automate a router setup. Part of my script uses an _IEAction ($oButton1, "click") , now on this command it generates a Popup box that needs action. Strange thing is that it seems the click does not return until after the button on the box is clicked. I have been using an external exe that clicks the button but want to find a way to do this from one script... I have a loop after this click to do the job, but does anyone know how I could start another process before I click to handle this? Thanks in advance
-
EndSelect Error on running script....
hispeed_mike replied to hispeed_mike's topic in AutoIt GUI Help and Support
Hey, thanks for that, doing my head in :S Any suggestion to code layout, constructed criticism appreaciated... -
Getting and EndSelect error in the output of Scite... "EndSelect" statement with no matching "Select" statement.: Can someone maybe provide fresh eyes, I have gone through the Select statements and as I see it they all match up. Don't know if the way I coded this was correct with so many loops going on etc. Advise is really appreciated... Thanks in advance... #include <Process.au3> #include <ControlSendPlus.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <WindowsConstants.au3> #include <file.au3> #Include <Array.au3> ;#include "DirCopyProgress.au3" ;#include "FileCopyProgress.au3" ;#include "Zip.au3" #include "HSLinksys_WAG54G2.au3" #include "HSLinksys_610N.au3" #include "HSLinksys_610N_V2.au3" #include "HSLinksys_WRT54GL.au3" Dim $WAG120NVisible, $WAG120NSiteLabel, $WAG120NSiteInput, $WAG120NUserLabel, $WAG120NUserInput, $WAG120NPassLabel, $WAG120NPassInput, $WAG120NPassInput, $buttonchange $bfgui1 = GUICreate ("Network Device Setup", "400", "350") GUISetState (@SW_HIDE) GUICtrlCreateLabel ("Select what you are configuring::", 5, 7) $radio1 = GUICtrlCreateRadio("Printers", 10, 25, 80, 20) $radio2 = GUICtrlCreateRadio("Power Rebooter", 100, 25, 120, 20) $radio3 = GUICtrlCreateRadio("Routers & Modems", 220, 25, 120, 20) ;GUICtrlCreateCombo ("Select the Device you are configuring", 100, 5, 210) ;GUICtrlSetData(-1, "NETPRINT 10.10.10.199|NETPRINT1 10.10.10.198|NETPRINT2 10.10.10.197|NETPRINT3 10.10.10.196|NETPRINT4 10.10.10.195|NETPRINT5 10.10.10.194","") $OK = GUICtrlCreateButton ("Next", 325, 320, 70) $printgroup = GUICtrlCreateGroup("Printer Setup", 5, 50, 390, 265) $printcombolabel = GUICtrlCreateLabel ("Printer to Configure", 15, 72) $printcombo = GUICtrlCreateCombo ("", 125, 70, 210) $printcombodata = GUICtrlSetData(-1, "NETPRINT 10.10.10.199|NETPRINT1 10.10.10.198|NETPRINT2 10.10.10.197|NETPRINT3 10.10.10.196|NETPRINT4 10.10.10.195|NETPRINT5 10.10.10.194","") $printsitelabel = GUICtrlCreateLabel ("Current Printer IP:", 15, 102) $printsiteinput = GUICtrlCreateInput ("", 125, 100, 210) $printsitelabel1 = GUICtrlCreateLabel ("Input Site Name:", 15, 132) $printsiteinput1 = GUICtrlCreateInput ("", 125, 130, 210) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group _HidePrinters () $rebootergroup = GUICtrlCreateGroup("Rebooter Setup", 5, 50, 390, 265) $rebootercombolabel = GUICtrlCreateLabel ("Model of Rebooter", 15, 72) $rebootercombo = GUICtrlCreateCombo ("", 125, 70, 210) $rebootercombodata = GUICtrlSetData(-1, "IP9258|NP-02U|","") $rebootercombolabel0 = GUICtrlCreateLabel ("Rebooter to Configure", 15, 102) $rebootercombo0 = GUICtrlCreateCombo ("", 125, 100, 210) $rebootercombodata0 = GUICtrlSetData(-1, "Rebooter 10.10.10.250|Rebooter1 10.10.10.251|Rebooter2 10.10.10.252|Rebooter3 10.10.10.253|Rebooter4 10.10.10.254|","") $rebootercombolabel1 = GUICtrlCreateLabel ("Input Site Name:", 15, 132) $rebootercombolabel2 = GUICtrlCreateInput ("", 125, 130, 210) $rebootercombolabel3 = GUICtrlCreateLabel ("Port 1:", 15, 162) $rebootercombolabel4 = GUICtrlCreateInput ("", 125, 160, 210) $rebootercombolabel5 = GUICtrlCreateLabel ("Port 2:", 15, 192) $rebootercombolabel6 = GUICtrlCreateInput ("", 125, 190, 210) $rebootercombolabel7 = GUICtrlCreateLabel ("Port 3:", 15, 222) $rebootercombolabel8 = GUICtrlCreateInput ("", 125, 220, 210) $rebootercombolabel9 = GUICtrlCreateLabel ("Port 4:", 15, 252) $rebootercombolabel10 = GUICtrlCreateInput ("", 125, 250, 210) _HideRebooters() $routergroup = GUICtrlCreateGroup("Router and Modem Setup", 5, 50, 390, 265) $routercombolabel = GUICtrlCreateLabel ("Device to Configure", 15, 72) $routercombo = GUICtrlCreateCombo ("", 125, 70, 210) $routercombodata = GUICtrlSetData(-1, "|ADSL Routers|Linksys WRT54GL Wireless Router|Linksys WAG54G2 ADSL Router|Linksys WAG120N ADSL Router||Wireless Routers","") _HideRouters() GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED _HideRouters() _HideRebooters() _ShowPrinters() $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $OK GUISetState (@SW_LOCK) $deviceip = GUICtrlRead ($printcombo, 0) $ip = StringTrimLeft ($deviceip, 9) $currentip = GUICtrlRead (11, 0) $siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", $ip) ;__HS2170W($ip, $siteid, $currentip, $printname) EndSelect Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED _HideRouters() _HidePrinters () _ShowRebooters() Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED _HidePrinters () _HideRebooters() _ShowRouters() Case $msg = $OK $res1 = GUICtrlRead ($radio1, 0) If $res1 = 1 then ;MsgBox (4096, "Result", "Printers") ;GUISetState (@SW_LOCK) $deviceip = GUICtrlRead (9, 0) $ip = StringTrimLeft ($deviceip, 9) $currentip = GUICtrlRead (11, 0) $siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", $ip) ;__HS2170W($ip, $siteid, $currentip, $printname) Elseif $res1 > 1 Then $res1 = GUICtrlRead ($radio2, 0) If $res1 = 1 then ;MsgBox (4096, "Result", "Rebooters") ;GUISetState (@SW_LOCK) $deviceip = GUICtrlRead (17, 0) If $res1 = 1 then $read = GUICtrlRead ($routercombo) ;MsgBox (4096, "Result", $read) If $read = "IP9258" Then WAG120NINPUTS () GUICtrlSetState($OK, $GUI_HIDE) $GO = GUICtrlCreateButton ("GO", 325, 320, 70) $buttonchange = 1 Do $msg = GUIGetMsg() $msg1 = GUICtrlRead ( $radio3 ) ;MsgBox (4096, "Result", $msg1) Until $msg = $GO or $msg1 >1 Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GO GUISetState (@SW_LOCK) ;$deviceip = GUICtrlRead (9, 0) ;$ip = StringTrimLeft ($deviceip, 9) ;$currentip = GUICtrlRead (11, 0) ;$siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", "Go Clicked") ;__HS2170W($ip, $siteid, $currentip, $printname) EndSelect ElseIf $read = "NP-02U" Then WAG120NINPUTS () GUICtrlSetState($OK, $GUI_HIDE) $GO = GUICtrlCreateButton ("GO", 325, 320, 70) $buttonchange = 1 Do $msg = GUIGetMsg() $msg1 = GUICtrlRead ( $radio3 ) ;MsgBox (4096, "Result", $msg1) Until $msg = $GO or $msg1 >1 Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GO GUISetState (@SW_LOCK) ;$deviceip = GUICtrlRead (9, 0) ;$ip = StringTrimLeft ($deviceip, 9) ;$currentip = GUICtrlRead (11, 0) ;$siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", "Go Clicked") ;__HS2170W($ip, $siteid, $currentip, $printname) EndSelect $ip = StringTrimLeft ($deviceip, 9) $siteid = GUICtrlRead (19, 0) $port1 = GUICtrlRead (21, 0) $port2 = GUICtrlRead (23, 0) $port3 = GUICtrlRead (25, 0) $port4 = GUICtrlRead (27, 0) ;MsgBox (4096, "Result", $port4) EndIf ;__HSIP9258($ip, $siteid, $port1, $port2, $port3, $port4) ElseIf $res1 > 1 Then $res1 = GUICtrlRead ($radio3, 0) If $res1 = 1 then $read = GUICtrlRead ($routercombo) ;MsgBox (4096, "Result", $read) If $read = "Linksys WAG120N ADSL Router" Then WAG120NINPUTS () GUICtrlSetState($OK, $GUI_HIDE) $GO = GUICtrlCreateButton ("GO", 325, 320, 70) $buttonchange = 1 Do $msg = GUIGetMsg() $msg1 = GUICtrlRead ( $radio3 ) ;MsgBox (4096, "Result", $msg1) Until $msg = $GO or $msg1 >1 Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GO GUISetState (@SW_LOCK) ;$deviceip = GUICtrlRead (9, 0) ;$ip = StringTrimLeft ($deviceip, 9) ;$currentip = GUICtrlRead (11, 0) ;$siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", "Go Clicked") ;__HS2170W($ip, $siteid, $currentip, $printname) EndSelect ElseIf $read = "Linksys WRT54GL Wireless Router" Then WAG120NINPUTS () GUICtrlSetState($OK, $GUI_HIDE) $GO = GUICtrlCreateButton ("GO", 325, 320, 70) $buttonchange = 1 Do $msg = GUIGetMsg() $msg1 = GUICtrlRead ( $radio3 ) ;MsgBox (4096, "Result", $msg1) Until $msg = $GO or $msg1 >1 Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GO GUISetState (@SW_LOCK) ;$deviceip = GUICtrlRead (9, 0) ;$ip = StringTrimLeft ($deviceip, 9) ;$currentip = GUICtrlRead (11, 0) ;$siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", "Go Clicked") ;__HS2170W($ip, $siteid, $currentip, $printname) EndSelect ElseIf $read = "Linksys WAG54G2 ADSL Router" Then WAG120NINPUTS () GUICtrlSetState($OK, $GUI_HIDE) $GO = GUICtrlCreateButton ("GO", 325, 320, 70) $buttonchange = 1 Do $msg = GUIGetMsg() $msg1 = GUICtrlRead ( $radio3 ) ;MsgBox (4096, "Result", $msg1) Until $msg = $GO or $msg1 >1 Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GO GUISetState (@SW_LOCK) ;$deviceip = GUICtrlRead (9, 0) ;$ip = StringTrimLeft ($deviceip, 9) ;$currentip = GUICtrlRead (11, 0) ;$siteid = GUICtrlRead (13, 0) MsgBox (4096, "Result", "Go Clicked") ;__HS2170W($ip, $siteid, $currentip, $printname) EndSelect EndIf EndIf EndIf EndSelect Wend ;============================================================== ; Printer Functions ;============================================================== Func _HidePrinters() GUICtrlSetState($printgroup, $GUI_HIDE) GUICtrlSetState($printcombolabel, $GUI_HIDE) GUICtrlSetState($printcombo, $GUI_HIDE) GUICtrlSetState($printcombodata, $GUI_HIDE) GUICtrlSetState($printsitelabel, $GUI_HIDE) GUICtrlSetState($printsiteinput, $GUI_HIDE) GUICtrlSetState($printsitelabel1, $GUI_HIDE) GUICtrlSetState($printsiteinput1, $GUI_HIDE) EndFunc Func _ShowPrinters() GUICtrlSetState($printgroup, $GUI_SHOW) GUICtrlSetState($printcombolabel, $GUI_SHOW) GUICtrlSetState($printcombo, $GUI_SHOW) GUICtrlSetState($printcombodata, $GUI_SHOW) GUICtrlSetState($printsitelabel, $GUI_SHOW) GUICtrlSetState($printsiteinput, $GUI_SHOW) GUICtrlSetState($printsitelabel1, $GUI_SHOW) GUICtrlSetState($printsiteinput1, $GUI_SHOW) EndFunc ;============================================================== ; Rebooter Functions ;============================================================== Func _HideRebooters() GUICtrlSetState($rebootergroup, $GUI_HIDE) GUICtrlSetState($rebootercombolabel, $GUI_HIDE) GUICtrlSetState($rebootercombo, $GUI_HIDE) GUICtrlSetState($rebootercombodata, $GUI_HIDE) GUICtrlSetState($rebootercombolabel0, $GUI_HIDE) GUICtrlSetState($rebootercombo0, $GUI_HIDE) GUICtrlSetState($rebootercombodata0, $GUI_HIDE) If $IP9258visible = 1 then GUICtrlSetState($rebootercombolabel1, $GUI_HIDE) GUICtrlSetState($rebootercombolabel2, $GUI_HIDE) GUICtrlSetState($rebootercombolabel3, $GUI_HIDE) GUICtrlSetState($rebootercombolabel4, $GUI_HIDE) GUICtrlSetState($rebootercombolabel5, $GUI_HIDE) GUICtrlSetState($rebootercombolabel6, $GUI_HIDE) GUICtrlSetState($rebootercombolabel7, $GUI_HIDE) GUICtrlSetState($rebootercombolabel8, $GUI_HIDE) GUICtrlSetState($rebootercombolabel9, $GUI_HIDE) GUICtrlSetState($rebootercombolabel10, $GUI_HIDE) EndIf If $NP02Uvisible = 1 then GUICtrlSetState($rebootercombolabel1, $GUI_HIDE) GUICtrlSetState($rebootercombolabel2, $GUI_HIDE) GUICtrlSetState($rebootercombolabel3, $GUI_HIDE) GUICtrlSetState($rebootercombolabel4, $GUI_HIDE) GUICtrlSetState($rebootercombolabel5, $GUI_HIDE) GUICtrlSetState($rebootercombolabel6, $GUI_HIDE) EndIf If $buttonchange = 1 Then _GUICtrlButton_Destroy ($GO) GUICtrlSetState($OK, $GUI_SHOW) EndIf EndFunc Func _ShowRebooters() GUICtrlSetState($rebootergroup, $GUI_SHOW) GUICtrlSetState($rebootercombolabel, $GUI_SHOW) GUICtrlSetState($rebootercombo, $GUI_SHOW) GUICtrlSetState($rebootercombodata, $GUI_SHOW) GUICtrlSetState($rebootercombolabel0, $GUI_SHOW) GUICtrlSetState($rebootercombo0, $GUI_SHOW) GUICtrlSetState($rebootercombodata0, $GUI_SHOW) EndFunc Func _ShowIP9256() GUICtrlSetState($rebootercombolabel1, $GUI_SHOW) GUICtrlSetState($rebootercombolabel2, $GUI_SHOW) GUICtrlSetState($rebootercombolabel3, $GUI_SHOW) GUICtrlSetState($rebootercombolabel4, $GUI_SHOW) GUICtrlSetState($rebootercombolabel5, $GUI_SHOW) GUICtrlSetState($rebootercombolabel6, $GUI_SHOW) GUICtrlSetState($rebootercombolabel7, $GUI_SHOW) GUICtrlSetState($rebootercombolabel8, $GUI_SHOW) GUICtrlSetState($rebootercombolabel9, $GUI_SHOW) GUICtrlSetState($rebootercombolabel10, $GUI_SHOW) $IP9258visible = 1 EndFunc Func _NP02U() GUICtrlSetState($rebootercombolabel1, $GUI_SHOW) GUICtrlSetState($rebootercombolabel2, $GUI_SHOW) GUICtrlSetState($rebootercombolabel3, $GUI_SHOW) GUICtrlSetState($rebootercombolabel4, $GUI_SHOW) GUICtrlSetState($rebootercombolabel5, $GUI_SHOW) GUICtrlSetState($rebootercombolabel6, $GUI_SHOW) $NP02Uvisible = 1 EndFunc ;============================================================== ; Router Functions ;============================================================== Func _HideRouters() GUICtrlSetState($routergroup, $GUI_HIDE) GUICtrlSetState($routercombolabel, $GUI_HIDE) GUICtrlSetState($routercombo, $GUI_HIDE) GUICtrlSetState($routercombodata, $GUI_HIDE) ;$visible = $labelvisible ;MsgBox (4096, "RESULT!", $visible) If $WAG120NVisible = 1 then GUICtrlSetState($WAG120NSiteLabel, $GUI_HIDE) GUICtrlSetState($WAG120NSiteInput, $GUI_HIDE) GUICtrlSetState($WAG120NUserLabel, $GUI_HIDE) GUICtrlSetState($WAG120NUserInput, $GUI_HIDE) GUICtrlSetState($WAG120NPassLabel, $GUI_HIDE) GUICtrlSetState($WAG120NPassInput, $GUI_HIDE) EndIf If $buttonchange = 1 Then _GUICtrlButton_Destroy ($GO) GUICtrlSetState($OK, $GUI_SHOW) EndIf EndFunc Func _ShowRouters() GUICtrlSetState($routergroup, $GUI_SHOW) GUICtrlSetState($routercombolabel, $GUI_SHOW) GUICtrlSetState($routercombo, $GUI_SHOW) GUICtrlSetState($routercombodata, $GUI_SHOW) EndFunc Func WAG120NINPUTS () $WAG120NSiteLabel = GUICtrlCreateLabel ("Input Site Name:", 15, 102) $WAG120NSiteInput = GUICtrlCreateInput ("", 125, 100, 210) $WAG120NUserLabel = GUICtrlCreateLabel ("User Name:", 15, 133) $WAG120NUserInput = GUICtrlCreateInput("@direct.telstra.net", 125, 130, 210) $WAG120NPassLabel = GUICtrlCreateLabel ("Password:", 15, 164) $WAG120NPassInput = GUICtrlCreateInput("", 125, 160, 210) $WAG120NVisible = 1 EndFunc
-
Error Returning Form Name - Need Help !!!
hispeed_mike replied to hispeed_mike's topic in AutoIt General Help and Support
OK!, So just to update, after many hours and now baldness I worked out why the error... Seems that the navigating the following way and making the page complete then started returning the $nav value correctly: $url = "http://" & $currentip;/bio/general.html?interface=1 $nav = _IECreate ($url, 0, 1, 1, 1) _IEnavigate ($nav, "http://" & $currentip & "/bio/general.html?interface=1", 0) Sleep (5000) $exists = WinExists ("Connect to", "") WinWait ("Connect to", "") ControlSend ("Connect to", "", "Edit2", "admin") ControlSend ("Connect to", "", "Edit3", "access") ControlClick ("Connect to", "", "Button2") $colForms = _IEFormGetCollection ($nav) For $oForm In $colForms $oFormElements = _IEFormElementGetCollection ( $oForm ) For $oFormElement In $oFormElements If $oFormElement.name = 'nodename' Then ;_IEFormElementSetValue ( $oFormElement, "Found You", 0) _IEAction($oFormElement, "focus") _IEAction($oFormElement, "selectall") Send ($printname) _IEAction($oFormElement, "unselect") _IEFormSubmit ($oForm, 1) EndIf Next Next So I navigate to a page that does not rely on and wait for it to complete and the $nav value returns correctly, then navigate to the page that requires login and then I get the collection and all is good in the kingdom again. Thanks all for your help, I hope this explaination could help others... -
Error Returning Form Name - Need Help !!!
hispeed_mike replied to hispeed_mike's topic in AutoIt General Help and Support
Line 2547 is Return $o_object.document of the Function below from IE.au3 Func _IEDocGetObj(ByRef $o_object) If Not IsObj($o_object) Then __IEErrorNotify("Error", "_IEDocGetObj", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; Switch __IEIsObjType($o_object, "document") Case True SetError($_IEStatus_Success) Return $o_object Case False SetError($_IEStatus_Success) Return $o_object.document EndSwitch EndFunc ;==>_IEDocGetObj Line 1201 is SetExtended($oTemp.forms.length) of the following Function from IE.au3 Func _IEFormGetCollection(ByRef $o_object, $i_index = -1) If Not IsObj($o_object) Then __IEErrorNotify("Error", "_IEFormGetCollection", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; Local $oTemp = _IEDocGetObj($o_object) $i_index = Number($i_index) Select Case $i_index = -1 SetError($_IEStatus_Success) SetExtended($oTemp.forms.length) Return $oTemp.forms Case $i_index > -1 And $i_index < $oTemp.forms.length SetError($_IEStatus_Success) SetExtended($oTemp.forms.length) Return $oTemp.forms.item($i_index) Case $i_index < -1 __IEErrorNotify("Error", "_IEFormGetCollection", "$_IEStatus_InvalidValue", "$i_index < -1") SetError($_IEStatus_InvalidValue, 2) Return 0 Case Else __IEErrorNotify("Warning", "_IEFormGetCollection", "$_IEStatus_NoMatch") SetError($_IEStatus_NoMatch, 1) Return 0 EndSelect EndFunc ;==>_IEFormGetCollection My script is not that long... And you are right, I am still learning alot of this, error reporting is not included, I don't have a great understanding of wrapping code and returning errors as alot of my coding is just throwing commands to windows etc. Your help is really appreciated. Thanks -
Error Returning Form Name - Need Help !!!
hispeed_mike replied to hispeed_mike's topic in AutoIt General Help and Support
--> COM Error Encountered in HS_NETPRINT_SETUP.au3 ----> $IEComErrorScriptline = 2547 ----> $IEComErrorNumberHex = 80020009 ----> $IEComErrorNumber = -2147352567 ----> $IEComErrorWinDescription = Unspecified error ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = 0 ----> $IEComErrorLastDllError = 0 --> COM Error Encountered in HS_NETPRINT_SETUP.au3 ----> $IEComErrorScriptline = 1201 ----> $IEComErrorNumberHex = 000000A9 ----> $IEComErrorNumber = 169 ----> $IEComErrorWinDescription = Variable must be of type 'Object'. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = 0 ----> $IEComErrorLastDllError = 0 --> COM Error Encountered in HS_NETPRINT_SETUP.au3 ----> $IEComErrorScriptline = 1201 ----> $IEComErrorNumberHex = 000000A9 ----> $IEComErrorNumber = 169 ----> $IEComErrorWinDescription = Variable must be of type 'Object'. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = 0 ----> $IEComErrorLastDllError = 0 --> COM Error Encountered in HS_NETPRINT_SETUP.au3 ----> $IEComErrorScriptline = 1202 ----> $IEComErrorNumberHex = 000000A9 ----> $IEComErrorNumber = 169 ----> $IEComErrorWinDescription = Variable must be of type 'Object'. ----> $IEComErrorDescription = ----> $IECom----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = 0 ----> $IEComErrorLastDllError = 0 --> COM Error Encountered in HS_NETPRINT_SETUP.au3 ----> $IEComErrorScriptline = 49 ----> $IEComErrorNumberHex = 000000A9 ----> $IEComErrorNumber = 169 ----> $IEComErrorWinDescription = Variable is not of type 'Object'. ----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = 0ErrorLastDllError = 0 There is the output, Variable is not of type 'Object' ?????? Any ideas?, thanks for the heads up on the <> code option when posting. -
Hi All, I have various scripts that automate setup of different network devices via their web interface. Scripted alot of them and cam across a brother printer I need to configure that does not have a form name in the html just an action.Here is my code: #include <IE.au3> #include <inet.au3> $ip = "10.10.10.100" $siteid = "Test" $currentip = "10.10.10.9" $printname = "Printer" __HS2170W ($ip, $siteid, $currentip, $printname) Func __HS2170W($ip, $siteid, $currentip, $printname) $url = "http://10.10.10.9/bio/general.html?interface=1" $nav = _IECreate ($url, 0, 1, 0, 1) WinWait ("Connect to " & $currentip, "") ControlSend ("Connect to " & $currentip, "", "Edit2", "admin") ControlSend ("Connect to " & $currentip, "", "Edit3", "access") ControlClick ("Connect to " & $currentip, "", "Button2") #cs $oDoc = _IEDocGetObj($nav) $oArray = $oDoc.getElementsByTagName ("nodename") For $element In $oArray If $element.id="nodename" Then _IEFormElementSetValue($element, "Found you") Next ;_IENavigate ($nav, "http://192.168.1.1/setup.cgi?next_file=Setup.htm") #ce $colForms = _IEFormGetCollection ($nav ) For $oForm In $colForms $oFormElements = _IEFormElementGetCollection ( $oForm ) For $oFormElement In $oFormElements If $oFormElement.id = 'nodename' Then _IEFormElementSetValue ( $oFormElement, "Found You" ) EndIf Next Next EndFunc Here is the Webpage Source: <!-- All Rights Reserved. Copyright(C) 2000-2005 Brother Industries, Ltd. --> <HTML> <HEAD> <TITLE>Brother HL-2170W series</TITLE> <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> <LINK REL=STYLESHEET TYPE="text/css" Href="/printer/printer.css"> </HEAD> <BODY topmargin="0" leftmargin="0" marginwidth="0" marginheight="0"> <script LANGUAGE="JavaScript"> <!-- var pretext = ""; setTimeout("checkstring()", 250); function checkstring() { var str = document.forms[0].nodename.value; if (str != pretext){ searchstring(str); } str = document.forms[0].nodename.value; pretext = str; setTimeout("checkstring()", 100); } function searchstring(str) { if (str.match(/[^\w|\-|\@|\_]/) || str.match(/[\|]/)){ document.forms[0].nodename.value = pretext; } } //--> </SCRIPT> <A NAME="top"></A> <CENTER> <DIV CLASS="headinfo"> <TABLE height="106" cellSpacing="0" cellPadding="0" width="100%" border="0"> <TBODY> <TR> <TD width="20"></TD> <TD vAlign=top align=left> <!--// brother logo //--> <IMG SRC="/pbio/brother.gif" WIDTH="144" HEIGHT="52" BORDER="0"> <BR> <!--// Model Name //--> <IMG SRC="/printer/hl2170w.gif" WIDTH="144" HEIGHT="16" BORDER="0"> </TD> <TD valign=top align=center> <!--// LINK ITEMS //--> <TABLE cellSpacing="0" cellPadding="0" border="0"> <TR> <TD VALIGN="top"> <!--// LEFT ITEMS //--> <TABLE cellSpacing="2" cellPadding="0" border="0"> <TR> <TD noWrap CLASS="headtd"> <A HREF="/printer/main.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Home Page </A> </TD> </TR> <TR> <TD noWrap CLASS="headtd"> <A HREF="/printer/configu.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">View Configuration </A> </TD> </TR> <TR> <TD noWrap CLASS="headtd"> <A HREF="/printer/maininfo.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Maintenance Information </A> </TD> </TR> <TR> <TD noWrap CLASS="headtd"> <A HREF="/pbio/find.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Find Device </A> </TD> </TR> </TABLE> <!--// END OF LEFT ITEMS //--> </TD> <TD> <!--// RIGHT ITEMS //--> <TABLE cellSpacing="2" cellPadding="0" border="0"> <TR> <TD ROWSPAN="1"> <A HREF="/pbio/hlp_certify.html"><IMG SRC="/pbio/key_user.gif" WIDTH="24" HEIGHT="11" BORDER="0" ALT="Help" ><BR><IMG SRC="/pbio/bar_v.gif" WIDTH="24" HEIGHT="3" BORDER="0" ><BR><IMG SRC="/pbio/bar_h.gif" WIDTH="24" HEIGHT="1" BORDER="0" ><BR> </A> </TD> <TD noWrap CLASS="headtd"> <A HREF="/user/prnset.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Printer Settings </A> </TD> </TR> <TR> <TD ROWSPAN="3"> <A HREF="/pbio/hlp_certify.html"><IMG SRC="/pbio/key_admin.gif" WIDTH="24" HEIGHT="11" BORDER="0" ALT="Help"><BR><IMG SRC="/pbio/bar_v.gif" WIDTH="24" HEIGHT="30" BORDER="0" ><BR><IMG SRC="/pbio/bar_h.gif" WIDTH="24" HEIGHT="1" BORDER="0" ><BR> </A> </TD> <TD noWrap CLASS="headtd"> <A HREF="/admin/password.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Administrator Settings </A> </TD> </TR> <TR> <TD noWrap CLASS="headtd"> <A HREF="/admin/panel.html"CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Reset & Test </A> </TD> </TR> <TR> <TD noWrap CLASS="headtd"> <A HREF="/bio/main.html" CLASS="heada"> <img src="/printer/ball.gif" border=0 width="15" height="11">Network Configuration </A> </TD> </TR> </TABLE> <!--// RIGHT ITEMS //--> </TD> <TD width=20></TD> <TD> <A HREF="/pbio/hlp_certify.html"><IMG SRC="/printer/key_help.gif" WIDTH="36" HEIGHT="39" BORDER="0" ALT="Help"></A> </TD> </TR> </TABLE> <!--// END OF LINK ITEMS //--> </TD> <TD valign=top align=right> <IMG SRC="/printer/spacer.gif" HEIGHT=10> <BR> <A HREF="http://solutions.brother.com/cgi-bin/solutions.cgi?MDL=prn043&LNG=en&SRC=DEVICE"><IMG SRC="/pbio/model_s.gif" ALT="Brother" WIDTH="144" HEIGHT="45" BORDER="0"></A> </TD> <TD width="20"></TD> </TR> </TBODY> </TABLE> </DIV> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT=380> <TR><TD ALIGN="LEFT" VALIGN="TOP"> <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0> <TR><TD><A HREF="/bio/main.html?interface=1" CLASS="treehead">Network Configuration</A></TD></TR> <TR><TD HEIGHT=5></TD></TR> <TR><TD> <TABLE BORDER=0> <TR> <TD VALIGN="TOP" ALIGN="RIGHT" WIDTH="50"><IMG SRC="/pbio/pas.gif" WIDTH="15" HEIGHT="19"></TD> <TD VALIGN="TOP" ALIGN="LEFT"> <TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2> <TR> <TD BGCOLOR="#FFCC66"> <A HREF="/bio/tcpip2002.html?interface=1" CLASS="treeitem">TCP/IP</A></TD> <TD BGCOLOR="#FFCC66"> <A HREF="/bio/netbeui.html?interface=1" CLASS="treeitem">NetBIOS</A></TD> <TD BGCOLOR="#FFCC66"> <A HREF="/bio/protocol.html?interface=1" CLASS="treeitem">Protocol</A></TD> </TR> </TABLE> </TD></TR></TABLE> </TD></TR> <TR><TD ALIGN="CENTER" VALIGN="TOP" BGCOLOR="#99CCFF" WIDTH=550> <TABLE BORDER=0 CELLPADDING=0 WIDTH=100%> <TR><TD> <TABLE BORDER=0 CELLPADDING=0 WIDTH=100%><TR> <TD WIDTH=10></TD> <TD ALIGN=LEFT VALIGN=BOTTOM NOWRAP><FONT SIZE=5 COLOR="#000099"><B>Node Name</B></FONT>       (Wired) </TD> </TR></TABLE> <HR WIDTH="95%"></TD></TR> <TR><TD ALIGN=CENTER> <TABLE NOWRAP CELLPADDING=5 BORDER=0> <FORM METHOD=POST ACTION="/bio/post/general.html"> <TR> <TD NOWRAP ALIGN=LEFT VALIGN=TOP><FONT COLOR="#000099"><B>Node Name</B></FONT></TD> <TD NOWRAP ALIGN=LEFT VALIGN=TOP> <INPUT TYPE=TEXT SIZE=32 MAXLENGTH=32 NAME=nodename VALUE="BRN001BA9657C41" onKeyDown="checkstring()"> </TD> </TR> <INPUT TYPE=hidden NAME="interface" VALUE=1 > <TR><TD COLSPAN=2 ALIGN=CENTER VALIGN=TOP><HR WIDTH="100%"> <INPUT TYPE="reset" VALUE="Cancel"> <INPUT TYPE="Submit" VALUE="Submit"> </TD></TR> </FORM> </TABLE> </TD></TR> </TABLE> </TD></TR> <TR><TD ALIGN="RIGHT" HEIGHT="40"><A HREF="#top"><IMG SRC="/pbio/backtop.gif" BORDER=0></A></TD></TR> </TABLE> </TD></TR> </TABLE> <BR><BR> </CENTER> <TABLE BORDER="0" WIDTH="100%" CELLSPACING=0 CELLPADDING=0 HEIGHT="43"> <TR BGCOLOR="#000066" ALIGN="CENTER" VALIGN="TOP"> <TD><FONT COLOR="#FFFFFF"><BR>Copyright(C) 2000-2007 Brother Industries, Ltd. All Rights Reserved.</FONT></TD> </TR> </TABLE> </BODY> </HTML> I am trying to change the Data in the edit box called "nodename" In my code I have tried 2 ways other than using the _IEFormGetObjByName, which only works if it returns a form name. Help on this is much appreciated, sorry for the wall of text, Thanks in advance.
-
Hi All, first dll call and I am just strgling to get me head around the conversion from VB to autoit and how to structure the call. I am trying to show the Turn Off Computer Dialog from XP. I cannot use the standard dialog windows uses as it has the shutdown option and we have modified the gina to only allow the restart button and some custom text we have injected. Here is the VB script: 'System & API - How to Show Shutdown Dialog Private Declare Function SHShutDownDialog Lib "shell32" Alias "#60" (ByVal YourGuess As Long) As Long Private Sub Main() SHShutDownDialog 0 End Sub How Do I get it into a dllcall for autoit? I have read the Help and multiple examples but I just don't get it. All help appreciated, thanks in advance.
-
HKCU Registry Permission Change Needed
hispeed_mike replied to itpro0309's topic in AutoIt General Help and Support
Another way you might get some success is to load the NTUSER.DAT from the users folder and then mount it inot the registry as say "HKEY_LOCAL_MACHINE\TempHive". It will load up just like the "HKEY_CURRENT_USER" when the user is logged on. Write all you want to that hive and then unload the TempHive from the registry. Search abit on loading the hive from command line and you will still be able to automate it in Autoit. Hope it helps. -
Unfortunalty not. Calcs will list the permissions but I cannot get the stdoutread to pick up the results. Just returns nothing back. Can anyone confirm or deny that calcs.exe support console output? Hers is my code If anyone can halp: Local $foo = Run(@comspec & ' cacls "' & @SCRIPTDIR & '\Test"' , @systemdir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD ) Local $line While 1 $line = StdoutRead($foo) If @error Then ExitLoop MsgBox(0, "STDOUT read:", $line) Wend While 1 $line = StderrRead($foo) If @error Then ExitLoop MsgBox(0, "STDERR read:", $line) Wend MsgBox(0, "Debug", "Exiting...")
-
Hi all, Below is my script. What I am basically doing is want to create a GUI that has a List of Registry settings from a specific Key. Dump that into a list view column and then Dump the values of the registry keys into the second column. I want to eventually make the value editable and then submit any changes back to the registry. The problem I am having is on the _GUICtrlListView_AddArray control. The array exists and can be displayed but when I get down to the Loop for the UBound I get this error: Line 390 (File "C:\Program Files\Autoit3\Include\GuiListView.au3"): DllStructSetData($tBuffer, "Text", #aItems[$iI][0]) DllStructSetData($tBuffer, "Text", ^ERROR Error:Array Variables has incorrect number of subscripts or subscript dimensions range exceeded. I thought this was to do with the naming convention change from the example in Help to the array names I had set up or that the number of rows were not being read from the array. Heads up appreciated. Excuse the layout of the code. #include "CompInfo.au3" #include "Array.au3" #include <GUIConstantsEx.au3> #Include <GuiListView.au3> ;Opt('MustDeclareVars', 1) Global $aReg[1] [1] [1] Global $aReg2 [1] [1] Global $aReg3 [1] [1] $RegKey = "HKEY_LOCAL_MACHINE\Software\Hispeed" $num = 0 For $i = 1 to 100 $var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Hispeed", $i) if @error <> 0 Then ExitLoop ;MsgBox(4096, "Value Name #" & $i & " under in AutoIt3 key", $var) _ArrayAdd ($aReg, $var) $add = $num + 1 $num = $add next $x = $num For $x = $num to 1 Step -1 $key = $aReg[$x] $val = RegRead ($RegKey, $key) ;MsgBox (4096, "Result", $RegKey & "\" & $key & "\" & $val) _ArrayAdd ($aReg2, $RegKey & "\" & $key) _ArrayAdd ($aReg3, $val) Next ; -------------------------------------------------------------------------------------- Example() Func Example() Local $add, $clear, $reglist, $close, $msg, $regtitle ; Create GUI GUICreate("ListView Add Array", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) ;_GUICtrlListView_SetUnicodeFormat($hListView, False) GUISetState() _GUICtrlListView_AddColumn($hListView, "Key Name", 100) _GUICtrlListView_AddColumn($hListView, "Value", 100) _GUICtrlListView_SetItemCount($hListView, $num) For $iI = 0 To UBound($aReg2) - 1 $aReg2[$num] = "Key Name" & $iI Next _GUICtrlListView_AddArray($hListView, $aReg2) $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) $close = GUICtrlCreateButton("Exit", 64, 350, 175, 25) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $close Exit EndSelect WEnd EndFunc ;==>Example
-
Hi all, Below is my script. What I am basically doing is want to create a GUI that has a List of Registry settings from a specific Key. Dump that into a list view column and then Dump the values of the registry keys into the second column. I want to eventually make the value editable and then submit any changes back to the registry. The problem I am having is on the _GUICtrlListView_AddArray control. The array exists and can be displayed but when I get down to the Loop for the UBound I get this error: Line 390 (File "C:\Program Files\Autoit3\Include\GuiListView.au3"): DllStructSetData($tBuffer, "Text", #aItems[$iI][0]) DllStructSetData($tBuffer, "Text", ^ERROR Error:Array Variables has incorrect number of subscripts or subscript dimensions range exceeded. I thought this was to do with the naming convention change from the example in Help to the array names I had set up or that the number of rows were not being read from the array. Heads up appreciated. Excuse the layout of the code. #include "CompInfo.au3" #include "Array.au3" #include <GUIConstantsEx.au3> #Include <GuiListView.au3> ;Opt('MustDeclareVars', 1) Global $aReg[1] [1] [1] Global $aReg2 [1] [1] Global $aReg3 [1] [1] $RegKey = "HKEY_LOCAL_MACHINE\Software\Hispeed" $num = 0 For $i = 1 to 100 $var = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Hispeed", $i) if @error <> 0 Then ExitLoop ;MsgBox(4096, "Value Name #" & $i & " under in AutoIt3 key", $var) _ArrayAdd ($aReg, $var) $add = $num + 1 $num = $add next $x = $num For $x = $num to 1 Step -1 $key = $aReg[$x] $val = RegRead ($RegKey, $key) ;MsgBox (4096, "Result", $RegKey & "\" & $key & "\" & $val) _ArrayAdd ($aReg2, $RegKey & "\" & $key) _ArrayAdd ($aReg3, $val) Next ; -------------------------------------------------------------------------------------- Example() Func Example() Local $add, $clear, $reglist, $close, $msg, $regtitle ; Create GUI GUICreate("ListView Add Array", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) ;_GUICtrlListView_SetUnicodeFormat($hListView, False) GUISetState() _GUICtrlListView_AddColumn($hListView, "Key Name", 100) _GUICtrlListView_AddColumn($hListView, "Value", 100) _GUICtrlListView_SetItemCount($hListView, $num) For $iI = 0 To UBound($aReg2) - 1 $aReg2[$num] = "Key Name" & $iI Next _GUICtrlListView_AddArray($hListView, $aReg2) $add = GUICtrlCreateButton("Add", 64, 32, 75, 25) $clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) $close = GUICtrlCreateButton("Exit", 64, 350, 175, 25) $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $close Exit EndSelect WEnd EndFunc ;==>Example
-
Hi All, I am trying to automate the setup of a router to be upgraded to DD-WRT frimware and then input the common settings we need. I have got to the point where I can Create the first IE Window and navigate and get the firware loaded, at this point of loading there is a progrees bar while the router flashes. The next thing to occur is a redirect once this is finished which send it to another URL. Sample script to help make sense of this The question is in between the ==== symbols #include <IE.au3> $url = "http://192.168.1.1/Upgrade.asp" $nav = _IECreate ($url, 0, 1, 0, 1) WinWait ("Connect to 192.168.1.1") ControlSend ("Connect to 192.168.1.1", "", "Edit2", "admin") ControlSend ("Connect to 192.168.1.1", "", "Edit3", "admin") ControlClick ("Connect to 192.168.1.1", "", "Button2") Sleep (2000) ; Navigate to Upgrade.asp and input file to the firmware and submit it. $oForm = _IEFormGetObjByName ($nav, "firmware") ;$oButton = _IEFormGetObjByName ($nav, "Upgrade_b") if ( $oForm == 0 ) Then MsgBox( 4096, "1 Error in get form", @error ) endif $oFirmware = _IEFormElementGetObjByName ($oForm, "file") $oButton = _IEFormElementGetObjByName ($oForm, "Upgrade_b") if ( $oFirmware == 0 ) Then MsgBox( 4096, "2 Error in get element", @error ) endif $text = @SCRIPTDIR & "\BinFile\dd-wrt.v24_mini_generic.bin" _IEAction ($oFirmware, "focus") Send ($text) _IEAction ($oButton, "click") ; Wait for the Upgrade to complete and then Click continue. ======================================== THIS IS WHERE I AM FALLING DOWN. WAITING FOR THE FLASH TO COMPLETE AND THEN WAITING FOR THE NEW REDIRECT PAGE TO COMPLETE LOADING BEFORE CLICKING THE CONTINUE BUTTON IT GETS REDIRECTED TO HTTP://192.168.1.1/UPGRADE.CGI How do I get the $nav variable ot be http://192.168.1.1/upgrade.cgi so I can wait for it to complete loading? ======================================== $oLoad = _IELoadWait ($nav) $oButton = _IEGetObjByName ($nav, "Upgrade_b") _IEAction ($oButton, "click")
-
Help with Array and _ArrayDelete
hispeed_mike replied to hispeed_mike's topic in AutoIt General Help and Support
Not to worry, If I had just spent a moment more on the _Array to string command I would have realize the next thing I can add is which line to start from... eg. $accounts = _ArrayToString ($aAccounts, "|", 1) Thanks All for comments.... Mike -
Help with Array and _ArrayDelete
hispeed_mike replied to hispeed_mike's topic in AutoIt General Help and Support
Hi Again, with the endif in place it runs fine, The reverse order is returning nearly what I wanted. Th only issue I have with this so far is the Array also returns a [0] position as well which from what I can work out is the amount of entries in the array. I need to be able to return this array as a variable I can use in a combobox without the $aArray[0] entri being listed. Here is how I am listing the array $accounts = _ArrayToString ($aAccounts, "|") Using the delimiter to allow a combobox to list it properly. It also seems that if I try to use _ArrayDelete ($aAccounts, 0) nothing then displays, I would assume that doing this would delete the index of the array and then not display anything, woudl I be right in saying that? Thanks Mike -
Hi, Hre is my code thus far, I have spent hours pulling my hair out to try and understand a loop, and how to manage this array. Thanks in advance What I am trying to do is to load an array from a text file which is no problem. The text in this file is individual account names. After each of the account names is used I will be writing an "x" to the end of the line. Each time the array is loaded I want to exclude the ones with "x" on the end and only display the others inside of a combo box we use. This way one account name won't get used a second time. The GUI for the combo box not included. I just need help with this loop. Originally there was a message box in place for the arraydelete command which would tell me which lines had the "x" on the ned and it worked. Since changing this to _ArrayDelete I get "Array variable has incorrect number of subscripts Error....". Please if t all possible a little explaination on what I am missing here. I have read help not finding anything I thought to be relevant. I really really want to understand loops. #include "Process.au3" #include "ControlSendPlus.au3" #include <GUIConstants.au3> #include <file.au3> #Include <Array.au3> Dim $aAccounts If Not _FileReadToArray(@SCRIPTDIR & "\any.txt", $aAccounts) Then MsgBox(4096,"Error", " Error reading log to Array error:" & @error) Exit EndIf $i = "x" ; MsgBox (4096, "EA Account Names", $accresult) For $x = 1 To $aAccounts[0] ;loops through each line in the text file If StringInStr($aAccounts[$x], $i) Then ;reads each line of the file for the search $Line = $x MsgBox (4096, "Variable", $Line) _ArrayDelete ($aAccounts,$Line) EndIf Next
-
After looking at it I can now understand the $totalk and the $totaln but the If statement with the . and .. how do these reference the retiurns from filefindnext Shedding light on this will help me understand how to rwrite this thing in future.... At this point would I also move to including the Progress on part of the script like the help file? ProgressOn("Progress Meter", "Increments every second", "0 percent") For $i = 10 to 100 step 10 sleep(1000) ProgressSet( $i, $i & " percent") Next ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() That is from the help file... Thanks for all your help Mike
-
Hi, Automating is not a real problem, but now I want to work alot more with variables and need a pointer in the right direction. Below is a simple example of a progress bar I want to work out how to write. Basically I need to work out how many files are in the folder then declare the $file1 variable as the size of file. As it goes through the loop and finds other files I want it to add this size to the next files size to get an amount I am going to transfer. I would expect that this is then the value I would use to declare, to the progress bar that I want , to be 100% complete when it reaches this amount of data copied. As you can already see I have not added the progress bar yet and have not put in the copy command. I would greatly appreciate a pointer to how to add the file sizes together and advice if I am going about this the right way. Initially I want a file copy progress bar but would also like a script progress bar that shows me the progress of the entire script. Thanks in Advance. Mike FileChangeDir (@DESKTOPDIR & "\From") $search = FileFindFirstFile ("*.*") While 1 $file = FileFindNextFile($search) If @error Then ExitLoop $file1 = FileGetSize ($file) MsgBox(4096, "File:", $file & @CRLF & $file1) WEnd
-
It still writes an error if it completed successfully....Strange...This would mean that the @error always equals the commands outcome?????????? I tried setting the RunErrorsFatal to 1 and 0, and also @error=1 or @error=0. Still no dice....do I just give it up as too hard...I really need to make sure I get a succes or failure ont he command.... Also tried If $netsh1 = @error...still same result. Is there any other way? Thanks Mike
-
Hi, I have a script which runs sends a command to a command line and then moves on to the next command. What I want to do is to run it and get feedback on the completion if it encountered and error. So I looked up the @error. A quick outline of what I did is below.... Quic help to understand how the error value is set will help me get to where I am Going.... #include "Process.au3" Opt("RunErrorsFatal", 1) $netsh1 = RunWait (@ComSpec & " /c " & 'cacls "c:\Program Files\CB" /e /t /c /p "Inet":F', "", @SW_SHOW) If netsh1 = @error Then FileWriteLine (@DESKTOPDIR & "\SetupLog.txt", "Failed to set permissions on the xx folder - Set Permissions manually by turning off Simple File sharing and set permissions to Users with Full Access Privileges") EndIf The issue I am getting is the command runs successfully and it still writes the error to the log file. My logic is all wrong and needs straightening out.... Thanks for your help.... Mike