AutoHotkey Community

It is currently May 27th, 2012, 4:32 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: February 20th, 2010, 8:21 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 8:32 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
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! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 9:31 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
DllCall("GetCommandLine", "str") (without the A) is Unicode-friendly.

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 9:58 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
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! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 10:19 pm 
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 :-)

And posted it here as well as I found such a function in the AutoIt and AHK is my prerferred "automating" language ;)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2010, 9:50 pm 
Offline
User avatar

Joined: May 5th, 2007, 7:24 pm
Posts: 1240
Location: Seville, Spain
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 :)

_________________
fincs
Highly recommended: AutoHotkey_L (see why) (all my code snippets require it)
Formal request to polyethene - I support the unity of the AutoHotkey community
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 4:39 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7503
Location: Australia
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 8:38 am 
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()...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2010, 8:08 pm 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
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! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 3:28 am 
Offline

Joined: January 21st, 2009, 5:49 pm
Posts: 176
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 2nd, 2010, 8:38 pm 
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%)...


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group