Also, the very first dialog, which translates to “Run the script with the script open in the editor.”, should be rephrased to make clear it must be Script Editor, not e.g., Script Debugger.
I think there’s no need to add all the markings where you made edits, and even include the original. With the link to the original at the top anyone who really wants to see the changes can use a text compare tool, which displays the diffs much better, while your version makes it harder to read without any benefit for an English reader. Just mention that you made changes at the top, and that should be enough.
Most of my automation Scripts are mede for Script Editor. You can easily modify to support Script Debugger. Original script is made for making WordPress post.
This script is made to be called from Script Menu.
Are you sure you can use your script with Script Debugger as the one holding the to-be-printed script? When I changed pName to use SD7 (“com.latenightsw.ScriptDebugger7”), it failed with errors (running your script in SD7 works fine). Have you tested this with SD8 (which I don’t have a license for yet, because I’m happy with 7, which I use still on High Sierra)?
•Update•
I had to replace
tell current application
with
tell application id pName
Then at least one issue went away. But there’s also an error when I set pName for SD7, with the term set curLang to name of language of aInfo (it seems that SD7 doesn’t support “name of language …”, I think).
@Piyomaru I have also fixed a few small issues, such as the one with the tell current application and added a Reveal button to show the html file in Finder.
But, here’s something else that doesn’t work with scriptDebugger:
set textList to every attribute run of front document
set textList_ref to a reference to textList
set colorList to color of every attribute run of front document
set colorList_ref to a reference to colorList
This is what the beginning of the attribute run for the run handler in this script looks like:
We can detect each AppleScript’s lexical elements by its color by using OSAScript functions.
We can get NSAttributedStrings data from AppleScript file.
It may grow 300 or 500 line AppleScript.
EDIT: Here’s a probably incompetent attempt to do that:
tell application id "com.latenightsw.ScriptDebugger8" -- Script Debugger.app
tell document 1
if file spec is not missing value then
save
else
display dialog "Script must be saved first."
return
end if
end tell
set posixPath to path of document 1
end tell
tell application id "com.apple.ScriptEditor2"
open posixPath
end tell
Just a little code “critique”: It’s not smart to use application id "com.latenightsw.ScriptDebugger8" if it could also run in earlier SD versions. I think it’s better to use application "Script Debugger" here.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set whichWindow to 1
tell application "Script Debugger"
tell current document of script window whichWindow
set sdScriptModified to its modified
set sdScript to its source text
set sdSavedFile to its file spec
end tell
end tell
tell application "Script Editor"
if not sdScriptModified then
open sdSavedFile
else
set seDocument to make new document at beginning
tell seDocument
set its text to sdScript
compile
end tell
end if
activate
end tell