Hints, tips and tricks for newbies
Moderators: Dorian (MJT support), JRL
-
tchite
- Newbie
- Posts: 4
- Joined: Sun Aug 06, 2006 7:12 am
-
Contact:
Post
by tchite » Mon Aug 28, 2006 5:30 am
I really need to read the text in windows before I process
them in Macro Scheduler. So I am trying to learn the
GetWindowText command (GWT). I see a one line example
in the online help section which I use in the following program.
Problem is it just doesn't work.
Code: Select all
// this bring the WordPad window in focus - this works!
setFocus>Document - WordPad
// let's wait to make sure the computer has enough time
wait>1
// let's send this text to the WordPad window - this works!
send>this is the start of the test in this window
press enter
// wait a bit for things to settle
wait>1
// I would REALLY LIKE this to work but it doesn't
// This was copied from the online help for GWT
GetWindowText>Document - WordPad, WordPadText
// the variable WordPadText doesn't have any values
// it just prints "WordPadText"
message>WordPadText
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Mon Aug 28, 2006 8:25 am
You have a space before the variable in your GWT line. It should be:
Code: Select all
GetWindowText>Document - WordPad,WordPadText
You actually created a variable called " WordPadText" but were showing "WordPadText" in the message window.
-
tchite
- Newbie
- Posts: 4
- Joined: Sun Aug 06, 2006 7:12 am
-
Contact:
Post
by tchite » Mon Aug 28, 2006 10:09 am
Removing the space makes all the difference. It does work now. Thanks! I am used to Java, C etc. where whitespace doesn't matter.