variable names in MoveWindow command

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
lgreaney
Newbie
Posts: 2
Joined: Thu Oct 26, 2006 9:31 pm

variable names in MoveWindow command

Post by lgreaney » Thu Oct 26, 2006 10:02 pm

Can variables be used in MoveWindow command?

I have been unable to get them to work. I have tried both
with and without the variable names bracketed with "%".

Comments in test code below.
Thank you for any help.

Leo

Code: Select all

Run Program>C:\WINNT\system32\notepad.exe
WaitWindowOpen>NOTEPAD*

Let>baseXforS1 = 500
Let>baseYforVLC=0

Let>thisX = 0
Let>thisY = 0
// set ScreenNum - will be input paramater on compiled code, so
// same scp can be used to create multiple exe files with different names
// and different ScreenNum value input
// For debug/test code SreenNum here
Let>ScreenNum = 1
// if single video out, use base values
IF> ScreenNum = 0
    Let>thisX = 0
    Let>thisX = 0
ELSE
// if multiple video, put on another screen 

    Let>thisX = {%baseXforS1% * %ScreenNum%}
//	Let>thisX = 500  // hardcoding the newX variable value here does not take either.
    Let>thisY = 0


ENDIF


// This Move line moves window to 0,0 as if variables not defined
// The debug watch windows shows variables set as desired.
MoveWindow>NOTEPAD*,%thisX%,%thisY%
// This move line (with constants) moves window as expected
MoveWindow>NOTEPAD*,500,0
// arbitraty size for initial test
ResizeWindow>NOTEPAD*,294,429

// Focus the app
SetFocus>NOTEPAD*
[/code]

User avatar
JRL
Automation Wizard
Posts: 3517
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Oct 26, 2006 10:41 pm

I haven't tested your code but right off I see a lot of embedded space characters. Unless you're running Beta 9 a space character is a valid character in a variable name or value. For example, when you've written:
Let>thisX = 0

You've actually written
Let>thisX%SPACE%=%SPACE%0

What you really wanted was:
Let>thisX=0

Remove all the spaces except from your remarks and see if that helps.
Dick

lgreaney
Newbie
Posts: 2
Joined: Thu Oct 26, 2006 9:31 pm

Post by lgreaney » Fri Oct 27, 2006 5:51 pm

Dick,

Thank you much.

I removed the spaces and my script now runs as I desired.
Leo

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Oct 27, 2006 6:00 pm

If you like spaces (most experienced programmers do) then in version 9.0 you can use the IGNORESPACES directive:

Let>IGNORESPACES=1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts