How to read Clipboard

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mfauzim
Pro Scripter
Posts: 89
Joined: Wed Sep 13, 2006 10:57 am

How to read Clipboard

Post by mfauzim » Sat Sep 23, 2006 10:39 pm

In one of the java web app which I need to interface, I can get a clipboard of the whole app screen in text. I am looking for advice on how:

1. how do I know on which line and which position does a certain dynamic text exist on the clipboard. Example:

Screen sample:
title
text1 text2 text3
text4 text5 text 6

All the text exist at the same location, but depending on the input, some text# may exist and some not, and in some cases there is no text# exist. If am able to know the lineno/position then I would be able to select to text# to be copied to another application input.
Sample of he script is very much appreciated.

regards

mfauzim
Pro Scripter
Posts: 89
Joined: Wed Sep 13, 2006 10:57 am

Do we need to export the clipboard to outfile first?

Post by mfauzim » Mon Sep 25, 2006 6:58 am

Any suggestion is welcome,

My question si dow we need tp export clipboard to output file first then use readln in order to check each page/line to find content of text1, text2 etc. or Is there anyt other elegant way to address this. Any suggestion is very much appreciated

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

Post by Marcus Tettmar » Mon Sep 25, 2006 7:47 am

No need to write to disk first. Use Separate to split the text into an array of lines. The delimiter will be the carriage-return and line-feed chars. Use Position to look for position of a string in the line. MidStr to extract a portion.

Code: Select all

GetClipBoard>text
Separate>text,CRLF,lines
Let>ln=0
Repeat>ln
  Let>ln=ln+1
  Position>sometext,lines_%ln%,1,p
  MidStr>....
Until>ln=lines_count
If you are looking for a pattern consider using VBScript regular expressions.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mfauzim
Pro Scripter
Posts: 89
Joined: Wed Sep 13, 2006 10:57 am

Next step

Post by mfauzim » Mon Sep 25, 2006 8:59 am

Thanks marcus, in this java app, the only way for me to copy to clipboard is by menu steps
1. press alt
2. press button e ( how do I press E in MS)
3. press A ( for select all . issue same sa 2)
4. press c ( copy . same 2)

regards

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

Post by Marcus Tettmar » Mon Sep 25, 2006 9:25 am

Use the Send command to send a character key.

You probably just need this:

Press ALT
Send>eac
Release ALT

Or if you need to break it down do this:

Press ALT
Send>e
Release ALT

Press ALT
Send>a
Release ALT

Press ALT
Send>c
Release ALT

If necessary put a small wait between each one:

Press ALT
Send>e
Release ALT
Send>0.5
Press ALT
Send>a
Release ALT

Always use the lower case character when sending keystrokes for menu options etc.

For each modifier key (Press ALT, Press Shift or Press CTRL) make sure you have a corresponding Release.

I'm guessing you haven't read the getting started guide in the help file - "Scripting Windows for Beginners" - as this is all explained in there.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

mfauzim
Pro Scripter
Posts: 89
Joined: Wed Sep 13, 2006 10:57 am

I've Read

Post by mfauzim » Mon Sep 25, 2006 11:07 am

I've read, but sometime just not sure and dont have time to do any trial. With the current dateline, I have to learn while doing the project. Thanks for your info.
regards

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

Post by Marcus Tettmar » Mon Sep 25, 2006 11:11 am

I understand, but the getting started guide will take about 20 minutes, or you can scan it in 5 and pick up on some most-used, key concepts. Well worth while. Quicker than posting questions here, but more than happy to answer any questions you have. :-)
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