External debugging doesn't work

Hello guys,

I’m SD newbie. I’m trying to debug a simple AS invoked by apple mail rule. It is very simple using SD template and beep command. I cannot make it debugging the script (that’s why script is super easy). On one computer it will not even try to run SD. Just doesn’t do anything.

On second computer. It starts SD, but SD becomes immediately unresponsive and has to be killed using Force Quit.

I have script saved in debug mode, brake point set at display dialog. And I see just colored wheel spinning.

Any advice?

I have SD 6.0.3 and MacOs Sierra.

Thank you in advance.

Best regards,

Jan

UPDATE: On machine where it freezes happens following. When I have SD quit and invoke mail rule it tries to start SD, but it says: AppleScript debugging failed because Script Debugger is not available on this Macintosh.

Well - it clearly is available as I’m normally using it for editing scripts. Runs normally. I can debug normal scripts without issues. It even starts when double clicking on apple script…

I’m using Trial version.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

using terms from application "Mail"
    on perform mail action with messages messageList in mailboxes mbox for rule aRule
        beep
        beep
        beep
    end perform mail action with messages
end using terms from

There does seem to be an issue under Sierra.

In the “freezing” case, do you have Script Debugger in the Applications folder? It sounds like the Launch Services database is not up to date.

I think this may be the problem we are seeing:

http://mjtsai.com/blog/2016/09/30/sandboxed-launch-services/

I suspect that this means external debugging is not longer viable from Sandboxed applications. The Script Debugger OSA component is being loaded into the sandboxed Mail application, and can no longer find the Script Debugger application even though it is installed.

I can see that explaining the “freezing” case if Script Debugger isn’t in /Applications, but should all be fine if it is in /Applications? See #710.

Hello,

thank you for reply. I have SD in /Applications folder.

When I invoke mail rule without SD running I get that message + I can see following error in Console.

Detected missing constraints for . It cannot be placed because there are not enough constraints to fully define the size and origin. Add the missing constraints, or set translatesAutoresizingMaskIntoConstraints=YES and constraints will be generated for you. If this view is laid out manually on macOS 10.12 and later, you may choose to not call [super layout] from your override. Set a breakpoint on DETECTED_MISSING_CONSTRAINTS to debug. This error will only be logged once.

Jan

Clearly, there has been a regression with macOS Sierra which causes external debugging in sandboxed applications to fail. Leave this issue with us. We’ll have to investigate further and see if a solution can be developed for the next Script Debugger maintenance release.

OK - When is it planned? I’d like to by SD, but if it doesn’t debug mail rules it will not be so useful as I expect to develop mainly scripts for Mail. And my trial will expire in the meantime.

It’s more a question of whether changes in Sierra even support this sort of live debugging with sandboxed applications reliably.

But that doesn’t mean you can’t debug Mail rule scripts. You can still trigger them manually, passing your own parameters. For example, you can call a Mail rule script like this:

-- code to test the Mail rule script:
tell application "Mail"
	set theSel to selection -- selected emails will be used for test
end tell
using terms from application "Mail"
	perform mail action with messages theSel in mailboxes (missing value) for rule (missing value)
end using terms from

-- the Mail rule script itself:
using terms from application "Mail"
	on perform mail action with messages messageList in mailboxes mbox for rule aRule
		set theSubject to subject of item 1 of messageList
		display dialog theSubject
	end perform mail action with messages
end using terms from

Because this doesn’t rely on a Mail rule being triggered, it’s often a more convenient method of testing anyhow.

And you can similarly pass other parameters:

tell application "Mail"
	set theSel to selection -- selected emails will be used for test
	set theRule to rule "Name Of Some Rule"
	set theMailbox to mailbox "Name Of Some Mailbox"
end tell
using terms from application "Mail"
	perform mail action with messages theSel in mailboxes {theMailbox} for rule theRule
end using terms from
1 Like

Thank you very much for suggestion. I’ll try it.

Hello,

I’m back. It actually doesn’t work. Whatever I do it throws Can’t make … into the expected type.

tell application "Mail"
set theSel to selection – selected emails will be used for test
set theRule to rule "mojeo2"
set theMailbox to mailbox “INBOX” of account "Gmail"
end tell
using terms from application "Mail"
perform mail action with messages theSel in mailboxes {theMailbox} for rule theRule
end using terms from

Can’t make «class mbxp» “INBOX” of «class mact» id “D5275777-B0DD-4F93-9CA7-7DCB4DDA4160” of application “Mail” into the expected type.

Whatever I do it keeps comming back for different classes.

It is so annoying.

Regards,

Jan

It looks like you don’t have the rule handler in your script. Try the first snippet I posted above, and tell me if it works.

Hello,

you are right. I’ve made it working. SD is a great tool. My problem turns to be related to Mail issue with saving attachments with applescript. Keep getting -10000 error whatever I do.

Thank you for help.

Jan

Is there any update on this? I am running SD8 trial on BigSur.

Running the internal debug for DEVONthink works fine. External debug with script saved as compiled and debug mode on doesn’t jump into SD.

Am I missing something?

Thanks for your support
Manfred

The security changes introduced into macOS over that last few versions render Script Debugger’s external debugging unusable. We removed the feature in Script Debugger 8.

Hi Mark, thanks for the clarification. As I have found the workaround it is not too bad.