View Property Values


(Peter Arnold) #1

I can view local variables in Script Debugger, in a handler, if they are defined as local.
I don’t seem to be able to view script property values (variables that are defined as properties in a Script).
Is there a way of viewing these “property” variables?


(Shane Stanley) #2

If you step through this script:

property x : missing value
my doStuff()
on doStuff()
	local y
	set my x to 3
	set y to 4
	set z to 5
end doStuff

do you not see x in the Variables list?

(Peter Arnold) #3

Hi ShaneStanley,

Thanks for the suggestion. It helped me identify the problem and it is a little more involved - not sure what is broken where (is it AppleScript, ScriptDebugger, pilot error = me). Something is really wrong here - or I do not understand it.

use AppleScript version “2.5”
– use framework "Foundation"
use scripting additions

on initialize()
script xyz
property x : "missing Value"
on doStuff§
local y
set x to p
set y to 4
set z to 5
set z to 6
end doStuff
end script
end initialize

local d
– local a

set a to initialize()
set b to initialize()
tell a to doStuff(3)
tell b to doStuff(44)
set d to 2

Works as expected - Script Debugger shows properties and variables variables as expected.

If I uncomment “-- local a”

If I then uncomment “-- use framework “Foundation””

Conclusion - do not use local when instancing objects.

(Shane Stanley) #4

Interesting. The combination of the local declaration and the use of ASObjC seems to be resulting in an unexpected type being returned – I suspect it’s something like a descriptor containing a pointer to the original descriptor. Whatever, it shouldn’t be happening.

(Peter Arnold) #5

I agree. However I have a work-around to avoid the issue. Just have to remember to use it.