I would to like to see the Events when running droplets or stay open scripts from script debugger 4.0.8 . I have the apple event log window open but it only shows – started
– stopped. How can I troubleshoot a droplet if I don’t know what events are happenning when running a droplet?
One solution to consider is adding a handler that writes to a log file, placing handler calls at any and all places you wish to collect data:
--This is a droplet from the Hanaan Rosenthal text, number 23-02. The run statement at the bottom is executed if someone double clicks onto the icon, not knowing what it will do.
--It is saved as an application, then it works as a droplet.
on open the_items_list
set folder_count to 0
my WriteLog(folder_count as string)
set file_count to 0
my WriteLog(file_count as string)
set item_count to 0
my WriteLog(item_count as string)
repeat with the_item in the_items_list
if folder of (info for the_item) then
set folder_count to folder_count + 1
my WriteLog(folder_count as string)
else
set file_count to file_count + 1
my WriteLog(file_count as string)
end if
end repeat
display dialog "You dropped " & folder_count & " folder and " & file_count & " files"
end open
on run
display dialog "Drop files and folders on this icon"
end run
to WriteLog(x)
set LogFile to (path to desktop as Unicode text) & "DropletLog.txt"
set a to open for access LogFile with write permission
write x & return to a starting at eof
close access a
end WriteLog
This handler accepts a string and writes it to the log file as a single line with a return. You can construct your strings however you wish to include whatever specific data you want to know about.
Good luck, I hope this helps,
Script Debugger can trace scripts step by step while displaying all variables
StefanK
Where?
In Script Editor there is the Event log tab but that doesn’t work when scripts are saved as applications. So I’;m guessing the equivalent in script debugger is the Apple log window.
Menu Script > Enable Debugging (⇧⌘D)
and then either ⌘Y (Step over) or ⌘I (Step into)