KwanKwan Posted May 24, 2010 Share 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? Link to comment Share on other sites More sharing options...
taietel Posted May 24, 2010 Share 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 Link to comment Share on other sites More sharing options...
KwanKwan Posted May 24, 2010 Author Share 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. Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 24, 2010 Share 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. Link to comment Share on other sites More sharing options...
KwanKwan Posted May 24, 2010 Author Share 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? Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 24, 2010 Share 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. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 24, 2010 Share 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 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