Calling a Script from another Fails

I have been writing scripts in Script Debugger (SB)recently and have run into an issue that is probably an SB issue but thought I would ask here in case.

the problem is if I call a script from SB that was written in SB it fails. If I call the same script written in Script Editor from a script written in SB it works fine.

This is the script written in Script Editor being called from SB

--PosWindowsDivCap
--For testing Excel left half left display, (Finder top right, ScriptDebugger bottom half ) of left display , Safari whole of Right Display
my PosWindowsDivCap()

on PosWindowsDivCap()
	tell application "Finder"
		set WinB to get bounds of window of desktop
		log WinB
		set WinL to item 1 of WinB --Left
		set WinT to item 2 of WinB --Top
		set WinR to item 3 of WinB --Right
		set WinB to item 4 of WinB --Bottom
	end tell
	if WinL < 0 then --WinL <0 then Menu Bar on Right Screen
		tell application "Microsoft Excel" to set bounds of window 1 to {WinL, WinT, (WinL + WinR), WinB} --Whole left Display
		tell application "Script Debugger" to set bounds of window 1 to {((WinL * -1) / 2), WinT, WinR, WinB} --Right half right Display
		tell application "Safari" to set bounds of window 1 to {WinL + WinR, WinT, (WinR / 16) * 9, WinB} --Left 56%
	else --WinL =0 Menu bar on Left Screen
		tell application "Microsoft Excel" to set bounds of window 1 to {WinL, WinT, (WinR / 2), WinB}
		tell application "Script Debugger" to set bounds of window 1 to {(WinR / 4) * 3, WinT, WinR, WinB}
		tell application "Safari" to set bounds of window 1 to {WinR / 2, WinT, (WinR / 6) * 5, WinB}
	end if
end PosWindowsDivCap




MitchBVI. I’m not able to test your script but thought I would mention one issue FWIW. In the thread linked below, Nigel refers to “window of desktop” as a relic from the past which has just happened to work up till now. I suspect this is not the cause of the error but it’s probably worth trying one of the supported alternatives.

https://macscripter.net/viewtopic.php?pid=203998

Hi Peavine

It has nothing to do with the actual commands in the script that is called. The following script written in Script Editor (SE) and called from a script written in Script Debugger (SDB) works.

my TestaCall()
on TestaCall()
    display dialog "Hello Call"
end TestaCall

the calling script

set myscript to alias "Users:petermitchell:Dropbox:Applescript:DividendCaptureReconstruct:TestaCallSE.scpt"
run script myscript

If I write and save the 1st script in SDB and call it from the 2nd script it hangs. In fact the called script opens in SDB with a yellow bar near the top and I have to force quit to get out of it.

I saved your script (using Script Debugger) on my desktop, with name “Untitled.scpt”. Then I ran following (again, using Script Debugger) and it worked without any issue:


run (load script alias "HARD_DISK:Users:123:Desktop:Untitled.scpt")

So, how you call the external script?

NOTE: my Script Debugger 7 (v7.07) has permissions to control Finder, Excel and Safari

Not sure what to say. However I have found that if I load a script written in Script Editor into Script Debugger and save it, it does not always have the SB logo . It then runs OK.

Cannot work out how to provide screen shots which would show what I mean.

It might depend on whether the script is saved with debugging on or off.

Please check.

Brilliant thats the issue, thanks very much.
Now realize that the debug logo on the file icon tells me the file is saved with debugging on. Thats a very useful piece of information.