flaxcrack Posted February 9, 2006 Posted February 9, 2006 Is it possible to give your script command line arguments? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
Developers Jos Posted February 9, 2006 Developers Posted February 9, 2006 Is it possible to give your script command line arguments? as in $cmdline[] ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
flaxcrack Posted February 9, 2006 Author Posted February 9, 2006 as in $cmdline[] ?Let me research that. I saw it in the If...Then portion. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
Xenobiologist Posted February 9, 2006 Posted February 9, 2006 Is it possible to give your script command line arguments? Hi, surely it is. $cmdLine[0] Look at the helpfile. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
flaxcrack Posted February 9, 2006 Author Posted February 9, 2006 as in $cmdline[] ? Yep that looks like it. It is under the Running Scripts documentation. I think you guys may wana move that into some other category and it should at least be in the index IMO. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
flaxcrack Posted February 9, 2006 Author Posted February 9, 2006 as in $cmdline[] ? Humm. Can you explain the syntax of $CmdLine[]? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
Valuater Posted February 9, 2006 Posted February 9, 2006 you have the help file...and, there is an example in this posthttp://www.autoitscript.com/forum/index.ph...pic=19370&st=0#8)
Developers Jos Posted February 9, 2006 Developers Posted February 9, 2006 (edited) Yep that looks like it. It is under the Running Scripts documentation. I think you guys may wana move that into some other category and it should at least be in the index IMO. Relax ..... it is already !Look in the index for Command line Parameters Look in the TOC for Command line Parameters Edited February 9, 2006 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
flaxcrack Posted February 10, 2006 Author Posted February 10, 2006 Relax ..... it is already !Look in the index for Command line Parameters Look in the TOC for Command line Parameters When I try to load the help section of Command line Parameters I get a page can not be displayed. I get that in both the TOC and index. I tried this in both of the help files for the beta and stable release. [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
Developers Jos Posted February 10, 2006 Developers Posted February 10, 2006 When I try to load the help section of Command line Parameters I get a page can not be displayed. I get that in both the TOC and index. I tried this in both of the help files for the beta and stable release.Both work fine for me.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ShelbySue Posted February 10, 2006 Posted February 10, 2006 When I try to load the help section of Command line Parameters I get a page can not be displayed. I get that in both the TOC and index. I tried this in both of the help files for the beta and stable release.I also have a problem with the help file. It has something to do with the way you installed it. I had to download the BETA help file and just load it directly outside of scite
flaxcrack Posted February 10, 2006 Author Posted February 10, 2006 I also have a problem with the help file. It has something to do with the way you installed it. I had to download the BETA help file and just load it directly outside of sciteThanks for the tip [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
flaxcrack Posted February 10, 2006 Author Posted February 10, 2006 I also have a problem with the help file. It has something to do with the way you installed it. I had to download the BETA help file and just load it directly outside of sciteI gave that a whirl and it didn't work. No worries, but could you please copy and past it in to this topic? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
ShelbySue Posted February 10, 2006 Posted February 10, 2006 I searched on Command Line Parameters and clicked on "Running Scripts" Command Line Parameters The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script. Note the scriptname is not classed as a parameter; get this information with @ScriptName instead. A parameter that contains spaces must be surrounded by "double quotes". Compiled scripts accept command line parameters in the same way. $CmdLine[0] is number of parameters $CmdLine[1] is param 1 (after the script name) $CmdLine[2] is param 2 etc ... $CmdLine[$CmdLine[0]] is one way to get the last parameter... So if your script is run like this: AutoIt3.exe myscript.au3 param1 "this is another param" $CmdLine[0] equals... 2 $CmdLine[1] equals... param1 $CmdLine[2] equals... this is another param @ScriptName equals... myscript.au3 In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example: $CmdLineRaw equals... myscript.au3 param1 "this is another param"
Micha1405 Posted February 10, 2006 Posted February 10, 2006 (edited) Hello everybody, i wrote this script which use commandline parameters or gui. mybe it help to understand $cmdlines. This Script copied files from a txt file to a select destiantion (I didn't find anything like this for cmd ) for using Commandline parameter you must compile it to exe an start it @ cmd prompt here is the script: ; ---------------------------------------------------------------------------- ; AutoIt Version: 3.1.103 Beta ; Author: Micha ; Date 29.01.2006 ; Script Function: ; Copy Files (reading from TextFile) copy to Destination ; Command FileCopyList Filelist Destinationfolder ; Command FileCopyList -? ==> HelpMessage ; Command FileCopyList /? ==> HelpMessage ; Filelist Sample Use ; CMD Dir c:\*.txt /s /b >c:\backup.txt ; dir /s/b /O:G d:\Scripting\*.* >c:\temp\list.txt ; ---------------------------------------------------------------------------- #include <constants.au3> #include <file.au3> #include <string.au3> #include <Process.au3> #include <Array.au3> OpT("TrayIconHide",1) Dim $app="FileCopyList" DIM $BackupFile,$Destination Dim $HelpMSG="Use: filecopylist filelist destinationfolder"&CHr(10) &"sample:"&Chr(10)&"filecopylist c:\backup.txt drive:\backupdir"&chr(10)&chr(10)&"without parameter force gui" if $cmdline[0]="" Then ;work with gui dialog $BackupFile=FileOpenDialog("Select filelist","c:\","FileList (*.txt;*.lst;*.*)","Select Filelist") if @error then exit $Destination=FileSelectFolder("Select destination folder","Select Destination Folder") if @error then exit Else if $cmdLine[1]="-?"or $cmdLine[1]="/?" then HelpMe() EndIf if $cmdline[0]=2 Then $BackupFile=$cmdLine[1] $Destination=$cmdLine[2] if StringRight($CMDLine[2],1)="\" then;remove \ $cmdline[2]=stringleft($cmdline[2],StringLen($cmdline[2]-1)) EndIf EndIf if not FileExists($BackupFile) Then MsgBox(0,$app,"CopyList not found",5) exit EndIf If Not FileExists($Destination) Then msgbox(0,$app,"Destionation Folder not found") Exit EndIf $Count=_FileCountLines($BackupFile) $file=FileOpen($BackupFile,0) ProgressOn("Files copied from list "&$BackupFile,"","",-1,-1,16) $p=1 For $i=1 to $Count $cFile=FileReadLine($BackupFile,$i) if StringLeft($cFile,1)='"' Then ;Change Nothing Else $cFile='"'&$cFile&'"' EndIf $DestPath=StringSplit($cFile,"\",0) $l=$DestPath[0] $FileLenght=StringLen($DestPath[$l]) $Dpath=StringTrimRight($cFile,$FileLenght) $destFile=$Destination &StringTrimLeft($Dpath,3) $cFile=StringTrimLeft($cFile,1) $cFile=StringTrimRight($cFile,1) ProgressSet((round($i*100)/$count),$cFile,"Remaining Files:"&$count -$i) if StringInStr($cFile,".") Then; only entry is a file, not a directory FileCopy($cFile,$destFile,9) EndIf Next FileClose($file) ProgressOff() MsgBox(0,$app,$count&" Entries from "&$BackupFile&" copied to "&$Destination,3) Exit Func HelpMe() msgbox(0,"FileCopyList",$HelpMSG,10) exit EndFunc Edited February 10, 2006 by Micha1405 My TrayToolBar
flaxcrack Posted February 10, 2006 Author Posted February 10, 2006 Okay, so help me understand. I have this script If $CMDLine[0] > 0 Then If $cmdline[1] = "/msg1" then MsgBox(0, "Test", "test1") If $cmdline[2] = "/msg2" then MsgBox(0, "Test", "test2") EndIf And that script is compiled as that. But if I wanted to do: cmda /msg 2 (notice the space) and have cmda get the value how would I do that? [quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()
Micha1405 Posted February 10, 2006 Posted February 10, 2006 i think you mean this or i don't understand you If $CMDLine[0] > 0 Then If $cmdline[1] = "/msg1" then MsgBox(0, "Test", "test1") ElseIf $cmdline[1] = "/msg2" then MsgBox(0, "Test", "test2") EndIf EndIf My TrayToolBar
Geert Posted February 10, 2006 Posted February 10, 2006 But if I wanted to do: cmda /msg 2 (notice the space) and have cmda get the value how would I do that?If $CMDLine[0] > 1 Then If $CMDLine[1] = "/msg" Then MsgBox(0, "Test", $CMDLine[2]) EndIf EndIf
Valuater Posted February 10, 2006 Posted February 10, 2006 example for Autoit Method 3 - The Command Line The Aut2Exe.exe program can be run from the command line as follows: Aut2exe.exe /in <infile.au3> [/out <outfile.exe>][/icon <iconfile.ico>] [/nodecompile] [/comp 0-4] [/pass <passphrase>] Long filenames should be enclosed in double-quotes like "C:\Program Files\Test\test.au3". If no "out" file is given the input filename is used with a .exe extension. so.... if cmda.exe is your compiled script then cmda.exe /nada /msg 2 endif 8)
Valuater Posted February 10, 2006 Posted February 10, 2006 i think you mean this or i don't understand you If $CMDLine[0] > 0 Then If $cmdline[1] = "/msg1" then MsgBox(0, "Test", "test1") ElseIf $cmdline[1] = "/msg2" then MsgBox(0, "Test", "test2") EndIf EndIf that will work also 8)
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