Text from Clipboard won't compare with IF THEN

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
MonkeyB
Newbie
Posts: 2
Joined: Sun Jul 15, 2007 1:02 am

Text from Clipboard won't compare with IF THEN

Post by MonkeyB » Sun Jul 15, 2007 1:10 am

Hi,

Any help would be greatly appreciated. I am trying to copy text from a web page and then compare that to a predefined word or words and use an IF THEN if it matches or not for my subroutines. I have tried all kinds of changes but none has worked. I figure this should be simple but I must be missing something. I am a novice so please forgive me if it is too simple.

It does copy the word correctly to the clipboard and the subroutines work, it is just the IF THEN ELSE that does not seem to compare or work.

Also, In IE 7 how can I focus to a tab? Right now it works but that tab has to be the active one.

Thanks


// C:\Program Files\Macro Scheduler\myscript.scp

//subroutines
SRT>PageMe
Let>SENDMAIL_STATUS=1
Let>subject=test
Let>me=[email protected]
Let>myname=MonkeyB
Let>smtp=mail.myserver.net
Let>SMTP_PORT=3535
Let>SMTP_AUTH=1
Let>SMTP_USERID=[email protected]
Let>SMTP_PASSWORD=test
Let>recipients=[email protected]
Let>body=Message from me
SMTPSendMail>recipients,smtp,me,myname,subject,body,
End>PageMe

SRT>FalseTest
Let>MSG_STAYONTOP=1
Message>WhatsInTheClipBoard
Wait>10
Goto>Start
End>FalseTest

Label>Start
Let>WW_TIMEOUT=5
SetFocus>Web Page - Windows Internet Explorer
CapsOff
MouseMove>129,327
Wait>2
LClick
Wait>0.1
MouseMove>136,412
Wait>1
LDblClick
Wait>1
Press CTRL
Wait>0.3
Send>c
Wait>0.17
Release CTRL
WaitClipBoard
GetClipBoard>WhatsInTheClipBoard
StringReplace>WhatsInTheClipBoard,%LF%,,WhatsInTheClipBoard
StringReplace>WhatsInTheClipBoard,%CR%,,WhatsInTheClipBoard
IF>WhatsInTheClipBoard=There
THEN Gosub>PageMe
ELSE Gosub>FalseTest
ENDIF
Label>end

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Sun Jul 15, 2007 3:04 am

Do you see what you expect if you display WhatsInTheClipBoard, eg

MDL>WhatsInTheClipBoard

?

MonkeyB
Newbie
Posts: 2
Joined: Sun Jul 15, 2007 1:02 am

Post by MonkeyB » Sun Jul 15, 2007 3:44 am

I see "There " the word There with a space after it. It is ok if I can match it to the string as is. I tried to use the StringReplace because that is what I thought was hanging it up.

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

Post by JRL » Mon Jul 16, 2007 12:43 pm

"There " with a space will not usually match "There" with no space. However, new with version 9 is the IGNOREPACES variable. If you insert the line:

Let>IGNORESPACES=1

From there on in the script, all space characters will be ignored. and "There " will equal "There".

Let>IGNORESPACES=0

Will set things back to "normal"

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

Post by Marcus Tettmar » Mon Jul 16, 2007 8:39 pm

Or:

Include the space in the comparison - just put a space on the end of the line:

If>WhatsInClipBoard=There

There's a space at the end of the line above.

Or, more visible, and easier to read:

If>{%WhatsInClipBoard% = "There "}

Or, trim it first:

VBEval>Trim("%WhatsInClipBoard%"),WhatsInClipBoard

Or use Pos to do a substring search.

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