Using the ScriptResults status property

I want to use the status property of ScriptResults inside an if statement to send an e-mail if a script I am running fails for whatever reason. I imagine it looking something like this-

RunWithNewResults "TestScript.script"
repeat
if (Running)
     wait 120
else if (Failed)
     sendmail(blah)
     end repeat
else if (Success)
     end repeat
end if

the problem is, I’m not sure how to access the status property of ScriptResults(“TestScript.script”) and compare it in the if statement.

Here is an example:


RunWithNewResults ?InitialTest? 

put the result into Outcome 

// If the result of ?InitialTest? is not "Success"
if the status of Outcome is not ?Success? then 
    SendMail(....)
end if


Awesome, thank you. IN addition, I need to be able to get the suite to run every morning, but I’m not sure how to use crontab or anything to do so, so basically I’d like to see how it’s done from the command line.

For cron jobs you can use a convenient utility called Cronnix.

Eggplant’s command line syntax as well as available command line options can be found in the “Eggplant Reference” manual. Type “Command Line” in the search field and the relevant pages should appear.

[quote=“EPJoK”]For cron jobs you can use a convenient utility called Cronnix.

Eggplant’s command line syntax as well as available command line options can be found in the “Eggplant Reference” manual. Type “Command Line” in the search field and the relevant pages should appear.[/quote]

Awesome again, that did the job perfectly. Now, how can I send a quotation mark via TypeText? There doesn’t seem to be a TypeText modifier for it, and just putting in there plainly doesn’t catch.



TypeText quote & "something" & quote

...or 

TypeText <<"something">>


Doesn’t seem to be working, here’s the line in question-

TypeText quote & mount_afp "afp://;AUTH=No%20User%20Authent@server/Public" /Volumes/guest & quote

I think the problem is the two sets of quotes, though if there are charactes in there screwing it up i didn’t catch let me know.

Check your syntax. I’m not 100% sure what you’re trying to type but the example below will place quotes around the string to be typed.


TypeText quote & "afp://;AUTH=No%20User%20Authent@server/Public/Volumes/guest" & quote

Note: The & operator concatenates two strings.


set string1 to "Hello"
set string2 to "Hunter"

put quote & string1 & string2  & "!" & quote -- "Hello Hunter!" 

If you move the quotation mark after “Public” to come after “guest” and insert another ampersand (&) after mount_afp it becomes valid (not sure if it’s exactly what you want, of course – that’s up to you to decide):

 TypeText quote & mount_afp & "afp://;AUTH=No%20User%20Authent@server/Public /Volumes/guest" & quote

Just keep in mind that quotes have to be used in pairs, and you need to use & between all of the different parts you’re combining.

I strongly recommend turning on the “Update colors continuously while typing” feature (found in Preferences -> Script -> Colorization). This will give you constant feedback as you type so you’ll know when the syntax is correct.

That almost works doug, the problem is that the text i need to type is this-

mount_afp "afp://;AUTH=No%20User%20Authent@server/Public" /Volumes/guest

Quotations and all, otherwise it doesn’t work. When i try to add those quotation makrs around the afp path, the line becomes invalid.

So there are really two pretty simple ways to approach it. You can either use an alternate quoting syntax like << and >>

typetext <<mount_afp "afp://;AUTH=No%20User%20Authent@server/Public" /Volumes/guest>>

or you can use the keyword quote which must be outside of your quoted strings and then join the strings with &

typetext "mount_afp " & quote & "afp://;AUTH=No%20User%20Authent@server/Public" & quote & " /Volumes/quest"

For more information you can review the SenseTalk Reference manual; Values chapter.