philostein | 21 Apr 2012 07:33
Picon
Gravatar

Re: Need Help! How to use QS to copy, then paste edited text

Oops, no HTML. Remove the '<pre><code>' parts.

On Saturday, April 21, 2012 2:31:20 PM UTC+9, philostein wrote:

Try saving this code in AppleScript Editor and making a trigger for '[script]⇥Run' Copy the URL from somewhere, switch to the target app and hit the shortcut.

<pre><code>try
set _atid to AppleScript's text item delimiters
set _text to the clipboard as text
set _delimiter to ""
if _text contains "http://" then set _delimiter to "http://"
if _text contains "https://" then set _delimiter to "https://"
set AppleScript's text item delimiters to _delimiter
set _text2 to text items of _text
set AppleScript's text item delimiters to _atid
set _text2 to _text2 as text
set the clipboard to _text2
delay 0.5
tell application "System Events" to keystroke "v" using command down
on error a number b
set AppleScript's text item delimiters to _atid
activate
display dialog a
end try

</code></pre>


On Saturday, April 21, 2012 12:19:53 PM UTC+9, Aseem Kishore wrote:
Any help!?

On Apr 18, 1:09 pm, Aseem Kishore <aseem1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi all,
>
> I'm new to QS and I need some help. I'm trying to figure out a way to
> copy some text, for example a URL likehttp://www.google.com, have QS
> automatically edit it, then paste it into another app with the edited
> version, i.e.www.google.comwithout the "http://".
>
> How can I do this? I'm guessing there has to be some script or code
> somewhere to do the editing, but I have no clue how to do this or how
> to set it up in QS. Any step by step assistance would be greatly
> appreciated.
>
> Basically, I want to copy a string, modify the string by removing some
> characters from the front of the string, and then have that saved
> backed to the clipboard so when I paste, it's already edited.
>
> Thanks for your help!
>
> AK

Gmane