Monday, December 11, 2017

#1 2005-10-12 02:41:11 pm

julifos
Administrator
From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

Why won't my script work?

There is no easy answer to this one! Programs and scripts contain bugs, it's a fact of life. Even the most well-admired applications contain flaws (bugs) which make them sometimes fail unexpextedly, and your scripts usually will as well, especially in the learning stage.

Syntax, or the phrasing of the script, is a common reason why a script might fail to compile. For example:

Applescript:

display dialog {"The ", "End"}

will not run fine because the display dialog command doesn't understand how to display a list. Rewritten:

Applescript:

display dialog {"The ", "End"} as text

This will compile and run fine.

Usually the Script Editor will kindly hilite the line of code that forces it to fail. Examining this line is often all you need to figure out what happend; if not, tracing the script to that point will usually be necessary. Open the Log window (Controls > Open Event Log) and rerun the script to make tracing the chain of events simpler.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)