AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Variable containing whole command line like $CmdLineRaw

 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sat Feb 20, 2010 7:21 pm    Post subject: Variable containing whole command line like $CmdLineRaw Reply with quote

Hi,

It might be nice to have a variable containing the whole command line which was passed to the script like $CmdLineRaw in AutoIt3.

Comp. also http://www.autohotkey.com/forum/topic54779.html
Tobias
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sat Feb 20, 2010 7:32 pm    Post subject: Reply with quote

I have posted an answer.
Code:
commandLine := DllCall("GetCommandLineA" , "Str")

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
fincs



Joined: 05 May 2007
Posts: 1160
Location: Seville, Spain

PostPosted: Sat Feb 20, 2010 8:31 pm    Post subject: Reply with quote

DllCall("GetCommandLine", "str") (without the A) is Unicode-friendly.
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Sat Feb 20, 2010 8:58 pm    Post subject: Reply with quote

Oh that is good to know. In standard AutoHotkey, should we use the Unicode friendly version also?
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Sat Feb 20, 2010 9:19 pm    Post subject: Reply with quote

Hm my posting here was just to suggest an improvement as, in my point of view, it is much easier when I find a documented function / variable in the help (which is in my point of view perfect for AHK). Doing a DllCall does it as well but ok... that's up to the point of view of the dev Smile

And posted it here as well as I found such a function in the AutoIt and AHK is my prerferred "automating" language Wink
Back to top
fincs



Joined: 05 May 2007
Posts: 1160
Location: Seville, Spain

PostPosted: Sun Feb 21, 2010 8:50 pm    Post subject: Reply with quote

Tuncay wrote:
Oh that is good to know. In standard AutoHotkey, should we use the Unicode friendly version also?

If you want to port your script to Unicode in the future then it'll be easier Smile
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Mon Feb 22, 2010 3:39 am    Post subject: Reply with quote

FYI, that's one thing that is now covered in my documentation: Script Compatibility - DllCall
Standard (or "mainstream") AutoHotkey is an ANSI build. It also notes where it differs from AutoHotkey_L ANSI builds.

As for the original topic: One of the things under consideration (long ago!) for v2 was replacement of %0% %1% etc. with some built-in variables or a built-in function. For instance, infogulch suggested A_0, A_1, etc., JSLover(?) suggested A_Param1, A_Param2, ...

I think the current issues are obscurity (things like if 0 > 1) and the lack of support for them directly in expressions. If they were replaced with a built-in function, it could return all parameters when the parameter number was omitted:
Code:
all_args := GetCommandLineArg()
arg_1 := GetCommandLineArg(1)
Naming may be difficult: do we want clarity or brevity?
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Mon Feb 22, 2010 7:38 am    Post subject: Reply with quote

Lexikos wrote:
...JSLover(?) suggested A_Param1, A_Param2, ...

...I have current working (unreleased) code for A_Param1, A_ParamN...but it's not as useful as I'd like (parsing params based on order)...so I plan on writing universal command line getting/parsing code...

Lexikos wrote:
Naming may be difficult: do we want clarity or brevity?

...my working function name is ParamGet()...
Back to top
Tuncay



Joined: 07 Nov 2006
Posts: 1886
Location: Germany

PostPosted: Mon Feb 22, 2010 7:08 pm    Post subject: Reply with quote

Quote:
so I plan on writing universal command line getting/parsing code...

I have made a parser for options, it is not made for the command line. It could parse the command line of some programs also, but that was not the reason why I made it. May be you find it useful or you can rework on the source for that: argp - Argument Options Parser
_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MilesAhead



Joined: 21 Jan 2009
Posts: 86

PostPosted: Tue Mar 02, 2010 2:28 am    Post subject: Reply with quote

Anonymous wrote:
Lexikos wrote:
...JSLover(?) suggested A_Param1, A_Param2, ...

...I have current working (unreleased) code for A_Param1, A_ParamN...but it's not as useful as I'd like (parsing params based on order)...so I plan on writing universal command line getting/parsing code...

Lexikos wrote:
Naming may be difficult: do we want clarity or brevity?

...my working function name is ParamGet()...


If it's up for a vote I favor the old Borland Pascal
ParamStr function where ParamStr(0) is the name of the program itself and ParamStr(1) the first command line arg etc.. ParamCount return the number of args.
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Mar 02, 2010 7:38 pm    Post subject: Reply with quote

MilesAhead wrote:
...I favor the old Borland Pascal...

...I know nothing about Borland, but based on DOS or something else (not sure what) I prefer that too. In my current code A_Param0 gets the exe name & A_Param1 is the 1st Param & A_Params is the number of params...param 0 should not be the number of params (like it is in AHK's %0%)...
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group