the_lord_mephy Posted December 17, 2004 Share Posted December 17, 2004 Can someone explain what $CmdLine does, like used in a script? thanks. My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
normeus Posted December 17, 2004 Share Posted December 17, 2004 if you go to dos and call your script : AutoIt3.exe myscript.au3 "THIS IS FUN" of course your script called myscript.au3 should be the following: ;myscript.au3 If $CmdLine[0] = 0 Then MsgBox(0, "Error", "Unable to find stuff on command line") Exit EndIf MsgBox(0, "from command prompt", $CmdLine[1]) ;end of myscript.au3 ; I am only taking the first parameter on this command line you probably wont use it unless you call your scripts from batch files or DOS http://www.autoitscript.com/autoit3/scite/...iTe4AutoIt3.exe Link to comment Share on other sites More sharing options...
the_lord_mephy Posted December 17, 2004 Author Share Posted December 17, 2004 Ooh Alright thanks. My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
the_lord_mephy Posted December 17, 2004 Author Share Posted December 17, 2004 Next question, I tried doing ControlGetPos and it returned a value that wasn't an array. It just returned 1. It's possible that the X coordinate was 1, but it wasn't the @error. It was the return value. My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
CyberSlug Posted December 17, 2004 Share Posted December 17, 2004 $CmdLine[1] is also useful if you drag a file on top of a compiled script (say on your desktop). Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
SlimShady Posted December 17, 2004 Share Posted December 17, 2004 (edited) Here's an example. NOTE: You need Au3check in the same folder if you want to run this script. expandcollapse popup$Times = 1 If NOT $CmdLine[0] Then $Filename = FileOpenDialog("Choose an Au3 script", @ScriptDir, "Au3 Scripts (*.au3)", 1) If @error Then Exit CheckFile() ElseIf $CmdLine[0] = 1 Then $Filename = $CmdLine[1] CheckFile() Else For $i = 1 To $CmdLine[0] $Filename = $CmdLine[$i] CheckFile() Next EndIf Func CheckFile() If StringInStr($Filename, " ") Then $Filename = '"' & $Filename & '"' RunWait(@ComSpec & ' /c ' & @ScriptDir & '\Au3Check.exe -q ' & $Filename & ' > %TEMP%\Output.tmp', @SystemDir, @SW_HIDE) If NOT FileExists(@TempDir & "\Output.bat") Then WriteBat() RunWait(@TempDir & "\Output.bat " & $Filename, @SystemDir) EndFunc Func WriteBat() Local $BatFile Local $OpenedFile $BatFile = @TempDir & "\Output.bat" $OpenedFile = FileOpen($BatFile, 2) FileWriteLine($OpenedFile, '@ECHO OFF') FileWriteLine($OpenedFile, 'TITLE Au3Check Wrapper') FileWriteLine($OpenedFile, 'FIND /C %TEMP%\Output.tmp "error" > NUL') FileWriteLine($OpenedFile, 'ECHO Filename: %1') FileWriteLine($OpenedFile, 'ECHO --------------------------') FileWriteLine($OpenedFile, 'ECHO.') FileWriteLine($OpenedFile, 'IF %ERRORLEVEL%==0 (TYPE %TEMP%\output.tmp) ELSE (ECHO No errors found!)') FileWriteLine($OpenedFile, 'PAUSE > NUL') FileWriteLine($OpenedFile, 'EXIT') FileClose($OpenedFile) EndFunc Edited December 17, 2004 by SlimShady 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