Jump to content
Sign in to follow this  
AmphetaMarinE

Check if script has been run from command line?

Recommended Posts

Hi Guys,

I am writing a console based app, and was wondering if there is any way using autoit, that I could check if the script has been run from the command line, or is being double clicked on in explorer?

Cheers,

Amph.

Share this post


Link to post
Share on other sites

Hi Guys,

I am writing a console based app, and was wondering if there is any way using autoit, that I could check if the script has been run from the command line, or is being double clicked on in explorer?

Cheers,

Amph.

If you run it from th ecommand line you could add a parameter -

Scriptname cmdline

Then the script can set something to let you know how it was called.

Look in help for CmdLine.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Hi Guys,

I am writing a console based app, and was wondering if there is any way using autoit, that I could check if the script has been run from the command line, or is being double clicked on in explorer?

Cheers,

Amph.

Even if you detect that it was run from a commandline, that won't make your script a console app. The AutoIt interpreter is compiled with a switch that makes it a windows app (SUBSYSTEM=WINDOWS vice CONSOLE). Even if you run it from a console, you'll notice it returns to the command prompt immediately and your app runs in its own window. Just like running other windowed apps from the command line doesn't make then console apps either (i.e. Notepad, Firefox, etc.).

Apps that are compile to be console apps (i.e. the FTP and Telnet clients that ship with Windows) show what that would be like, but AutoIt just doesn't do that (...yet).

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Even if you detect that it was run from a commandline, that won't make your script a console app. The AutoIt interpreter is compiled with a switch that makes it a windows app (SUBSYSTEM=WINDOWS vice CONSOLE). Even if you run it from a console, you'll notice it returns to the command prompt immediately and your app runs in its own window. Just like running other windowed apps from the command line doesn't make then console apps either (i.e. Notepad, Firefox, etc.).

Apps that are compile to be console apps (i.e. the FTP and Telnet clients that ship with Windows) show what that would be like, but AutoIt just doesn't do that (...yet).

:)

I understand that, but it is a relatively simple thing to modify that byte in the header and turn it into a console app...

Regardless, thanks for your help guys. Much appreciated :P

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  

×
×
  • Create New...