• 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: Script Debugger 6 Officially Released
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Debugger 6 Officially Released


  • Subject: Re: Script Debugger 6 Officially Released
  • From: Shane Stanley <email@hidden>
  • Date: Sat, 18 Jun 2016 10:14:31 +1000

On 18 Jun 2016, at 12:31 AM, 2551phil <email@hidden> wrote:

It’s a shame, though. Personally, I preferred the idea of the “flatten” feature. Simpler and quicker. It’d also be quicker to debug as you could see exactly what library code is being called. Doing it the “supported” way, you have to assume that the user hasn’t messed with the library script, but there’s no way to tell from the script they give you.

Loading copies into a bundle is also a "supported" way, and gives you a similar result. If you want simpler, the library use of a script is exposed to scripting, so you could put something like this in SD Scripts menu:

tell application id "com.latenightsw.ScriptDebugger6" -- Script Debugger.app
tell document 1
if script type is not in {script application, bundled compiled script} then
-- it's not a bundle; show error dialog or whatever
error number -128
end if
set theResult to compile document 1 without showing errors
if not theResult then
-- it didn't compile; show error dialog or whatever
error number -128
end if
set usedLibs to used script libraries
set libCount to count of usedLibs
if libCount is 0 then -- no libs, nothing to do
beep
error number -128
end if
set theFile to file spec
set embeddedLibs to embedded script libraries
set usedLibFiles to used script library files
end tell
end tell
try
set libsFolder to path to resource "Script Libraries" in bundle theFile
on error -- we need to make lib folder
set resFolder to ((theFile as text) & "Contents:Resources:") as alias
tell application "Finder"
set libsFolder to make new folder at resFolder with properties {name:"Script Libraries"}
end tell
end try
repeat with i from 1 to libCount
if embeddedLibs does not contain item i of usedLibs then -- check it's not already embedded
tell application "Finder"
duplicate item i of usedLibFiles to libsFolder with replacing
end tell
end if
end repeat

You could use this as a way of bundling before exporting as a run-only script. The Export Run-Only Script command has an option to make all then closed scripts, including libraries, run-only at the same time.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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: 
 >Script Debugger 6 Officially Released (From: Christopher Stone <email@hidden>)
 >Re: Script Debugger 6 Officially Released (From: Shane Stanley <email@hidden>)
 >Re: Script Debugger 6 Officially Released (From: 2551phil <email@hidden>)
 >Re: Script Debugger 6 Officially Released (From: Shane Stanley <email@hidden>)
 >Re: Script Debugger 6 Officially Released (From: 2551phil <email@hidden>)
 >Re: Script Debugger 6 Officially Released (From: Shane Stanley <email@hidden>)
 >Re: Script Debugger 6 Officially Released (From: 2551phil <email@hidden>)

  • Prev by Date: Re: set selection of a SD document to end?
  • Next by Date: en-dash, em-dash, and the like obtained from Safari tab names
  • Previous by thread: Re: Script Debugger 6 Officially Released
  • Next by thread: Re: Script Debugger 6 Officially Released
  • Index(es):
    • Date
    • Thread