My CleanUp Script hates me.

I’m a newbie for shurbie! I don’t really understand the subtleties of getting my CleanUp script to work. I thought I got it but it left me along with my coffee buzzzzzzz…

Ok. So. I’m testing a Windows application ( www.tawala.com login and download the Designer.) and when it comes to Exiting the application it has a pretty standard File Menu. FILE then EXIT will work just fine and if you’ve done some work you may get a save Dialogue asking to you if you want to save your work. So… I’m running my scripts from a master which works great. But when one of my tests fail I want CleanUp to run, close the application and run the next test.

All this works swimmingly except for the actual CleanUp script. It runs it just doesn’t do things in the way I would expect it to…

That is.

It should first try to click on “FileMenu” – an image that opens the Windows File Menu

Then Click on “Exit” – an image that Clicks on Exit to close the application.

AND… if the Save Dialogue comes up… I want it to simply click “No” – an image that will click NO in the save dialogue.

Seems easy huh? I still don’t think I understand the IF vs. Else IF… that must be it… It clicks on FileMenu but it never clicks on Exit. Odd. It’s been explained to me by the finest minds but I think I need to hear it another way… possibly involving 2nd grade grammar… or I need some punch and pie to make it stick.

Here is the offending master script in total and the single script I’m asking it to run and fail just so I can get CleanUp to work. Oh, and anyone can download and test are app… it’s in Alpha… check out www.tawala.com and you can see the DESIGNER application… if it helps… help!

// Master Script

put ( “442_443_444” ) into scriptList

repeat for each item in scriptList
try
put it
run it
catch
// this will place the exception name into a variable
put exceptionName() & exceptionreason() into var
// this will write the value of ‘var’ to a file of your choosing
put var & return after file “~/Desktop/logfile.txt”

	// increment of yes will ensure that you don't replace existing images
	captureScreen(name:var, increment:Yes)
	cleanUp
end try

end repeat

// clean up using if else if…
to CleanUp
if imageFound(“FileMenu”) then
click foundImagelocation()

else if imageFound("Exit") then
	click foundImageLocation()
	
else if imageFound("No") then
	click foundImagelocation()
end if

end CleanUp

// End Master Script

// Test Script called 442_443_444

set the remoteWorkInterval to 1.1
set the mouseMoveSpeed to 8
set the nextKeyDelay to 0.15

// This just clicks on a shortcut on the desktop to launch the application
DoubleClick “StartDevXP”

TypeText “\af\A”
TypeText “\r”
TypeText “w”
TypeText “f”
TypeText “\ai\A”
TypeText “t”
TypeText “Please Provide your email address. _______________”
TypeText “\ca\C”
// Click “FormatClick”
// Click “ItalicClick”
TypeText “\cb\C”
TypeText “\cu\C”
TypeText “\ci\C”
WaitFor 3.0, “BoldItalicsUnderlineConfirm”
// close
TypeText “\af\A”
TypeText “\r”
TypeText “x”
// Don’t Save
Click “DontSave”
// this returns the desktop icon to the deselected state so the next test can find it
Click “ClickBlueDesktop”

hey Bass-o-matic. Welcome to Eggplant :smiley:

Drop the else from your if statements. I’m guessing it clicks the file menu and then just stops. Change it to:



to CleanUp
if imageFound("FileMenu") then
click foundImagelocation()
end if

if imageFound("Exit") then
click foundImageLocation()
end if

if imageFound("No") then
click foundImagelocation()
end if
end CleanUp 

an else if statement only evaluates if the previous if or else if are false. The time you would want to else if would be something like finding quit on mac or exit on windows

if imageFound("quit") then
click foundImageLocation()
else if imageFound("exit") then
click foundImageLocation
end if

Hope this helps!

Allen

PS–The “then” keyword isn’t necessary. I only stick it in on the forum since indenting blocks of code is a pain.

That was easy! Thanks so much! So, are they any Eggplanters in Texas? Austin specifically… and how on earth would I find out? The Mysteries of life never cease…

I think it would be super useful to meet other Eggies. I could start another string I suppose… hmmm… is there a Yahoo Group or something? Hmmmm? A weekly meeting at a pub? I’m sure there are training seminars but my issues are sporatic and continuous.

I mean that would allow people to actually have a little programing party… not that this forum isn’t useful… I’m rambling…

you know what I mean. Or is it just ill conceived?

Hello,

I’m located in Dallas, and on occasion will visit the Austin area for training classes in the Austin TX area. Yes, there are plenty of Texan Eggplant users :slight_smile: EggFests (informal gatherings after class times) are now a standard practice during the first evening of the Eggplant 101, 201 and Advanced Sensetalk (AdvST) classes. As always we have classes scheduled every 4-8 weeks. If you are interested, please contact the Redstone Software Sales Group sales@redstonesoftware.com for availability and pricing. There is also the IRC channels #sensetalk and #eggplant, on the irc.freenode.net network.

Cheers

[quote=“Bass-O-Matic”]
I mean that would allow people to actually have a little programing party… not that this forum isn’t useful… I’m rambling…

you know what I mean. Or is it just ill conceived?[/quote]

The training is really well done–I highly recommend that everyone get to classes if they can! Jay, Doug, and Todd are the greatest–and The “Eggfests” are great fun and really useful. I learned a lot when I attended.

You can also chat me up, just buzz me on google chat (my user id is allen.fisher).

Allen aka FHQWHGADS (say it with a flourish)