Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Stupid arithmetic usage question...


  • Please log in to reply
4 replies to this topic
brand
  • Members
  • 21 posts
  • Last active: Dec 15 2006 10:10 PM
  • Joined: 07 Dec 2006
So, I'm getting sort of frustrated here... but I can't seem to perform some arithmetic:

GUIPercentHeight := 80

HGUI := %A_ScreenHeight% * %GUIPercentHeight%

given the above, %HGUI% = nothing (or nothing in terms of what autohotkey considers nothing which I think is "" <== side quest)

Why?! :twisted:


Thanks!

Matt


PS: I'm new to autohotkey (and programming in general), so your help is greatly appreciated)

garry
  • Spam Officer
  • 3219 posts
  • Last active: Sep 20 2018 02:47 PM
  • Joined: 19 Apr 2005
WA=%A_screenwidth%

HA=%A_screenheight%

SHOWW:=(WA*97)/100  ;width

SHOWH:=(HA*65)/100  ;height



Tuncay
  • Members
  • 1945 posts
  • Last active: Feb 08 2015 03:49 PM
  • Joined: 07 Nov 2006
"And he lives ..." (don`t ask why!!)

You should read the DF manual!

On expressions you must not enclose variable names in percent signs. But on non expression evaluations (in a string) the percent signs are needed.
GUIPercentHeight = 80
HGUI := A_ScreenHeight * GUIPercentHeight
or
GUIPercentHeight := 80
HGUI = %A_ScreenHeight% * %GUIPercentHeight%

See at Variables and Expressions
and Quick Start Tutorial

No signature.


polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
In expressions you don't need to wrap variables in percent signs (%), e.g.: HGUI := A_ScreenHeight * GUIPercentHeight

Edit: Tuncay posted a few seconds before me lol

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


brand
  • Members
  • 21 posts
  • Last active: Dec 15 2006 10:10 PM
  • Joined: 07 Dec 2006
Thanks guys! :lol:


I thought prefacing the post with "stupid" made the RTFM reference void? :wink: