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 

Functions in non-expression parameters

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
[二oO也



Joined: 22 Feb 2005
Posts: 60
Location: Sweden

PostPosted: Sun Apr 17, 2005 8:04 am    Post subject: Functions in non-expression parameters Reply with quote

I know that you could do something like
Code:

msgbox % Add(3, 2)

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

Question Question
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
View user's profile Send private message Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3841
Location: Bremen, Germany

PostPosted: Sun Apr 17, 2005 9:48 am    Post subject: Reply with quote

I guess you could put them in quotes "".
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
niwi



Joined: 27 Feb 2005
Posts: 128
Location: Heidelberg, Germany

PostPosted: Sun Apr 17, 2005 9:55 am    Post subject: Reply with quote

Hi GoG,

sorry, but I can't see your problem. Your tooltip example works pretty good Wink

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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Sun Apr 17, 2005 11:49 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
[二oO也



Joined: 22 Feb 2005
Posts: 60
Location: Sweden

PostPosted: Sun Apr 17, 2005 5:14 pm    Post subject: Re: Reply with quote

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 Question
_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955)
Back to top
View user's profile Send private message Visit poster's website
TeknoMusicMan



Joined: 14 Apr 2005
Posts: 188
Location: Wisconsin, USA

PostPosted: Sun Apr 17, 2005 5:23 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
[二oO也



Joined: 22 Feb 2005
Posts: 60
Location: Sweden

PostPosted: Mon Apr 18, 2005 2:01 pm    Post subject: No... Reply with quote

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. Sad

ThanX anyway
_________________
"Make everything as simple as possible, but not simpler."
- Albert Einstein (1879-1955)
Back to top
View user's profile Send private message Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Mon Apr 18, 2005 2:57 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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