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!
CTRL-c cannot copy text to clipboard
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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:
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.
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
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?