Hey folks I’m a Applescripting newb and cannot figure something out. Is there a way to create a variable that is accessible through various sub-routines within the script? Here’s a code snippit:
on incrementProgBar(windowName, displayData, dName) set counter to counter + 1 tell application "ProgBar" tell text field "field_one" of window windowName to set contents to displayData tell progress indicator "prog_one" of window windowName to set content to counter tell text field "field_two" of window windowName to set contents to dName end tell end incrementProgBar
That sub routine gets called multiple times from the main script body and from other sub routines, but it errors out with saying ‘counter’ not defined or some such error.
In the main body of the script the very first thing I do is
global counter set counter to 1
so why would the sub routines not have acced to it?