GetClipBoard command not packing variable

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

GetClipBoard command not packing variable

Post by JRS » Fri Jun 23, 2006 9:16 pm

Hello All,

My current objective is to load up a given
web page in Firefox; in my script arbitrarily http://www.yahoo.com,
I do a Source, select all the source, copy the source into the
clipboard and then attempt to pack the the contents of the clipboard
into the Variable 'Hold' via the GetClipBoard command.

The results of the

MessageModal>String Length ClipBoard: %Lgth%
MessageModal>%Hold%

Macro Scheduler commands are: 0 and null (no text)
respectively.

However ... when I bring manually up Wordpad and manually
paste the contents of the clipboard into a blank Wordpad doc:
Voila! There is the source of the Yahoo page.

Any suggestions and/or solutions would be greatly appreciated!

Regards:

Joel S.


// C:\PROGRAM FILES\MJT NET LTD\MACRO SCHEDULER\Testbed.scp
// Recorded on Friday, June 23, 2006, at 01:56 PM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
Let>Hold=
Let>HoldPage=http://www.yahoo.com
GoSub>NewBrowserSession
Remark>
Remark>=== Get Source and Copy into Clipboard ===
Remark>
PutClipBoard>
Press Ctrl
Send Character/Text>u
Release Ctrl
Press Ctrl
Send Character/Text>a
Release Ctrl
Wait>1.0
Press Alt
Send Character/Text>e
Wait>3.0
Release Alt
Wait>1.0
Send Character/Text>c
WaitClipBoard
Length>Hold,Lgth
GetClipBoard>Hold
MessageModal>String Length ClipBoard: %Lgth%
MessageModal>%Hold%
Wait>2.0
MessageModal>Done.
Remark>
Remark>=== Subroutines ===
Remark>
SRT>NewBrowserSession
Run Program>C:\Program Files\Mozilla Firefox\firefox.exe
Wait>15.0
Remark>GetActiveWindow>window_title,X,Y
Remark>SetFocus>window_title
Press Ctrl
Send Character/Text>l
Release Ctrl
Send Character/Text>%HoldPage%
Press Enter
Wait>5.0
GetActiveWindow>window_title,X,Y
SetFocus>window_title
GoSub>Gadol
End>NewBrowserSession
Remark>
Remark>
Remark>=== Maximize Window ===
Remark>
Remark>
SRT>Gadol
Remark>Wait>5.0
Press Alt
Send Character/Text> x
Release Alt
Remark>Wait>1.0
End>Gadol

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Fri Jun 23, 2006 9:22 pm

Please note in my script I'm mistakenly getting the Length of Hold
before Hold is being packed by the GetClipBoard command. The
result is the same when I correctly place the get string length AFTER
the GetClipBoard command.

Thanks,

Joel.

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

Post by JRL » Fri Jun 23, 2006 9:25 pm

Joel,

Rather than view source, select all, copy to clipboard, etc.. Have you tried HTTPRequest>?

HTTPRequest>http://www.yahoo.com,,GET,,HTMLResponse

This takes the source code for the named web page and places it into the named variable, in this case, HTMLResponse.
Later,
Dick

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Fri Jun 23, 2006 11:12 pm

Hello JRL,

Thanks for getting back to me so fast! Indeed I have tried
the HTTPRequest command but in my actual app I'm "calling"
a foerign language web page and to make a long story short
I'm not getting anywhere near the results or the complete results
of the doing the source. I guess this aspect is another query
in of itself but in a nutshell with the Firefox source I'm seeing on
the first line of my HTTPRequest return of the same URL:



where first line of the source via Firefox is:



Any suggestions/solutions in this regard would be helpful but in
another post I made re: Macro Scheduler HTTPRequest ... it is
not a browser and from the differences in the browser and Macro
Scheduler can be very significant.

So back to the GetClipBoard ... am I missing something what
should be very apparent? Once again thanks for help.

Joel S.

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sat Jun 24, 2006 12:49 am

Hello All,

I think I found the solution and I want to relay but first
in reviewing my reply post just previous to this one I
see I did not correctly show the immediate difference between
doing an HTTPRequest via Macro Scheduler and the Source via
Firefox:

Same URL to Foreign Language page:

Via Macro Scheduler:

¤ ˜ ‘

Via Firefox (Source)

>נפט בנזין -

In terms of the preceding Firefox after title>> there are a couple of
Hebrew words that are "HTML Entities" I don;t know if when I post
this note in this forum the Hebrew will keep it's letter form or
convert to ????

Anbody who deals extensively with Non-English foreign language
character sets Unicode utf8 especially with respect to languages of
the Middle East may have an inkling what I'm talking about here.

