
experience
Active Members-
Posts
27 -
Joined
-
Last visited
experience's Achievements

Seeker (1/7)
0
Reputation
-
Cant Exit Script when its running
experience replied to experience's topic in AutoIt General Help and Support
Ah ha yeh thats good the Esc key exits! the exit button & window close still doesnt work tho -
Cant Exit Script when its running
experience replied to experience's topic in AutoIt General Help and Support
No that gives an error when you execute it -
I can exit the script before i click the start button, but as soon as it starts running it wont respond to any of the exit commands. I've set Esc, the stop button and the cross on the the window to make it close which work fine except when its running. I've tried everything i can think of to make it work but have ran out of ideas #include <GUIConstants.au3> GUICreate("title", 300, 120) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) $progressbar1 = GUICtrlCreateProgress (-150, -80,100,20) $Label = GUICtrlCreateLabel("", -170, 10, 250, 20) $Label2 = GUICtrlCreateLabel("Will put some Text here when i get a chance", -240, -70, 250, 20) $nMsg = GUIGetMsg() GUISetState () GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") GUICtrlSetOnEvent($progressbar1,"Doscript") GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") HotKeySet("Esc","close") Func close() Exit EndFunc While 1 Sleep(100) WEnd Func Quit() Exit EndFunc Func _Exit() Exit EndFunc Func DoScript() GUICtrlSetData ($progressbar1,(0)) MouseMove(1200, 400) sleep(4000) GUICtrlSetData ($progressbar1,(25)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(50)) sleep(4000) MouseMove(1200, 400) GUICtrlSetData ($progressbar1,(75)) sleep(4000) MouseMove(600, 400) GUICtrlSetData ($progressbar1,(100)) EndFunc
-
Command for Start Button to run script?
experience replied to experience's topic in AutoIt General Help and Support
Spot on - managed to recreate it using the GuiCtrlCreateProgress() like you saidEverythings now done - however i've just noticed that the stop/exit button doesnt work when the script is running. It works fine before you click the start button Have i missed something? -
Command for Start Button to run script?
experience replied to experience's topic in AutoIt General Help and Support
Excellent Thanks Just one more thing - how do i integrate my progress bar into the same GUI - when the script runs the progress bar opens in a separate window #include <GUIConstants.au3> GUICreate("my gui", 300, 150); will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) ; will display an empty dialog box Opt("GUICoordMode",2) Opt("GUIOnEventMode",1) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) GuiSetOnEvent($GUI_EVENT_CLOSE,"Quit") GuICtrlSetOnEvent($Button_2,"Quit") GuiCtrlSetOnEvent($Button_1,"DoScript") While 1 Sleep(100) WEnd Func DoScript() ProgressOn("Progress Bar", "Running","0 percent", 300, 40) $pbar = 0 ProgressSet( $pbar, $pbar & " percent") MouseMove(1200, 400) MouseMove(600, 400) $pbar = 100 ProgressSet( $pbar, $pbar & " percent") EndFunc Func Quit() Exit EndFunc -
Command for Start Button to run script?
experience posted a topic in AutoIt General Help and Support
I've got a GUI with a start button on it - how do i run the rest of the script when its pressed? Attached is an example and when the start button is pressed the script should start which in this case is a mouse move #include <GUIConstants.au3> ;GUICreate("my gui", 300, 150) ; will create a dialog box that when displayed is centered ;GUISetState (@SW_SHOW) ; will display an empty dialog box ;Opt("GUICoordMode",2) $Button_1 = GUICtrlCreateButton ("Start", 50, 90, 100) $Button_2 = GUICtrlCreateButton ( "Stop / Exit", 0, -1) ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 ;need command to start script further down Case $msg = $Button_2 Exit If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndSelect Wend MouseMove(1200, 400) -
No that didnt work either tried putting it in as below ;Changes CDRom Drive to Z send("{alt}") sleep(1000) send("{lwin}{r}") WinWaitActive("Run") send("{d}{i}{s}{k}{m}{g}{m}{t}{.}{m}{s}{c}") send("{enter}") WinWaitActive("Disk Management") sleep(10000) send("{down}") sleep(3000) send("{altdown}{a}{altup}{k}{c}") Opt("WinTitleMatchMode", 4) WinWaitActive ("[REGEXPTITLE:Change Drive Letter and Paths for [DE]: \(\)]") sleep(2000) send("{tab 2}{enter}") WinWaitActive("Change Drive Letter or Path") send("{tab}{z}{enter}") WinWaitActive("Confirm") sleep(1000) send("{y}") sleep(2000) send("{altdown}{f}{x}{altup}") sleep(8000) send("{tab 2}{x}") sleep(5000)
-
Yeh i could do that but its a little bit risky incase the script selects the C drive and then changes its drive letter which i dont want to happen I was thinking of the following but it doesn't work WinWaitActive("Change Drive Letter and Paths for D: ()") if not WinActive("Change Drive Letter and Paths for D: ()") then WinWaitActive("Change Drive Letter and Paths for E: ()")
-
I've written a script and part of it changes the CD drive letter. The problem i've just encountered is that on new laptops the CD drive is D and on desktops its E. I initially wrote my script for laptops but need to change it to include desktops hence the E drive. When the script runs on desktops it stops because of the following: WinWaitActive("Change Drive Letter and Paths for D: ()") Is there a way i can keep the WinWaitActive but to wait for Either D or E ? If not i'l just have to get rid of the WinWaitActive and use a sleep command
-
Hmm well it doesnt do anything for me - i've tried it on a simple piece of code below to open the calc - when its opened the calc the .exe compiled file is still present Try it for yourself and let me know where im going wrong send("{lwin}{r}") WinWaitActive("Run") send("{c}{a}{l}{c}{enter}") Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc
-
Hi, i've got a script that i want to self delete once its finished. After i've looked on the forum i've found the script - but i cant get it to work My script is located in: but i cant put the path in the following to get it to work Func _SelfDelete($iDelay = 0) Local $sCmdFile FileDelete(@TempDir & "\scratch.bat") $sCmdFile = 'ping -n ' & $iDelay & '127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '"' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'del ' & @TempDir & '\scratch.bat' FileWrite(@TempDir & "\scratch.bat", $sCmdFile) Run(@TempDir & "\scratch.bat", @TempDir, @SW_HIDE) EndFunc Could someone put the path i've quoted and place it in the above script to get it to work ?
-
Hi, i want to add a new PC to the AD domain and change the PC name. Below is a script i've found on this site and modified - i've tried this on my home pc but nothing happens when i click join- any idea where its gone wrong? #include <GuiConstants.au3> GuiCreate("PC to Domain Creator", 386, 218, 490,359) $edt_pc_name = GuiCtrlCreateInput("New PC Name", 16, 25, 169, 21) $edt_uname = GuiCtrlCreateInput("Username", 16, 50, 169, 21) $edt_pw = GuiCtrlCreateInput("Password", 16, 75, 169, 21) $btn_join = GuiCtrlCreateButton("Join Domain", 112, 125, 73, 25) $btn_cancel = GuiCtrlCreateButton("Cancel", 112, 160, 73, 25) $GroupBox1 = GuiCtrlCreateGroup("Current Information", 200, 16, 169, 153) $pc_name = GuiCtrlCreateLabel("", 230, 40, 90, 13) $current_user = GuiCtrlCreateLabel("", 230, 60, 90, 13) $pc_ip = GuiCtrlCreateLabel("", 230, 80, 90, 13) $os_build = GuiCtrlCreateLabel("", 230, 100, 90, 13) $service_pack = GuiCtrlCreateLabel("", 230, 120, 90, 13) $Animate1 = GUICtrlCreateAvi ("shell32.dll",152, 88, 130, 16, 16) GUICtrlSetState($Animate1, 0 ) _UpdateLabels() GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $btn_cancel ExitLoop Case $msg = $btn_join $domain = ("MyCompanysDomainName") $pc_name = GUICtrlRead($edt_pc_name) $username = GUICtrlRead($edt_uname) $password = GUICtrlRead($edt_pw) ;edit $cmd below to make sure your command line is passed correctly. $cmd = "netdom.exe " & @ComputerName & " /userd:" & $domain & "\" & $username & " /password:" & $password GUICtrlSetState($Animate1, 1) MsgBox(32,"Info",$cmd) ;RunWait(@ComSpec & " /C " & $cmd,"",@SW_HIDE) GUICtrlSetState($Animate1, 0) Case Else ;;; EndSelect WEnd Exit Func _UpdateLabels();update labels here GUICtrlSetData($pc_name,@ComputerName) GUICtrlSetData($current_user,@UserName) GUICtrlSetData($pc_ip,@IPAddress1) GUICtrlSetData($os_build,@OSVersion) GUICtrlSetData($service_pack,@OSServicePack) EndFunc
-
Nice code - just one thing can the image be built into the exe as having to put it in the same folder is a bit messy
-
User Profile creation script, Any ideas?
experience replied to experience's topic in AutoIt General Help and Support
I cant use roaming profiles as that is looked after by the network team which we have no control over. I've created a script that does what i need - just 2 problems i cant seem to overcome. 1. I need to place shortcuts in the quicklaunch folder C:\Documents and Settings\username\Application Data\Microsoft\Internet Explorer\Quick Launch but how i can i enter the above path with the current logged on users id ? e.g. C:\Documents and Settings\JoeBloggs\Application Data\Microsoft\Internet Explorer\Quick Launch Is there a variable i can use such as $currentuser$ ?? 2. In outlook 03 i need to adjust the Navigation Pane - in the bottom corner of the navigation pane is an arrow which if you hover over it says "Configure Buttons" - i cant find a hotkey to select this so i can expand it and select show fewer buttons, which i want to use in a script - again im stumped on this