Sign in to follow this  
Followers 0
potitpanda

How to show help of a script in Command Line

18 posts in this topic

Hi I have made a script with AutoIT and I want to launch Myscript /help on command Line, and as a result I Want to show a quick help of my script.

How to do this ?

Share this post


Link to post
Share on other sites



Look for "Command Line Parameters" in the help file. That should point you in the right direction.


[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites

Hi I have made a script with AutoIT and I want to launch Myscript /help on command Line, and as a result I Want to show a quick help of my script.

How to do this ?

Easiest way if you only want one command line switch:

If $CmdLine[1] == "/help" Then

Msgbox(0,"","some info")

Exit

EndIf

The above example does only work if you pass the help parameter as the first parameter.

Take a look at the documentation for command line switches. Everything is perfectly explained there.


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Look for "Command Line Parameters" in the help file. That should point you in the right direction.

Hummm... ???

I Don't understand, in "Command Line parameters" that explain how to compile my script in command line !

That's not I Want to do !

When I type Myscript /help on command line, that shows a litte text to help users of my script

You understand ?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Re-read that section:

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"

If the script was compiled it would have been run like this:

myscript.exe param1 "this is another param"

$CmdLineRaw equals... param1 "this is another param"

Note that $CmdLineRaw just return the parameters.

Note : only 63 parameters can be return by $CmdLine[...], but $CmdLineRaw will always returns the entire command line.

Edited by DarkMatter

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Share this post


Link to post
Share on other sites

Hummm... ???

I Don't understand, in "Command Line parameters" that explain how to compile my script in command line !

That's not I Want to do !

When I type Myscript /help on command line, that shows a litte text to help users of my script

You understand ?

Have you even read my post? Isn't that exactly what you want?! You can just copy my code, change the "some info" text and be happy!


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

No you idiots. The OP is wanting output to a console.

AutoIt is, when compiled normally, a Windows application. It doesn't connect to the console window unless you do some weird fiddling by tracking down the spawning process and attaching to its console.

Share this post


Link to post
Share on other sites

No you idiots. The OP is wanting output to a console.

AutoIt is, when compiled normally, a Windows application. It doesn't connect to the console window unless you do some weird fiddling by tracking down the spawning process and attaching to its console.

wtf is wrong with you?


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Hey potitpanda,

I guess you quoted my post cause that was the answer to your question, right?

Glad I could you :D

@Richard

Who's the idiot now? I wouldn't be so offensive, since we all are just trying to help each other!! Thank you!


You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

Share this post


Link to post
Share on other sites

Then you all need to learn how to communicate your problems properly because that's what I got out of it.

Share this post


Link to post
Share on other sites

Oh, and I want to say sorry for calling anyone an idiot. It was probably my fault for misreading something.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

This line affects the compiler, to make your app a Command Prompt Console app instead of a windowed app, I think:

#AutoIt3Wrapper_Change2CUI=y

You should expect this to work only if SciTe4AutoIt3 is installed, and only then after compiling the script. You should also expect that your app then can't have a GUI to it - I think - and this is what young RichardRobertson the no-idiot-whatever was trying to describe, howeverso politely.

And yes, we do need both mojo and dark matter - there has been some question about squirrels.

Edit: Striken text as per RichardRobertson

Edited by Squirrely1

Das Häschen benutzt Radar

Share this post


Link to post
Share on other sites

Do not irritate The question is solved.

Thank you to all the people who answered to this post.

Share this post


Link to post
Share on other sites

Okay It Works

but What is the function of : #AutoIt3Wrapper_Change2CUI=y

thanks for the replies

In Scite editor press Ctrl+F1 and go to Extra utilities/AutoIt3Wrapper section

There is detailed description of all AutoIt3Wrapper's directives.

Share this post


Link to post
Share on other sites

I corrected you somewhere else too Squirrely, and for the sake of this thread, yes, you can use standard GUIs in a console application.

Share this post


Link to post
Share on other sites

RichardRobertson - Thanks for the correction - I was hoping someone would double-check this since I haven't played with it.


Das Häschen benutzt Radar

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