Saturday, October 1, 2022

#1 2006-09-01 07:36:41 pm

TheMouthOfSauron
Member
Registered: 2005-10-07
Posts: 7

Paste With Quotes Escaped

Whipped this one up to paste string constants containing quotes into the Script Editor. Can't seem to get it to work generally, though.

Applescript:

set TID to AppleScript's text item delimiters

set myclip to the clipboard as text

if "\"" is in myclip then
   set AppleScript's text item delimiters to "\""
   set t to every text item of myclip
   set AppleScript's text item delimiters to "\\\""
   set myclip to t as text
end if

try
   tell application "
Script Editor"
       tell front document
           set contents of selection to myclip
       end tell
   end tell
end try

set AppleScript's text item delimiters to TID

Model: PowerBook G4
Browser: Safari 419.3
Operating System: Mac OS X (10.4)


Filed under: Script

Offline

 

#2 2006-09-01 07:46:20 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: Paste With Quotes Escaped

That works fine for me…

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)