Jump to content

Performing operations on the clipboard


leuce
 Share

Recommended Posts

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")

Link to comment
Share on other sites

...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]

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...