Jump to content
Sign in to follow this  
leuce

Performing operations on the clipboard

Recommended Posts

leuce

G'day everyone

I have a script which does certain operations on a piece of text (mostly find/replace). I do this by opening the text in a word processor and using the word processor's GUI features to perform these operations. This is a slow method, however, and I was wondering whether it is possible to have an AutoIt script perform such simple tasks (as well as regex find/replace tasks) directly on the clipboard. This would be much, much faster. I have to warn you, though... the format of the clipboard would probably be OpenDocument content.xml :-).

Thanks in advance

Samuel

PS I have managed to increase the speed of the find/replace operations using the clipboard, but it is still relatively slow:

WAS:

; Call the Find/Replace dialog.

Send("^f")

; Paste find segment into find field.

WinWaitActive("Find")

Send($FileTextARRAY1[$i])

NOW:

; Call the Find/Replace dialog.

Send("^f")

; Paste find segment into find field.

WinWaitActive("Find")

ClipPut($FileTextARRAY1[$i])

Send("^v")

Share this post


Link to post
Share on other sites
herewasplato

...I have a script which does certain operations on a piece of text (mostly find/replace).

Consider opening the text with FileRead() then using StringReplace() followed by FileWrite().

You said "mostly". What else are you doing to this text?

...the format of the clipboard would probably be OpenDocument content.xml :-).

If you cannot figure out how to use the AutoIt3 functions mentioned above with your xml doc, then consider posting an example of the xml doc and the strings that you want replaced...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites
seandisanti

G'day everyone

I have a script which does certain operations on a piece of text (mostly find/replace). I do this by opening the text in a word processor and using the word processor's GUI features to perform these operations. This is a slow method, however, and I was wondering whether it is possible to have an AutoIt script perform such simple tasks (as well as regex find/replace tasks) directly on the clipboard. This would be much, much faster. I have to warn you, though... the format of the clipboard would probably be OpenDocument content.xml :-).

Thanks in advance

Samuel

PS I have managed to increase the speed of the find/replace operations using the clipboard, but it is still relatively slow:

WAS:

NOW:

does auto it window info give you any information on the control that originally contains the text? if so, you could do something like this (i'm using notepad)

$thetext = ControlGetText("Untitled - Notepad","",15)
;...string manipulation code here
ControlSetText("Untitled - Notepad","",15,$thetext

that usually does everything i need about instantly

Share this post


Link to post
Share on other sites
leuce

You said "mostly". What else are you doing to this text?

Actually, it would be *only* find/replace. But you get simple find/replace, and you get simple with regex, and you get complex with regex. If I can do simple, then that'd be fine, but if I can do regex, that that'd be super :-).

I'll try some of the other things you've mentioned.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×