Tinderbox 7 Icon

AutoFetchCommand


Attribute Data Type: 

Attribute Default Value: 

Attribute Group: 

Attribute Purpose: 

Attribute Inherited from Preferences?   

Attribute Read-Only? 

Attribute Intrinsic? 

Attribute First Added: 

Attribute Altered: 

 string   [other string-type attributes]

 (not set - empty string)

 Net   [other Net Group attributes]

 Import configuration

 No

 No

 No

 Baseline

 


Action code expression used for post-import processing of $AutoFetch content.

Where is the working directory location assumed for executing scripts?

If $AutoFetchCommand is empty (the default), $AutoFetch behaves as normal; the contents of the specified URL are stored in the note's text.

$AutoFetchCommand is an action, and thus uses the same syntax as agent actions and rules. It runs when the file is loaded, exported, and possibly during idle period s while the document is open. Typically, $AutoFetchCommand will invoke an outside program, perhaps fetching some information from the user's hard disk or network. For example:

$Text=`"ls ~/Documents"; 

$Text=runCommand("echo | ls ~"/Documents); 

either of the above will replace the text of the note with a list of all the files currently in the user's Documents folder (the latter syntax is the recommended choice).

Delivered=`"myDatabaseQuery $TrackingID"; 

will run the shell script myDatabaseQuery in the user's OS home folder, passing it the value of the note's $TrackingID attribute as an argument.

When accessing the command line this way the current working directory is '/', i.e. the root of the current volume. Thus if calling scripts elsewhere (e.g. in your own user account's documents) remember to prefix an appropriate path to the script.