KwanKwan 0 Posted May 24, 2010 I am trying to launch a program by using AutoIt. Here is the code from the batch file "C:\Program Files\Autodesk\ACADM 2008\acad.exe" /p "C:\ACAD Configuration\CKProfile.arg" %1 %2 %3 %4 Anyone knows how to make it work with AutoIt? Share this post Link to post Share on other sites
taietel 34 Posted May 24, 2010 (edited) Try this: ShellExecuteWait("C:\Program Files\Autodesk\ACADM 2008\acad.exe", '/p "C:\ACAD Configuration\CKProfile.arg" %1 %2 %3 %4') Edited May 24, 2010 by taietel Things you should know first...In the beginning there was only ONE! And zero...Progs:Create PDF(TXT2PDF,IMG2PDF) 3D Bar Graph DeskGadget Menu INI Photo Mosaic 3D Text Share this post Link to post Share on other sites
KwanKwan 0 Posted May 24, 2010 Thanks! The Message I have from the program (AutoCAD) is: Cannot find the spefified drawing file. Please verify that the file exists. Share this post Link to post Share on other sites
Richard Robertson 187 Posted May 24, 2010 You don't want the %1 %2 %3 %4 in there. Those are command line arguments sent to the batch file and don't have any effect in your script. Just remove them from the end. Share this post Link to post Share on other sites
KwanKwan 0 Posted May 24, 2010 Thanks. The arguments %1 %2 %3 %4 is something needed by the Data Management software here. When I use the batch file to launch AutoCAD, it works fine. But ... Just cannot figure out how I can make it work with AutoIt. Is there anyway I can send/receive the arguement? Share this post Link to post Share on other sites
Richard Robertson 187 Posted May 24, 2010 Are these arguments being sent to the AutoIt script then? If they are, you can use the $CmdLine variable. $args = '/p "C:\ACAD Configuration\CKProfile.arg"' For $i = 1 To $CmdLine[0] $args &= ' "' & $CmdLine[1] & '"' Next ShellExecuteWait("C:\Program Files\Autodesk\ACADM 2008\acad.exe", $args) Something like this should work. Share this post Link to post Share on other sites
PsaltyDS 39 Posted May 24, 2010 (edited) You would, of course, replace "%1 %2 %3 %4" with actual parameters: $sExtCmd = 'C:\Program Files\Autodesk\ACADM 2008\acad.exe' $sParam1 = '"My New Drawing Name"' $sParam2 = '/p "C:\MyDrawings\ACADProfile.arg"' $sParam3 = '/s "C:\Lisp;C:\VBA"' $sParam4 = '/t "C:\MyDrawings\MyTemplate.dwt"' $sParam5 = '/nologo' $sAllParams = $sParam1 & ' ' & $sParam2 & ' ' & $sParam3 & ' ' & $sParam4 & ' ' & $sParam5 ShellExecuteWait($sExtCmd, $sAllParams) Edit: Way too slow today! Edited May 24, 2010 by PsaltyDS 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 Share this post Link to post Share on other sites