kudrow Posted October 8, 2012 Posted October 8, 2012 Is there a way to run a script but pass dynamic variables to it? Maybe with switches? I want to use php to execute a script but send variables to it from the php side. Thanks!
Moderators JLogan3o13 Posted October 8, 2012 Moderators Posted October 8, 2012 (edited) Hi, kudrow, welcome to the forum. Do a search for $CmdLine and $CmdLineRaw in the help file. It helps you pass parameters to your compiled script. Edited October 8, 2012 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
kudrow Posted October 8, 2012 Author Posted October 8, 2012 Well, I tried passing more than 1 parameter but only the first paramater is displayed. My example is run C:testtest.au3 param1 param2 The code in test.au3 is: $t1=$CmdLine[1] $t2=$CmdLine[2] MsgBox (1, "test", $t2) I am trying to get $t2 to display but no matter what I do $t1 is what is passed. Thanks.
UEZ Posted October 8, 2012 Posted October 8, 2012 (edited) How do you run: run C:testtest.au3 param1 param2?Compile your script and run it e.g. from cmd directly: test.exe param1 param2Br,UEZ Edited October 8, 2012 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
water Posted October 8, 2012 Posted October 8, 2012 TryMsgBox (1, "test", $CmdLine[0])to see how many parameters get passed. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
AdmiralAlkex Posted October 8, 2012 Posted October 8, 2012 Or run it from SciTE View > Parameters .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
guinness Posted October 8, 2012 Posted October 8, 2012 Or run it from SciTEView > ParametersI prefer that method too OR even Shift + F8 if I have my hands on the keyboard. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
kylomas Posted October 9, 2012 Posted October 9, 2012 (edited) kudrow, Another way to pass parms from a source script (executed from either scite or double clicking on the .au3 file) ; ; driving script ; shellexecute('k:autoitsourceparmtest.au3','parm1 parm2 parm3=what parm4') ; ; driven script ; #include <array.au3> _arraydisplay($cmdline,'My command line parms') edit: autoit has to be installed on the machine doing the shellexecute, otherwise go with the compiled option as suggested earlier. kylomas Edited October 9, 2012 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
kudrow Posted October 9, 2012 Author Posted October 9, 2012 How do you run: run C:testtest.au3 param1 param2? Compile your script and run it e.g. from cmd directly: test.exe param1 param2 Br, UEZ They way I was running it was (win7) start>search for run> windows run>C:testtest.au3 param1 param2. This did not work. It only returned the first parameter. This worked. I also used the suggested MsgBox (1, "test", $CmdLine[0]) to see how many parameters are being passed and it worked like a charm. Thank you for the awesome help everyone.
kudrow Posted April 9, 2013 Author Posted April 9, 2013 OK, it has been a long time since I have had a chance to play with AutoIT and I appear to be over thinking my situation. It has to be something simple. I have a text file that is holding the contents of a $CmdLineRaw result sent from a third party application. I want to resend this same results to another application. I am reading the text file and then trying to use RUN ("Direct Path To EXE" & $Textfromfile) It does not work. I am not sure how to do what I am trying to do. Any Ideas?
water Posted April 9, 2013 Posted April 9, 2013 Can you please post the complete Run statement? Maybe you are just missing a space. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
kudrow Posted April 9, 2013 Author Posted April 9, 2013 $text = FileReadLine ( $file, 1 ) MsgBox (1, "Hand Off 2 Complete", "yeah") $command = "C:\Program Files\Optos\Optomap Applications\Capture2.exe" Run ($command & $text) FileClose ($file)
water Posted April 9, 2013 Posted April 9, 2013 Try: $text = FileReadLine ( $file, 1 ) MsgBox (1, "Hand Off 2 Complete", "yeah") $command = '"C:\Program Files\Optos\Optomap Applications\Capture2.exe"' Run ($command & " " & $text) FileClose ($file) Xandy 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
kudrow Posted April 9, 2013 Author Posted April 9, 2013 Try: $text = FileReadLine ( $file, 1 ) MsgBox (1, "Hand Off 2 Complete", "yeah") $command = '"C:\Program Files\Optos\Optomap Applications\Capture2.exe"' Run ($command & " " & $text) FileClose ($file) Thats it!!!!! I knew it was something simple. THANK YOU! Xandy 1
water Posted April 9, 2013 Posted April 9, 2013 Xandy 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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