Can someone look at the script below and help me understand what I've missed or done wrong?
I'm working in PowerPoint and I want to move a selected object by entering the horizontal and vertical positions in the Format Shape box.
Prior to running the script, I must input three variables:
xPos :=
yPos:=
Ref :=
The X and Y variables are arbitrary and the Ref variable is one of four letters (T, L, R, B) representing Top, Left, Right, or Bottom respectively.
The eight reference variables are fixed.
I suspect the problem is the way I've written the four IF portions. I'm use to Excel where if one IF criteria is satisfied, the script stops; and if not satisfied, it automatically goes to the next IF, etc. But does that work the same way in AutoHotkey?
Thanks
Code: Select all
F2::
;Sleep lengths:
short := 999
medium := 999
long := 2299
;Input Variables
xPos := 19.51
yPos := 2.19
Ref := R
; Reference Variables
xRefT := -3.78 ; xTop
yRefT := -0.62 ; yTop
xRefL := -0.46 ; xLeft
yRefL := -4.40 ; yLeft
xRefR := -7.10 ; xRight
yRefR := -4.40 ; yRight
xRefB := -3.78 ; xBottom
yRefB := -8.18 ; yBottom
CoordMode, Mouse, Screen
Click, Right
Sleep, short
Send z ; Format Shape box
Sleep, short
CoordMode, Mouse, Relative
Click 95, 635 ; Position
Sleep, short
If Ref = T
Send !h
xVar := xPos + xRefT
Send %xVar%
Send !v
yVar := yPos + yRefT
Send %yVar%
If Ref = L
Send !h
xVar := xPos + xRefL
Send %xVar%
Send !v
yVar := yPos + yRefL
Send %yVar%
If Ref = R
Send !h
xVar := xPos + xRefR
Send %xVar%
Send !v
yVar := yPos + yRefR
Send %yVar%
If Ref = B
Send !h
xVar := xPos + xRefB
Send %xVar%
Send !v
yVar := yPos + yRefB
Send %yVar%
Send {Enter}
Sleep, short
Return