Help with Property List and Handler (Nested Handlers)

I am trying to automate the completion of multiple forms by using a Property List and Nested Handlers. The idea is to have a handler that will select relevant forms (one at a time) from the main page. The main page lists the forms, and on clicking the selected form’s button, will follow the prompt to complete the form, and returning to the main page, will proceed to the next form and so on.

My script, below, is only executing the completion of the first form, instead of continuing to select the next form. Any ideas what I am missing? Thank you!

I have three scripts related to this.

First I have the property list like so:
//Forms/Form_PropertyList

to Form_Items_Handler
set Form_Choice to {
	Form1:{Icon:"Image/Icons/Form1",Button:"Image/Button/Form1",RunMe:False},
	Form2:{Icon:"Image/Icons/Form2",Button:"Image/Button/Form2",RunMe:False},
	Form3:{Icon:"Image/Icons/Form3",Button:"Image/Button/Form3",RunMe:False},
	Form4:{Icon:"Image/Icons/Form4",Button:"Image/Button/Form4",RunMe:False},
	Form5:{Icon:"Image/Icons/Form5",Button:"Image/Button/Form5",RunMe:False}
}

put Form_Choice
return Form_Choice
end Form_Items_Handler

Then I have the outer handler, that will look for the selected form, and inside this handler, will call the inner handler, which is the form’s button.

//Forms/Form_Add_Handler

On Select_Form_Item Form_Choice, Form_Order
put Form_Choice
put Form_Order
Log "Begining Form Selection"
//Enters all your data for you
repeat with each item FormVar of Form_Choice's (Form_Order)
	repeat until imagefound(FormVar's Icon)
		typetext pagedown
		if the repeatindex > 10
			throw "Unable to find:"&&it
		end if
	end repeat
	click image:(Form_Choice's ("Form"&the repeatindex)'s Button),searchrectangle:[imagelocation(Form_Choice's ("Form"&the repeatindex)'s Icon)+[-100,-30],imagelocation(Form_Choice's ("Form"&the repeatindex)'s Icon)+[750,30]]
	if FormVar's Button = "Image/Button/Form1"
		Run "Forms/Form_Add_Handler".Form_one
		Exit all
	end if
	if FormVar's Button = "Image/Button/Form2"
		Run "Forms/Form_Add_Handler".Form_two
		exit all
	end if
	if FormVar's Button = "Image/Button/Form3"
		Run "Forms/Form_Add_Handler".Form_three
		exit all
	end if
	if FormVar's Button = "Image/Button/Form4"
		Run "Forms/Form_Add_Handler".Form_four
		exit all
	end if
	wait 1
end repeat
end Select_Form_Item

For each form, there are specific scripts to complete the data entry.

I have the main script that will call set the property list to the handler and run the handler. For example, if I want to complete Form 1 and Form 2, this is how I call it.

set Form_Choice to "Forms/Form_PropertyList".Form_Items_Handler
set Form_Order to ["Form1", "Form2"]
Run "Forms/Form_Add_Handler".Select_Form_Item Form_Choice, Form_Order

Hey Jennie. I believe the problem is your “Exit All”. It will exit all handlers. So it figures it’s done after the first form.

1 Like

As a solution you could probably let it just evaluate the rest of the “ifs” and sometimes it would find the next one in the same loop, which i think is harmless.
Or, you could use "else if"s.
Or you could get even fancier with another layer of handlers or change your whole if design around. As it is I’ll bet you could solve everything just by deleting the "exit all"s.

1 Like

Hi Logan - I think getting rid of the “exit all” works!!
BUT, Eggplant kept on crashing when I ran this script?!

Its probably user error :wink: jk.

Assuming you’ve gone as far as rebooting your whole system…

Check the script-checker for ominous warnings and errors.

Reconnect/reboot your SUT.

Report exactly at what point in crashes. Same place every time?

Any error message?

If you still have trouble, try renaming your suite config file (append the word “backup” or something). Then fire up EPF and let it build a new config file. The config file does include some odds and ends that might be important to you, so do keep that backup and keep it in mind if you have some odd issues afterwards. Stuff like suite.variables and junk.

Do the config file stuff with all Eggs closed off course.

1 Like

I see this topic is an amusing Saturday’s diversion for you, Logan :wink:
I did what you suggested above, and it is running smoothly :smiley:
Thank you so much for all the help!!!