7 Replies Latest reply: Dec 9, 2007 2:14 PM by dev_sleidy
Frenchie4016 Level 1 Level 1 (0 points)
Is there any way to make the script editor work in a debug mode so that I can see it step through the code?

Thanks!

G4 MDD, Mac OS X (10.5)
  • dev_sleidy Level 4 Level 4 (1,570 points)
    'Is there any way to make the script editor work in a debug mode so that I can see it step through the code' - ...

    Apple's 'Script Editor' - no.
    'Script Debugger' - yes.
  • Frenchie4016 Level 1 Level 1 (0 points)
    Well that's a bit more than I can swallow right now. Don't suppose you know of anything cheaper?
  • Hiroto Level 5 Level 5 (5,590 points)
    Hello

    I think it depends upon what you want the 'debug mode' to provide.

    Script Editor has built-in event log function, which will let you follow the issued events in sequence. However, not every AppleScript statement should necessarily issue AppleEvent event.
    E.g. statement such as 'set x to pi ^ 2' won't trigger any event, and consequently no entry will be recorded in Script Editor's event log for this statement. Meanwhile statements such as 'path to me' or 'tell application "Finder" to get version" will issue events, which are to be recorded in event log.

    If this level of event log function suffices, you may use Script Editor, which is part of standard installation of Mac OS and Mac OS X.
    In fact, I've been solely using Script Editor since the first day of my AppleScript coding and never felt that I need more sophisticated environment. And I rarely use event log function. When I want to see the intermediate state of my script, I check it by inserting 'return x' (x is the value or object to be investigated) at appropriate point in the code and see the result window. This way I've written thousands of scripts.

    Good luck,
    H

    PS. You may also try Smile regular edition, which is free AppleScript coding environment made and distributed by Satimage-software, France. (Full edition requires paid registration.) Don't know what kind of 'debug mode' it provides, if any, but at least it should have event log function.

    http://www.satimage.fr/software/en/downloads/index.html
  • Frenchie4016 Level 1 Level 1 (0 points)
    Hiroto,

    Thanks for the feedback! The 'return x' idea just might work since I'm just trying to find out if certain code is being executed or not. I'll give it a try....
  • red_menace Level 6 Level 6 (14,760 points)
    You can also use a log statement to add an entry to the event log.
  • dev_sleidy Level 4 Level 4 (1,570 points)
    Or, one could also use ...

    say "x" -- where 's' is 1, then 2, then 4, etc.

    ... and / or ...

    display dialog (x & return & y & return z) buttons {"OK"} default button "OK" -- Or similar.

    ..., where 'x', 'y', and / or 'z' are ones' own messages.

    'say ...' is used for determining sequences.
    'display dialog ...' is used for determining the value of variables.
  • dev_sleidy Level 4 Level 4 (1,570 points)
    Oops.

    Typographical errors corrections:

    say "x" -- where 's' is 1, then 2, then 4, etc.

    ... should have been ...

    say "x" -- where 'x' is 1, then 2, then 3, etc.