In a nutshell what I'm hoping now that I found a solution to getting
GetClipBoard to work in the context I want - and which I'll get to
shortly - is to be able to search the utf8, Hebrew/Arabic/Farsi
HTML entities in my GetClipBoard variable Hold.

In my experience (excellent job Mjtnet!) the Macro Scheduler
Position and/or MidStr command doesn't get bamboozeled or
confused with non-screen printing ASCII. It is very robust. Now
what I'm going to try tomorrow is if I can search the HTML entities
in the variable. I already know I can do other language encodings!
(Again, excellent job Mjtnet.com!)

Following is my original code tweaked a bit. I now get a large
byte count for my variable length (70-80K) but when I try a
MessageModal on the whole variable I still show null or empty BUT!
when I go through the loop printing one byte at a time - everything
looks great!

Hopefully you'll be able to follow the logic of my script OK - it
shouldn't be too difficult. What seems to have done the trick
is I'm keeping the [Ctrl] key down and doing all the hotkey
sequences within the one Ctrl press instead of pressing and
releasing the [Ctrl] for each hotkey combination.

Interesting ...

If anybody wants I'll relay my success/failures in searching
multi-lingual character sets, encodings via Macro Scheduler and
I'll be happy to relay the fixes if/when I find them.

In this case the subtle differences make all the difference in the
world.

Lastly, again I would like to use Macro Scheudler HTTPRequest
rather than a browser which inherently makes the application
less elegant and robust.

But I understand from a previous query with a problem I had
with HTTPRequest (a problem I found that was ultimately between
the keyboard and chair) that Macro Scheduler it is not a Browser
and the requests in some contexts can be quite significant.

That said and understood it would be nice there coud be some
parameters associated with Macro Scheduler HTTPRequest that
would make it "appear" more like a Browser (i.e. Firefox, IE) when
"calling" certain web pages. I just musing here.

Thanks,

Joel.


=====================================




// C:\PROGRAM FILES\MJT NET LTD\MACRO SCHEDULER\Testbed.scp
// Recorded on Friday, June 23, 2006, at 01:56 PM

//Recorded Events
Let>WW_TIMEOUT=5
CapsOff
Let>Hold=
Let>HoldPage=http://www.yahoo.com
GoSub>NewBrowserSession
Remark>
Remark>=== Get Source and Copy into Clipboard ===
Remark>
PutClipBoard>
Press Ctrl
Send Character/Text>u
Wait>6.0
Send Character/Text>a
Wait>3.0
Send Character/Text>c
Release Ctrl
Wait>3.0
GetClipBoard>Hold
Length>Hold,Lgth
MessageModal>String Length ClipBoard: %Lgth%
MessageModal>%Hold%
Let>k=0
Repeat>k
Let>k=k+1
MidStr>Hold,k,1,Hold1
MessageModal>Byte #: %k% Current Character: %Hold1%
Until>k,Lgth
Wait>2.0
MessageModal>Done.
Remark>
Remark>=== Subroutines ===
Remark>
SRT>NewBrowserSession
Run Program>C:\Program Files\Mozilla Firefox\firefox.exe
Wait>15.0
Remark>GetActiveWindow>window_title,X,Y
Remark>SetFocus>window_title
Press Ctrl
Send Character/Text>l
Release Ctrl
Send Character/Text>%HoldPage%
Press Enter
Wait>5.0
GetActiveWindow>window_title,X,Y
SetFocus>window_title
GoSub>Gadol
End>NewBrowserSession
Remark>
Remark>
Remark>=== Maximize Window ===
Remark>
Remark>
SRT>Gadol
Remark>Wait>5.0
Press Alt
Send Character/Text> x
Release Alt
Remark>Wait>1.0
End>Gadol

JRS
Pro Scripter
Posts: 71
Joined: Thu Nov 04, 2004 5:19 am

Post by JRS » Sat Jun 24, 2006 1:03 am

All,

Ahhh interesting!

When I composed my preceding reply post the following line
line containing the Hebrew entities still had the Hebrew "intact".
I referenced that it might change to ???? bu that would have
occurred if the encoding was Unicode utf8.

So when I submitted the post this forum interpreted the HTML
entities and conmverted each character to their respective
HTML entity definition (e.g. &#1504)

>נפט בנזין -

In my cross- reference spreadsheet I have a character for each
of the preceding HTML Entity definitions and I can search in
my Speadsheet from that respect. I found you can also
concatenate them together like "regular strings". Now again,
what is going to be interesting is if I can duplicate this
functionality in the Macro Scheduler GetClipBoard variable
tomorrow.

I hope this has been helpful to anyone programming Macro Scheduler
for multi-lingual/foreign language app. If this all doesn't make any
sense I'll be happy to clarify offline (or online as permitted) in my
own way repay the help I've received from the fine people in this
forum).

Regards,

Joel.

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