norjms Posted November 25, 2009 Share Posted November 25, 2009 Hello I'm having problems getting RunWait to pass variable from an ini file. Anyone know what I doing wrong? The command that needs passed is: AnyTool2.exe ripraw G: E:\Store This command is changable by the user to set it to their paths. AutoIt File ;Define the DVD drive letter GLOBAL $INPUT = IniRead("configure.ini", "section1", "key", "NotFound") ;Define the path to store the files GLOBAL $OUTPUT = IniRead("configure.ini", "section2", "key", "NotFound") ;Wait until drive is ready While DriveStatus( $INPUT ) = "NOTREADY" WEnd While DriveStatus( $INPUT ) = "UNKNOWN" WEnd ;Once drive is ready If DriveStatus( $INPUT ) = "READY" Then RunWait("AnyTool2.exe ripraw " $INPUT $OUTPUT ) ;Done The ini file [section1] Key=G: [section2] Key=E:\Store Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted November 25, 2009 Share Posted November 25, 2009 You concatenate strings by an ampersand "&" (see "Operators" in helpfile) ("AnyTool2.exe ripraw " & $INPUT & $OUTPUT) Don't forget to a a space to between input and output, or was that an error in the example? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
norjms Posted November 25, 2009 Author Share Posted November 25, 2009 You concatenate strings by an ampersand "&" (see "Operators" in helpfile) ("AnyTool2.exe ripraw " & $INPUT & $OUTPUT) Don't forget to a a space to between input and output, or was that an error in the example? Thanks for the reply, but it doesn't seem to work. The command windows just opens and closes way too fast to read. Anyother ideas? I mean did I declare the variables properly? Is there a way to hold the command windows open so I can see what command it is passing to debug? Here is the changed code like you suggested ;Define the DVD drive letter GLOBAL $INPUT = IniRead("configure.ini", "section1", "key", "NotFound") ;Define the path to store the DVD files GLOBAL $OUTPUT = IniRead("configure.ini", "section2", "key", "NotFound") ;Wait until drive is ready While DriveStatus( $INPUT ) = "NOTREADY" WEnd While DriveStatus( $INPUT ) = "UNKNOWN" WEnd ;Once drive is ready If DriveStatus( $INPUT ) = "READY" Then RunWait("AnyTool2.exe ripraw " & $INPUT & $OUTPUT) ;When done ;CDTray("G:", "open") Link to comment Share on other sites More sharing options...
norjms Posted November 25, 2009 Author Share Posted November 25, 2009 I made sure my variable was correct by running this script. ;Define the DVD drive letter GLOBAL $INPUT = IniRead("configure.ini", "section1", "key", "NotFound") ;Define the path to store the DVD files GLOBAL $OUTPUT = IniRead("configure.ini", "section2", "key", "NotFound") ;Wait until drive is ready While DriveStatus( $INPUT ) = "NOTREADY" WEnd While DriveStatus( $INPUT ) = "UNKNOWN" WEnd ;Once drive is ready If DriveStatus( $INPUT ) = "READY" Then RunWait("AnyTool2.exe ripraw G: E:\DVDRip") ;When done ;CDTray("G:", "open") The script breaks if I try it like this If DriveStatus( $INPUT ) = "READY" Then RunWait("AnyTool2.exe ripraw" & $INPUT & $OUTPUT) Any solutions? Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 25, 2009 Share Posted November 25, 2009 Thanks for the reply, but it doesn't seem to work. The command windows just opens and closes way too fast to read. Anyother ideas? I mean did I declare the variables properly? Is there a way to hold the command windows open so I can see what command it is passing to debug?You can start a new CMD.exe instance and use /k vice /c when passing the command line to have the console stay open after execution: RunWait(@ComSpec & " /k AnyTool2.exe ripraw ...etc.") I have MANY scripts that pass command lines, and as a general rule they are assembled in a single string variable before execution. This makes troubleshooting and especially verbose logging easier. Try something like this: $sMyCommand = "AnyTool2.exe ripraw " & $INPUT & " " & $OUTPUT MsgBox(64, "Debug", "$sMyCommand = " & $sMyCommand) RunWait($sMyCommand) Note that includes the space between parameters that AdmiralAlkex suggested. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
norjms Posted November 25, 2009 Author Share Posted November 25, 2009 You can start a new CMD.exe instance and use /k vice /c when passing the command line to have the console stay open after execution: RunWait(@ComSpec & " /k AnyTool2.exe ripraw ...etc.") I have MANY scripts that pass command lines, and as a general rule they are assembled in a single string variable before execution. This makes troubleshooting and especially verbose logging easier. Try something like this: $sMyCommand = "AnyTool2.exe ripraw " & $INPUT & " " & $OUTPUT MsgBox(64, "Debug", "$sMyCommand = " & $sMyCommand) RunWait($sMyCommand) Note that includes the space between parameters that AdmiralAlkex suggested. You are my Hero! Thanks that worked like a charm. Link to comment Share on other sites More sharing options...
whim Posted November 25, 2009 Share Posted November 25, 2009 (edited) maybe RunWait("AnyTool2.exe ripraw " & $INPUT & " " & $OUTPUT) still no joy ? then maybe your exe needs NTVDM: RunWait(@ComSpec & " /c AnyTool2.exe ripraw " & $INPUT & " " & $OUTPUT) hth, whim edit: sorry, slow typing here ... Edited November 25, 2009 by whim 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