• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Scripting Script Debugger
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Script Debugger


  • Subject: Re: Scripting Script Debugger
  • From: "Stockly, Ed" <email@hidden>
  • Date: Tue, 27 Jul 2010 17:09:49 -0500
  • Acceptlanguage: en-US
  • Thread-topic: Scripting Script Debugger

Title: Re: Scripting Script Debugger
This might help:

tell
application "Script Debugger 4.5"
    
tell its
script window 1
       set theText to script source of its document
       set {tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
        
set
theText to text items of theText
       set AppleScript's text item delimiters to {return & return}
        
set
theText to theText as text
       set AppleScript's text item delimiters to tids
       set script source of its document to theText
   end tell
   set
AppleScript's text item delimiters to tids
end tell

Couple changes:

Uses text item delimiters to add the second return, much better than a repeat loop.

Remove the “reference to “ on the command to set the script source. That was probably the issue.

Also, you can’t run this from SD, because you can’t change a script while it’s running.

HTH,

ES

On 7/27/10 11:48 AM, "Tommy Bollman" <email@hidden> wrote:

Hello.

I'm trying to write a script which doublespaces the lines of the source text, but I'm having a problem with setting the altered source text back. -Any of you guys who knows the right incantation?


This is really work in progress so I only need help with setting the source text to theText

set AppleScript's text item delimiters to ""
set frontAppBid to bid's frontmostBundleId()
haltIfAppIsNotSupported(frontAppBid)
-- return
try
tell
application id frontAppBid

tell its script window 1
activate

if frontAppBid is "com.apple.ScriptEditor2" then
set
theText to every paragraph of text of its document 1
else if frontAppBid is "com.latenightsw.ScriptDebugger" then
set
theText to script source of its document

end if
set
{tids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set theText to text items of theText
-- display dialog "here"

repeat with aPar in theText
set contents of aPar to "" & aPar & return
end repeat
-- set AppleScript's text item delimiters to tids
set theText to theText as text
tell its document

set script source of it to a reference to theText
-- the last thing I tested for
end tell -- of script window 1 to theText
end tell
set
AppleScript's text item delimiters to tids
end tell
on
error e number n
tell me
activate
display dialog
e & ":" & n
end tell
end
try






      

Best regards







Tommy Bollman

--------------------------------------------------------------------------------------------------

Mollison's Bureaucracy Hypothesis:

If an idea can survive a bureaucratic review

and be implemented it wasn't worth doing.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Scripting Script Debugger (From: Tommy Bollman <email@hidden>)

  • Prev by Date: Re: Password Copy & Paste
  • Next by Date: Re: Sort Array by Column X
  • Previous by thread: Scripting Script Debugger
  • Next by thread: Password Copy & Paste
  • Index(es):
    • Date
    • Thread