Sign in to follow this  
Followers 0
regisp

command line switch

4 posts in this topic

hello the world.

i'm trying to find a way to compile a program with command line switch option.

Unfortunately, i'm unable to find a way to do it.

what i want to do :

make a script and compile it.

when running the exe, the script run normally

when running the exe with -debug option, have more info to know what wrong.

hope everything is clear for you guys.

thx a lot for your quick help - dont hesitate to contact me for further explanation if needed.

ciao

Share this post


Link to post
Share on other sites



$debug = 0
If $CmdLine[0] > 0 Then
 If StringUpper($CmdLine[1]) = "-DEBUG" Then
  $debug = 1
 EndIf
EndIf
MsgBox(0,"debug","debug = " & $debug)


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Test this with a /? parameter. It is a template with Scite4AutoIt3 by typing cmdlineselect and pressing the spacebar.

If $Cmdline[0] Then
    For $i = 1 To $Cmdline[0]
        Select
            Case $Cmdline[$i] = '/?'
                MsgBox(262144, StringTrimRight(@ScriptName, 4) & ' Help', _
                        'Switches are:' & @LF _
                         & @LF & '/extract' _
                         & @LF & @TAB & 'Extract files to current directory' _
                         & @LF & '/x' _
                         & @LF & @TAB & '' _
                         & @LF & '/x' _
                         & @LF & @TAB & '' _
                         & @LF & '/x' _
                         & @LF & @TAB & '' _
                         & @LF & '/x' _
                         & @LF & @TAB & '' _
                         & @LF & '/x' _
                         & @LF & @TAB & '')
                Exit
            Case $Cmdline[$i] = '/extract'
                FileInstall('?', @ScriptDir & '\')
                Exit
            Case $Cmdline[$i] = '/x'
            Case $Cmdline[$i] = '/x'
            Case $Cmdline[$i] = '/x'
            Case $Cmdline[$i] = '/x'
            Case $Cmdline[$i] = '/x'
            Case Else
                MsgBox(262144, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw _
                         & @LF & @LF & 'Use /? for the switches available.')
                Exit
        EndSelect
    Next
EndIf
; Replace '/x' with desired switches for the above code. Add/Remove as needed.

Yah, I know, GAFrost is quick. :P

Edit: Missed a letter.

Edited by MHz

Share this post


Link to post
Share on other sites

as always very active community.

once again thank you a lot for your quality support

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0