| View previous topic :: View next topic |
| Author |
Message |
[二oO也
Joined: 22 Feb 2005 Posts: 60 Location: Sweden
|
Posted: Sun Apr 17, 2005 8:04 am Post subject: Functions in non-expression parameters |
|
|
I know that you could do something like
to call functions from non-expression parameters, but how do I do if there comes any parameters after the non-expression parameter, like:
| Code: |
Tooltip, % Add(3, 2), 200, 300
|
I know that functions is a very new part of AHK, so maybe I should do something more simple... _________________ "Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955) |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3841 Location: Bremen, Germany
|
Posted: Sun Apr 17, 2005 9:48 am Post subject: |
|
|
I guess you could put them in quotes "". _________________ Ciao
toralf  |
|
| Back to top |
|
 |
niwi
Joined: 27 Feb 2005 Posts: 128 Location: Heidelberg, Germany
|
Posted: Sun Apr 17, 2005 9:55 am Post subject: |
|
|
Hi GoG,
sorry, but I can't see your problem. Your tooltip example works pretty good
| Code: | Tooltip, % Add(3, 2), 200, 300
Msgbox, test
Return
Add(x,y)
{
Return x+y
} |
The tooltip appears at the given postion and shows the result of the Add function.
Can you give me more details to understand your problem?
NiWi. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Sun Apr 17, 2005 11:49 am Post subject: |
|
|
Yes, the "% " prefix is designed to work on a per-parameter basis. Other (normal) parameters can follow it, and if you want, you can use "% " in more than one parameter of the same command.
The "% " prefix can also be used even when not required, which is useful in case you don't want to look up in the help file whether a certain parameter accepts expressions. In general, any parameter that always expects a pure number is expression-capable and doesn't require the "% " prefix. |
|
| Back to top |
|
 |
[二oO也
Joined: 22 Feb 2005 Posts: 60 Location: Sweden
|
Posted: Sun Apr 17, 2005 5:14 pm Post subject: Re: |
|
|
If it's true that you're saying, why doesn't this line work?
| Code: |
ToolTip, % (sin(A_Index) * r) + 400, % (cos(A_Index) * r) + 400, % (sin(A_Index) * r) + 400
|
Maybe it has something to do with my AHK version.
I have 1.0.31.00  _________________ "Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955) |
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Sun Apr 17, 2005 5:23 pm Post subject: |
|
|
try it like this, I got far enough through the errors that it was telling me it was trying to call a non-exsistant function so it will probably work for you since you have those functions.
| Code: | | ToolTip, (sin(A_Index)*r)+400, (cos(A_Index)*r)+400, (sin(A_Index)*r)+400 |
I think it was the extra spaces and % signs you had in there |
|
| Back to top |
|
 |
[二oO也
Joined: 22 Feb 2005 Posts: 60 Location: Sweden
|
Posted: Mon Apr 18, 2005 2:01 pm Post subject: No... |
|
|
I don't want to be impolite, but that didn't work either.
The tooltip shows "(sin(A_Index)*r)+400" in stead of the result of the equation.
ThanX anyway _________________ "Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955) |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Mon Apr 18, 2005 2:57 pm Post subject: |
|
|
| Since the first parameter of ToolTip is the text to be displayed, to use an expression in it you must include a "% " prefix. By contrast, its other parameters do not need the prefix (though it doesn't hurt to have it). |
|
| Back to top |
|
 |
|