 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
rejetto
Joined: 05 May 2008 Posts: 5 Location: Roma, Italy
|
Posted: Mon May 05, 2008 12:37 am Post subject: command line parameter not working with DllCall |
|
|
hello, i discovered this wonderful tool some minutes ago, and i'd like to start with a big "thank you" for it.
I hope my request is not annoying, i searched for an existing solution before asking.
I'm tring this simple script, meant to change mouse speed, found after a quick search.
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,%1%, Int,2)
as you can see, i put the %1% to let me change the speed at command line.
It just doesn't work: mouse speed is not affected.
It works if i put a constant value, like 5.
What's wrong with it?
Thank you in advance |
|
| Back to top |
|
 |
sinkfaze
Joined: 19 Mar 2008 Posts: 138
|
Posted: Mon May 05, 2008 12:53 am Post subject: |
|
|
| This post might be of some assistance. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2486 Location: Australia, Qld
|
Posted: Mon May 05, 2008 5:24 am Post subject: |
|
|
In expressions, only double-references are enclosed in percent signs. For instance, if the first command-line arg is "20", %1% in an expression refers to a variable named "20", which is likely to be empty.
Variables with purely numeric names can't be accessed directly by an expression. Instead, use a double-reference or copy the value to another variable:
| Code: | 1 = first parameter
a = %1%
b = 1
MsgBox % a . "`n" . %b% |
|
|
| Back to top |
|
 |
rejetto
Joined: 05 May 2008 Posts: 5 Location: Roma, Italy
|
Posted: Mon May 05, 2008 10:41 am Post subject: |
|
|
That solved my problem, thank you!
I post here the solution for those with my same problem and hitting this thread while searching
| Code: |
a = %1%
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,a, Int,2)
|
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3958 Location: Pittsburgh
|
Posted: Mon May 05, 2008 5:24 pm Post subject: |
|
|
| Lexikos wrote: | | use a double-reference | How? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2486 Location: Australia, Qld
|
Posted: Mon May 05, 2008 9:48 pm Post subject: |
|
|
| Code: | a = 1
DllCall("SystemParametersInfo", Int,113, Int,0, UInt,%a%, Int,2) |
|
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 3958 Location: Pittsburgh
|
Posted: Mon May 05, 2008 9:57 pm Post subject: |
|
|
Which method is better?
Maybe we should include in our scripts something like | Code: | | zero:=0, one:=1, two:=2 ;... | When a command line parameter is needed, we can just write %one%, assuming %zero% > 0. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|