CTRL-c cannot copy text to clipboard

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
jtsy
Newbie
Posts: 7
Joined: Tue Jul 17, 2007 9:09 am

CTRL-c cannot copy text to clipboard

Post by jtsy » Mon Jul 23, 2007 2:55 pm

Hi,

We wrote a piece of macroscript code in order to copy a portion of text from a text file to another text file. part of the code is as follows:

Run Program>C:\Program Files\Windows NT\Accessories\wordpad.exe
WaitWindowOpen>Document - WordPad
WindowAction>1,Document - WordPad

//open source file
Wait>1
Press CTRL
send>o
Release CTRL
WaitWindowOpen>Open
send>%name%
wait>0.5
Press Enter

//go to first line of text file
Press CTRL
Press HOME
Release CTRL

Wait>0.5

//select text to be copied
Press Down*4
Wait>0.5
Press Shift
Wait>0.5
Press Up
Wait>0.5
Release Shift
Wait>2

//copy text
//problematic part: the code cannot copy it to the computer clipboard
Press Ctrl
wait>1
send>c
Release Ctrl
Wait>2

//open a destination text file for text to be pasted
Run Program>notepad.exe
Wait>2
WaitWindowOpen>Untitled - Notepad
Wait>2
Press CTRL
send>v
Release CTRL

We tried many times but cant seem to find where the problem lies..
Any help would be greatly appreciated...thanks a lot!

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 Jul 23, 2007 3:00 pm

Are you sure it is not copying to the clipboard? Or is it just that the paste is failing? Or maybe it's failing to highlight the appropriate text? I've just done a quick test with WordPad open with some text in it. Running this script the correct clipboard data is displayed:

Code: Select all

SetFocus>Document - WordPad
//Select All
Press CTRL
Send>a
Release CTRL
//Copy to clipboard
Press CTRL
Send>c
Release CTRL
Wait>1
//Get clipboard contents and display
GetClipBoard>clip_contents
MessageModal>clip_contents
So clearly no issue sending ctrl-c to WordPad, which is why I suspect you need to be looking at some other part of your script.
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