Nomis Posted July 14, 2010 Share Posted July 14, 2010 Afternoon all, I'm relatively new to this and I have created a simple script that will create a new folder with the current time/date, this works well but I what to use it in a batch file, I'll try to explain but sorry if I don't get it right first time.So I want to have the exit code as the option selectd in the command line,EX.if I added DMY at the command line then the exit code would be the current Day/Month/Year. (14072010)Is this possible ??Thanks Simon If $CmdLine[0] < 1 Then MsgBox(4096, "Error", "No Command Line Options Detected") EndIf$HM = @HOUR & @MIN$Div = "-" $DMY = @MDAY & @MON & @YEARIf $CmdLine[1] = "HM" Then DirCreate(@WorkingDir & "\" & $HM)EndIfIf $CmdLine[1] = "DMY" Then DirCreate(@WorkingDir & "\" & $DMY)EndIfIf $CmdLine[1] = "ALL" Then DirCreate(@WorkingDir & "\" & $HM & $Div & $DMY)EndIfExit Link to comment Share on other sites More sharing options...
JohnOne Posted July 14, 2010 Share Posted July 14, 2010 expandcollapse popupGlobal $exitcode = 0 If $CmdLine[0] < 1 Then MsgBox(4096, "Error", "No Command Line Options Detected") EndIf $HM = @HOUR & @MIN $Div = "-" $DMY = @MDAY & @MON & @YEAR If $CmdLine[1] = "HM" Then DirCreate(@WorkingDir & "\" & $HM) $exitcode = $HM EndIf If $CmdLine[1] = "DMY" Then DirCreate(@WorkingDir & "\" & $DMY) $exitcode = $DMY EndIf If $CmdLine[1] = "ALL" Then DirCreate(@WorkingDir & "\" & $HM & $Div & $DMY) EndIf Exit $exitcode AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Nomis Posted July 14, 2010 Author Share Posted July 14, 2010 Hi John, thanks for that but now for the dumb question, I have been using %ERRORLEVEL% to show the exit level from the application but I'm only getting 9009 regardless the command line option I'm using. Should I be using a different variable, I have added a MSGBOX at the end to confirm the exitcode string and that is working within the application but does not seem to exit with the correct data? Simon Global $exitcode = 0 If $CmdLine[0] < 1 Then MsgBox(4096, "Error", "No Command Line Options Detected") EndIf $HM = @HOUR & @MIN $Div = "-" $DMY = @MDAY & @MON & @YEAR If $CmdLine[1] = "HM" Then DirCreate(@WorkingDir & "\" & $HM) $exitcode = $HM EndIf If $CmdLine[1] = "DMY" Then DirCreate(@WorkingDir & "\" & $DMY) $exitcode = $DMY EndIf If $CmdLine[1] = "ALL" Then DirCreate(@WorkingDir & "\" & $HM & $Div & $DMY) $exitcode = $HM & $Div & $DMY EndIf MsgBox(4096, "Error", $exitcode) Exit $exitcode Link to comment Share on other sites More sharing options...
JohnOne Posted July 14, 2010 Share Posted July 14, 2010 Sorry, I dont know, the % % things look like a different language to me. If you are trying to get a string as an exitcode, you are on a losing street, you can only havs numeric. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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