How do I Debug Applescript studio events in the script editor

I’m not understanding how one debugs code in applescript studio.

Frequently I cant figure out what the exact object that got handed into an event handler is. and thus I’m often asking for the wrong property and get an error. how do I peak at what the object is???

I cant just say
disply dialog name of theObject
as frequently this causes an error in itself.

for example, if I mistakely assumed I was getting a table view and instead my object was a scroll view then how do I learn it’s a scroll view?

is there some way to dump and display the identity (class hierarchy) of a variable from the program.

Script editor is supposed to be helpful with it’s logging window for figuring some of this out.
But When I try to move my scriptstudio scripts over to “script editor.app” to try to get a peak they dont run because script editor does not have the dictionary of all the applescript studio interface objects. How can I use the debugging features of script editor on subroutines clipped from applesciript studio event handlers.

I suspect there is some way to insert a header into script editor to tell it to use the terminology for my application or for apple script studio but I dont understand the instructions on how to do this.

I think you need to put in some line like

use the terms from myCursedApplication

or maybe

Tell myCursedApplication

But then I’m bewildered. How does it know where to find myCursedApplication ? might there not be multiple folders with applications all called myCursedApplication. How would it know that it’s suppose to use the one that I have open in Xcode?

I don’t get it!!

If you’re running your application from inside Xcode, then you can use Xcode’s logging window instead.