Jump to content

Search the Community

Showing results for tags 'RunWait'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 22 results

  1. Hello, I'm trying to call a Subscript using a Mainscript. This is my Mainscript: ;#pragma("AutoItExecuteAllowed", True) ConsoleWrite("Start Loop" & @CRLF) For $i = 1 To 3 ConsoleWrite("Looping..." & @CRLF) Sleep(1000) RunWait(@AutoItExe & " /AutoIt3ExecuteScript Subscript.au3") Next ConsoleWrite("Loop Finished" & @CRLF) This is my Subscript: _write15() ;ConsoleWrite("Hello" & @CRLF) MsgBox(0, "", "Hello") Func _write15() ;ConsoleWrite("15" & @CRLF) MsgBox(0, "", "15") EndFunc If I run exactly like above, it's working correctly. I can see the message boxes every time; first "Hello" and then "15". No problem at all. This is my output: +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. Start Loop Looping... Looping... Looping... +>18:07:37 AutoIt3.exe ended.rc:0 +>18:07:37 AutoIt3Wrapper Finished. BUT: If I comment MsgBox and open the ConsoleWrite in the Subscript, I cannot see "Hello" and "15" in the output window: _write15() ConsoleWrite("Hello" & @CRLF) ;MsgBox(0, "", "Hello") Func _write15() ConsoleWrite("15" & @CRLF) ;MsgBox(0, "", "15") EndFunc The output is the same as above: +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. Start Loop Looping... Looping... Looping... Loop Finished +>18:10:45 AutoIt3.exe ended.rc:0 +>18:10:45 AutoIt3Wrapper Finished. Is there a way that I can see "Hello" and "15" as ConsoleWrite in the output window? What I'm expecting is something like this: Start Loop Looping... 15 Hello Looping... 15 Hello Looping... 15 Hello Loop Finished Side note-1: I don't want to use #include <Subscript.au3> because I want to change and edit the content of Subscript any time I want. If I include Subscript.au3, even if I change the content while the Mainscript is running, I cannot see the changes until I start Mainscript again. Side note-2: I found #pragma("AutoItExecuteAllowed", True) in some other topics, but I couldn't make use of it, so I commented it.
  2. Hi Team, Greetings! One silly doubt, I need to pass one parameter using RunWait to write an output to a file using Cmd Line, but the below isn't writing to the file specified. Kindly assist. $pass = $CmdLine[1] $CMD = "C:\Progra~1\bin\Encrypt.exe" &$pass& " > C:\temp\pwd.txt" #write the parameter $pass in C:\temp\pwd.txt RunWait(@ComSpec & " /c " & $CMD,"",@SW_HIDE) Thank you!!
  3. Hi I have to run an executable with a parameter preceded by a /, like this: c:\myfolder\Tools\AutomaticRun\myexe.EXE /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml") I tried both this: $iReturn = RunWait ("c:\myfolder\Tools\AutomaticRun\myexe.EXE"," /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml") and using COMSPEC as per some posted suggestions on this forum: Run(@comspec & ' /c "c:\myfolder\Tools\AutomaticRun\myexe.EXE" /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml') They both seem to fail. Can you please tell me what I'm doing wrong? Thanks Dave
  4. I'm struggling to launch a VBS file via autoit using RunWait. Due to the nature of the deployment tool I am using for said script, I only know that the .vbs files will be in the same directory as my AutoIt-generated .exe, but not what that path will be. The path will look something like this: c:\programdata\vendor\lots\of\folders\randomnumber This is generated during deployment and I have no way of predicting the path - therefore, I am not sure how to call back to "same directory" in order to successfully launch the .vbs. This line is as close as I have gotten - this fires off the cmd window, but it closes immediately with out information, and the .vbs is not launched. RunWait (@ComSpec & " /c" & 'cscript.exe WORKPLEASE.vbs ALL /Q /NoCancel') I thought /c might be the problem, but leaving out the /c element causes me not to even see the momentary CMD window flash by. Any help will be greatly appreciated, and thanks in advance.
  5. Suddenly a RunWait command has stop working after 2 years of no errors, issues, or problems. The code uses RunWait to start Plink.exe, a command-line remote connection tool similar to UNIX ssh. I'm using it to ssh to a linux (Centos) machine, run a Perl script, and redirect the output to a file on a PC running the AutoIt script. $FilePath = "C:\AutoIT\LED" $FilePathPlus = $FilePath & "\plink.exe" $Code1 = RunWait(@ComSpec & " /c " & $FilePathPlus & " -ssh -l root -pw ?????? 10.170.4.163 /usr/local/nagios/etc/led.pl > C:\AutoIT\LED\led.txt ", @SW_SHOW) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : @ComSpec & " /c " & $FilePathPlus & " -ssh -l root -pw ????? 10.170.4.163 /usr/local/nagios/etc/led.pl > C:\AutoIT\LED\led.txt " = ' & @ComSpec & " /c " & $FilePathPlus & " -ssh -l root -pw ?????? 10.170.4.163 /usr/local/nagios/etc/led.pl > C:\AutoIT\LED\led.txt " & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console The ConsoleWrite output when cut-n-pasted into a DOS box produces the expected file so I know it works. I've also tried many variations of the function moving, adding, and changing the " and ' (quote) marks. Also tried it without the @ComSpec macro and other related functions...e.g. ShellExecuteWait , etc. The PC is a Windows 10 64bit and AutoIT is version 3.3.14.2. Searching here and Google has not yielded any clues that helped.
  6. Hope someone can help as quotes within quotes is always confusing. I am creating a silent install of printer software and want to call via runwait comspec line. The call within a cmd line is below samsung.exe /s /n"Samsung SL-M3220ND" /p"xxx" xxx will be stored as a variable $PrinterIP which would be as example 10.10.10.20 I need to use a variable as i am doign this for a business and need it to be based on the store i install at that has a specific IP range. I started with the below as 2 possibilities but no luck.. RunWait(@ComSpec & "/c " & "samsung.exe /s /n""Samsung SL-M3220ND"" /p""" & $PrinterIP ") RunWait(@ComSpec & "/c " & "samsung.exe /s /n'Samsung SL-M3220ND' /p'" & $PrinterIP '") but i cant get it to compile as i have errors on the line.. thanks in advance.
  7. Initial Problem I've written several scripts with the following sequence: Execute a program using Run w/stdout+stderr captured Typically processes all the files in one directory tree to populate a second tree Execute a second program (also with Run) to monitor the products of the first program and Display a progress bar (percentage of output files complete) Also monitor the first program's process and exit when it terminates The script then calls ProcessWaitClose (no timeout) on the first program's process and Checks the first program's results Kills the monitor program if it hasn't already exited on its own. Sometimes, ProcessWaitClose returns 1 with @error = 0 and @extended = 0xCCCCCCCC (actually, 0xFFFFFFFFCCCCCCCC), which seems ambiguous: the documentation says that @error = non-zero and @extended = 0xCC... means an invalid PID (unclear what the return value is), and 1 is returned for non-existent processes (but no mention of @extended). The 1/0/0xCC... result seems to occur when the first program exits very quickly (with or without an error). Since the exit value is not available, the script scans the program's output and tries to determine whether it ran successfully. This has gotten complicated and unreliable. Partial Fix I've now implemented a much simpler approach that works for most cases: Modify the monitor program so that it ignores the other program's process (the monitor always gets killed by the script anyway) Execute the monitor program first using Run, then execute the processing program with RunWait When RunWait returns, the child process exit value is available, so the script can ignore its output (which isn't available anyway) If the monitor program is still running, kill it. Remaining Issue However, there are still a couple of cases where it's necessary to get both the exit value from the processing program and its output. Since RunWait doesn't capture stdout and stderr for the parent script, it's looking like I'll have to call RunWait and redirect the 2 streams to a temp file and then scan it. Also, to do the redirect, I think I'll have to use @ComSpec to execute the processing program, which adds an undesired layer. Does anybody have a better (cleaner) way to handle these cases?
  8. I want to run a python script from autoit. I know we can do this with shellexecute or run , but this python script takes 3 cmd line arguments. How to pass them from autoit script? I tried many ways. Following solution also not working e.g. RunWait( 'fullpath\Python.exe Scriptpath\ReadLog.py  -f "file.log" -k "key" -e "errMsg" ') Found solution: RunWait( 'fullpath\Python.exe ReadLog.py -f "file.log" -k "key" -e "errMsg" ', 'Working_directory_path') PFB description: https://stackoverflow.com/questions/45757834/how-to-pass-command-line-arguments-to-a-python-script-anyscript-while-executin
  9. I'm attempting to code a Run or RunWait command that is a little on the long side and contains multiple sets of embedded quotes (as it would be issued from a CMD prompt), but can't for the life of me figure out the containing quotes as pertains to AutoIt. Here's the one-line command as it would be issued via a CMD prompt... "\\AppServ\G$\Connectivity\Clients\Citrix\Receiver\14.5.0.10018\CitrixReceiver.exe" ADDLOCAL="ReceiverInside,ICA_Client,WebHelper,SSON,AM,SELFSERVICE,USB,DesktopViewer,Flash,Vd3d" ALLOWADDSTORE=A ALLOWSAVEPWD=A ENABLEPRELAUNCH=Y ENABLE_SSON=Yes STORE0="AppStore;https://receiver.domain.net/Citrix/Apps/discovery;on;AppStore" /EnableCEIP=false /includeSSON /noreboot /silent I've tried so many different combinations of surrounding quotes with Run and RunWait, I just don't understand why it's this difficult to get past this. Can anyone assist with this? Thank you.
  10. I have written a script to build the Installshield project file(.ism) to setup files(.msi or .exe based on the release settings..). So when the user runs the script the process will be automatic for multiple ism files. Func Build($sOutputIsm,$ReleaseName,$sFilePath="None",$NewName="None") ;build the ism to get the msi If not FileExists($sOutputIsm) Then Logging("File Not Found: $sOutputIsm$",4) MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not find file ""$sOutputIsm$"".") Return EndIf Logging("Started Building $sOutputIsm$",4) ShowTrayTip($AppName, "Started Building $sOutputIsm$", 10, $TIP_ICONASTERISK) Dim $sBuildExe,$sBuildCommand,$Ret $sBuildExe = FindFileInPath("ISCmdBld.exe", "%ProgramFiles(x86)%\InstallShield") $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" -s" ;MsgBox(0,"",$sBuildCommand) $Ret = RunWait($sBuildCommand) If $Ret <> 0 Then ShowTrayTip($AppName,"ISM Build Failed, Please build the ISM Manually.",10, $TIP_ICONHAND) MsgBox($MB_OK + $MB_ICONERROR, "Error", "Could not build ""$sOutputIsm$"". Please build manually.") Logging("Error $Ret$ while Building $sOutputIsm$",4) Return;Exit(1) Else ShowTrayTip($AppName,"ISM Build Completed",10, $TIP_ICONASTERISK) Logging("Completed Building $sOutputIsm$",4) if not StringCompare($NewName, "None")=0 then MoveEXE($sFilePath,$NewName) EndIf EndFunc The problem is when we run the ISCmdBuild.exe the RunWait will give whether fail or success but not what are the errors we got. If we use Run, it will give that logging but we don't have the feature of getting fail/success as RunWait. If we run the above code by removing -s and using redirection operator > to a file, it is running manually but failing with autoit. Like $sBuildCommand = """$sBuildExe$"" -p ""$sOutputIsm$"" -r ""$ReleaseName$"" > c:\logs\uday.log" Any help on this?? And also, in some machines the installshield shortcut is launching fine as licensed version but with ISCmdBld.exe it is giving error as licensing info missing or not registered. Any suggestion on this too??
  11. Hello, I just wrote a script that should copy data into my cloud using xcopy (cmd), but I want the Status Bar I have in my GUI to change it's text like that: working. -> working.. -> working... -> working. ... I would also like to make a button which interrupts xcopy (simply closing it should do the trick), but I don't know how to call ProcessClose("xcopy.exe") using a button, while I'am waiting for RunWait to finish. Example: $command = 'xcopy "' & @DesktopDir & '\text.txt"' & ' "\\ADMIN-CLOUD\private\" /EECHIY' $SW_STATE = @SW_HIDE RunWait(@ComSpec & " /c " & '"' & $command & '"', @DesktopDir, $SW_State) Please tell me if you need any further information!
  12. Hi, I want to install chocolatey (https://chocolatey.org/) with AutoIt. I just need to send the following command to cmd: @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\binThis is what I tried: RunWait(@ComSpec & " /C " "@powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin", "");It didn't work propably because of the quotes. So I tried this: $code1 = "@powershell -NoProfile -ExecutionPolicy unrestricted -Command" $code2 = " (iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" $code3 = " && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" RunWait(@ComSpec & " /C " & $code1 & $code2 & $code3, "");Didn't work either. Any help? Thanks in advance =)
  13. Hello, I am ready to rip my hair out at this point I am not knew to autoit or scripting at all and that is why I am failing to understand what I am doing wrong here. When i run the command in the command prompt the command executes successfully as it should, but when i attempt to run this code in autoit nothing seems to happen. I am really failing to realize why, becuase I use Runwait to run command line parameters all the time. Can some one please help me out here and show me why this will not work for me. The script is uninstalling java and obviously i need to have this for many different versions of java, but lets just get this one working first. Any ideas? thanks. #RequireAdmin $WinDir = "C:\Windows\System32" RunWait($WinDir & "\taskkill /f /im java.exe /T") RunWait($WinDir & "\taskkill /f /im javaw.exe /T") RunWait($WinDir & "\taskkill /f /im javaws.exe /T") RunWait($WinDir & "\taskkill /f /im jqs.exe /T") RunWait($WinDir & "\taskkill /f /im jusched.exe /T") RunWait($WinDir & "\taskkill /f /im iexplore.exe /T") RunWait($WinDir & "\taskkill /f /im firefox.exe /T") ;REM Uninstall v1.4.2_19 RunWait($WinDir & "\MsiExec.exe /x {7148F0A8-6813-11D6-A77B-00B0D0142190} /qb /norestart")
  14. Good Morning Everyone, I want to say thank you to everyone here - you guys are fantastic at what you do and we all appreciate your help and hard work. All of IT has benefited from your hard work and knowledge. So thank you. Edited...
  15. I have spent the past couple of hours trying to find a solution to this. Is there a way to output the data from a RunWait to a text file? I need to use the RunWait as I need each command to complete before the next one starts. Any help would be greatly appreciated. I have tried RunWait(@ComSpec & " /c " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&TAKEOWN /f " & GUICtrlRead($hFolder) & " /r /d y" > "C:\log.txt", "", @SW_HIDE) But that does not work either. Here is my code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <MsgBoxConstants.au3> ;=============Main=GUI================= $hGUI = GUICreate("", 250, 500) ;====================================== ;=================Inputs=============== $hOld = GUICtrlCreateInput("", 95, 25, 130) $hNew = GUICtrlCreateInput("", 95, 50, 130) $hOldSvr1 = GUICtrlCreateInput("", 95, 75, 25) GUICtrlSetLimit(-1, 3) $hOldSvr2 = GUICtrlCreateInput("", 130, 75, 25) GUICtrlSetLimit(-1, 3) $hOldSvr3 = GUICtrlCreateInput("", 165, 75, 25) GUICtrlSetLimit(-1, 3) $hOldSvr4 = GUICtrlCreateInput("", 200, 75, 25) GUICtrlSetLimit(-1, 3) $hNewSvr1 = GUICtrlCreateInput("", 95, 100, 25) GUICtrlSetLimit(-1, 3) $hNewSvr2 = GUICtrlCreateInput("", 130, 100, 25) GUICtrlSetLimit(-1, 3) $hNewSvr3 = GUICtrlCreateInput("", 165, 100, 25) GUICtrlSetLimit(-1, 3) $hNewSvr4 = GUICtrlCreateInput("", 200, 100, 25) GUICtrlSetLimit(-1, 3) $hLetter = GUICtrlCreateInput("", 95, 125, 130) $hPath = GUICtrlCreateInput("", 95, 150, 130) $hFolder = GUICtrlCreateInput("", 95, 175, 130) $hUID = GUICtrlCreateInput("", 95, 200, 130) $hExclude = GUICtrlCreateInput("", 95, 225, 130) ;====================================== ;=================Buttons============== $hButton1 = GUICtrlCreateButton("Test", 50, 260, 50) ;====================================== ;=================Labels=============== $hLabel1 = GUICtrlCreateLabel("Old Domain", 10, 28) $hLabel2 = GUICtrlCreateLabel("New Domain", 10, 53) $hLabel3 = GUICtrlCreateLabel("Old Server (IP)", 10, 78) $hLabel4 = GUICtrlCreateLabel("New Server (IP)", 10, 103) $hLabel5 = GUICtrlCreateLabel("Drive Letter", 10, 128) $hLabel5 = GUICtrlCreateLabel("Folder Path", 10, 153) $hLabel6 = GUICtrlCreateLabel("Folder Name", 10, 178) $hLabel7 = GUICtrlCreateLabel("User Name", 10, 203) $hLabel8 = GUICtrlCreateLabel("Exclusions", 10, 228) ;====================================== GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMSG() Case $GUI_EVENT_CLOSE ExitLoop Case $hButton1 _TestOnly() EndSwitch WEnd Func _TestOnly() RunWait(@ComSpec & " /k " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&TAKEOWN /f " & GUICtrlRead($hFolder) & " /r /d y") RunWait(@ComSpec & " /k " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&icacls " & GUICtrlRead($hFolder) & " /reset /T") RunWait(@ComSpec & " /k " & GUICtrlRead($hLetter) & ":&&cd\" & GUICtrlRead($hPath) & "&&icacls " & GUICtrlRead($hFolder) & "\*.* /inheritance:d /c /t") EndFunc
  16. Func Button2Click() ;==> SonoLvl2 ******************************************************* SoundPlay(@ScriptDir & "\schoolbell.wav", 1) Local $Test2 = IniRead(@ScriptDir & "\runer.ini", "Levels", "LComplete1", "Default Value") If $Test2 = 1 Then ; $updatepid = RunWait(@ScriptDir & "\SonoLvl2\SonoLvl2_.exe", "", @SW_SHOWDEFAULT) Else MsgBox(4096, "", "You did not complete Lesson1") EndIf ;MsgBox($MB_SYSTEMMODAL, "Bug Report Environment", _DebugBugReportEnv()) IniWrite(@ScriptDir & "\runer.ini", "Levels", "LComplete2", "2") EndFunc ;==>Button2Click I have tried PID checks and updatepid per the help file and they just didn't work out. and usually caused errors. Then (not included I tried making a separate function to write to a INI file. that was a lesson in frustration and defeat. It worked.. just the same as the code in the function now. as soon as you click the button and the runwait line starts the ini gets updated. The file can only be written to after runwait is running is closed. Also tried the ProcessWait, ProcessWaitClose, ShellExecute, ShellExecuteWait Then in desperation I tried a Debug i read about Func Button2Click() ;==> SonoLvl2 ******************************************************* $__iLineNumber=162 & ' - SoundPlay(@ScriptDir & "\schoolbell.wav", 1)•' SoundPlay(@ScriptDir & "\schoolbell.wav", 1) $__iLineNumber=163 & ' - Local $Test2 = IniRead(@ScriptDir & "\runer.ini", "Levels", ...•' Local $Test2 = IniRead(@ScriptDir & "\runer.ini", "Levels", "LComplete1", "Default Value") $__iLineNumber=164 & ' - If $Test2 = 1 Then•' If $Test2 = 1 Then $__iLineNumber=165 & ' - $updatepid = RunWait(@ScriptDir & "\SonoLvl2\SonoLvl2_.exe", ...•' $updatepid = RunWait(@ScriptDir & "\SonoLvl2\SonoLvl2_.exe", "", @SW_SHOWDEFAULT) Else $__iLineNumber=167 & ' - MsgBox(4096, "", "You did not complete Lesson1")•' MsgBox(4096, "", "You did not complete Lesson1") EndIf ;MsgBox($MB_SYSTEMMODAL, "Bug Report Environment", _DebugBugReportEnv()) $__iLineNumber=173 & ' - IniWrite(@ScriptDir & "\runer.ini", "Levels", "LComplete2", ...•' IniWrite(@ScriptDir & "\runer.ini", "Levels", "LComplete2", "2") EndFunc ;==>Button2Click unfortunately I was not smart enough to get it to work for me. What I wanted was a Debugger that explains what each line does and why. Then I figured out that isn't happening.
  17. Hi guys, I've been trying to create a registry key export for a while, but i'm hitting my head against a wall here. I've tried a huge amount of combinations for both: ShellExecuteWait & RunWait commands, but they never complete the task. ;This is the reg key Global $targetHistory = "HKEY_CURRENT_USER\Software\Hewlett-Packard\HP Print Settings\Ubicación predeterminada\Target History" RegeditTH($logHandler, $regBackup, $targetHistory) Func RegeditTH($logHandler, $regBackup, $targetHistory) Local $THRegBkup = $regBackup & "ExportTH.bat" Local $THRegHandler Local $removeFile _FileWriteLog($logHandler, "INFORMATION: ExportTH.bat storage directory = " & $regBackup & "." & @CRLF) ; Create a file to write registry keys to. If Not _FileCreate($THRegBkup) Then ; Error flags: ; 1 - Error opening specified file ; 2 - File could not be written to ; [OPTIONAL] Display a pop-up message for notification, error creating the file ;MsgBox($MB_SYSTEMMODAL, "Error", " Error reating reg file. Error Code:" & @error & ".") _FileWriteLog($logHandler, "WARNING: Registry export file not created." & @CRLF) Else $THRegHandler = FileOpen ($THRegBkup ,$FO_APPEND) If $THRegHandler <> -1 Then _FileWriteLog($logHandler, "INFORMATION: Performing registry backup for Target History keys." & @CRLF) FileWrite($THRegHandler, "@echo off" & @CRLF) ;FileWrite($THRegHandler, "regedit.exe /e " & $regBackup & "TargetHistory.reg " & '"HKEY_CURRENT_USER\Software\Hewlett-Packard\HP Print Settings\Ubicación predeterminada\Target History"' & @CRLF) FileWrite($THRegHandler, "Reg export " & '"HKEY_CURRENT_USER\Software\Hewlett-Packard\HP Print Settings\Ubicación predeterminada\Target History" ' & $regBackup & "TargetHistory.reg " & "/y" & @CRLF) FileWrite($THRegHandler, "dir " & $regBackup & @CRLF) FileWrite($THRegHandler, "dir " & $regBackup & " >> " & $regBackup & "dir.txt" & @CRLF) FileWrite($THRegHandler, "pause" & @CRLF) FileWrite($THRegHandler, "exit /B" & @CRLF) FileWrite($THRegHandler, "exit" & @CRLF) FileClose($THRegHandler) ;RunWait(@ComSpec & " /k " & "regedit.exe /e " & $regBackup & "TargetHistory2.reg " & $targetHistory) ;ShellExecuteWait(@ComSpec , "/k regedit.exe /e " & $regBackup & "TargetHistory.reg " & $targetHistory) ;ShellExecuteWait(@ComSpec & " /c " & $THRegBkup, @SW_HIDE) RunWait(@ComSpec & " /c " & $THRegBkup) ; Error Flag is set to non-zero in case of failure If @error <> 0 Then _FileWriteLog($logHandler, "ERROR: Registry export failed." & @CRLF) Else _FileWriteLog($logHandler, "WARNING: ExportTH.bat file could not be opened." & @CRLF) EndIf $removeFile = FileDelete($THRegBkup) If $removeFile Then _FileWriteLog($logHandler, "INFORMATION: File " & $THRegBkup & " deleted." Else _FileWriteLog($logHandler, "WARNING: File " & $THRegBkup & " not deleted or it does not exist." EndIf EndIf ; Close the handle returned by FileOpen. FileClose($THRegHandler) EndFunc This is the function i'm using for the call. Since i was not going anywhere with the AutoIt direct executions, i even tried creating a bat/cmd file with the command for a reg export to create the reg file i needed. However, even running the bat file is not working for me. I mean, the bat is executed, as you can see i created a couple of "dir" commands to be prompted and sent to a file. And they are showing up, but the registry export is never being executed. The best i could get was a message saying it was impossible to locate the key, but i know with 100% certainty the key exists in that path (because i'm creating and deleting it all the time). Can anyone point out any possible mistakes? Here you can see the error message in the CMD prompt: Thanks!
  18. Hello, For quite a long time i have been wondering something: I quite frequently use the command RunWait(@ComSpec & " /c " & "commandName") Now i'm wondering: what does the /c flag do? i apologize if the /c flag is not related to runwait as i put it like that in the title. Edit: Is it even a flag? thanks, dh Edit2: Never mind, I've found the answer: /C Carries out the command specified by the string and then terminates You can get all the cmd command line switches by typing cmd /? source: http://stackoverflow.com/questions/515309/what-does-cmd-c-mean I thought it was a flag from AutoIT but apparently it was a CMD thingy.
  19. HI, I trying to copy a file from Host operating system to Guest operating system via VMWare-Workstation. The command prompt appears but disappears in a split of a second. Not sure where am going wrong. Can someone help please? Here is the script that I have written... $VWRunEXEPath = "C:Program Files (x86)VMwareVMware Workstation>vmrun.exe" $GuestUserName = "agovada" $GuestPwd = "Welcome2world" $VMXPathOfTheOS = """C:VMImagesVista-64Vista x64.vmx""" $SourcePathOfVSE = """C:dataVSE RP4 RTW.zip""" $TargetPathOfVSE = """C:buildsrp4.zip""" RunWait(@ComSpec & " /c " & "'" & $VWRunEXEPath & " -T ws -gu " & $GuestUserName & " -gp " & $GuestPwd & " copyFileFromHostToGuest " & $VMXPathOfTheOS & " " & $SourcePathOfVSE & " " & $TargetPathOfVSE &"'") NOTE : If I execute the command on cmd prompt then it works fine. Here's the actual command : "C:Program Files (x86)VMwareVMware Workstation>vmrun.exe" -T ws -gu agovada -gp Welcome2mcafee copyFileFromHostToGuest "C:VMImagesVista-64Vista x64.vmx" "C:dataVSE RP4 RTW.zip" "C:test1rp4.zip" Thanks in advance.
  20. Hi, I have a problem in that one script runs successfully and gets to this line MsgBox(0x40,$UpdateID,"Successfully installed update " & $UpdateID) Exit(1) This script was started by another at this point: $InstallationResult = RunWait($ExeFileFullPath & " " & $InstallerParameters) ProcessWaitClose(StringReplace($FileName,"mmupdate","exe")) SplashOff() If $InstallationResult = $DesiredResult Then FileMove($ExeFileFullPath, $FileFullPath & ".done") LogWrite("Update succeeded") Else ; the update failed... oh dear what shall we do? If 1 = MsgBox(0x21,$PrettyScriptName,"The update failed to install - try again another time?") Then FileMove($ExeFileFullPath, $FileFullPath) LogWrite("Update failed - will be retried on next launch") Else FileDelete($ExeFileFullPath) LogWrite("Update failed - deleted by user request") EndIf EndIf I had two problems - first I had to put the processwaitclose in because otherwise the program would go onto the "update failed" msgbox before getting to the "update was successful" msgbox! second even with the processwaitclose it gives the $installationResult as 0 not 1 even though when it finally finished the first script the exit code must have been 1 as that follows after msgbox which shows? Any ideas? Is it possible that 2 exit codes are produced??? Is it possible for $installationResult to be set before the program finishes? Blessings Graeme
  21. I have installed the amazon command-line interface (http://aws.amazon.com/cli/) and have it working in my cmd prompt dos window. For example, If I set the working directory to C:UsersAdministrator and run the command below to upload a file to the S3 service: aws s3 cp C:UsersAdministratorDesktopvpntimeout_text.txt s3:/clustertesting/vpntimeout_text.txt I get the response: upload: myfolder/file1.txt to s3:/mybucket/myfolder/file1.txt However, trying to replicate the same command in Autoit with : --------------------------------------------------------------------------- #include <Constants.au3> ;$ami_ID = "ami-1a0d912a" ;$n=1 ; Command: ;$DOS = Run(@ComSpec & ' /k' & "aws ec2 run-instances " & $ami_ID & " -n " & $n & " -k windows --instance-type t1.micro -g quicklaunch-1", "", "", $STDERR_CHILD + $STDOUT_CHILD) $workingdir = "C:UsersAdministrator" ConsoleWrite($DOS & @CRLF) Local $output While 1 $line = StdoutRead($DOS) If @error Then ExitLoop ConsoleWrite($line) Wend ConsoleWrite($line & @CRLF) ConsoleWrite("error = " & @error & @CRLF) --------------------------------------------------------------------------- The dos window flashes up and a PID is returned in $DOS, and the error value is zero. However, unlike my command performed in the command prompt, the autoit version does not upload my file to S3 and does not print a response. Does anyone see what I've done wrong in Autoit? From what I can tell me code should be performing the same command sorry I haven't used the code editor for this post- it failed to work in two browsers o I ended up just pasting the raw text
  22. I was wondering if there are any developers out there who are having issues running AutoIT code on the latest revision of Win8? I recently (about 4 months ago) wrote an auto-installer that pulled tools from a server and ran an auto install of each tool on systems. This worked fine for revisions 8250, 8375 and 8400. However, when Win8 revision 8441 came around, I noticed some issues running some installers. Now with the newest revision, 8520, it seems that FileCopy, DirCopy, ShellExecute, ShellExecuteWait, Run, and RunWait are all either locking up, or just failing to run. The steps I take are: Read from a cfg file the path of the installer, and any installer arguments download installer from path use ShellExecuteWait on installer with arguments In the past, I've had no problems with this same exact code. UAC is off, #RequireAdmin is set, application is run as administrator, and even powershell is set to "Set-ExecutionPolicy UnRestricted" Has anybody else had this problem? Anybody have workarounds?
×
×
  • Create New...