Floccer

How to restart script

2 posts in this topic

Hellou

I have created macro script to fill program fields from excel. It is working pretty well but i the software is bugging me because we are forced to use these citrix software and i can't select or validate fields well.

There are times when my imagesearch fails for various reasons and i would like to restart my program by clicking hotkey.

Below is shortened script of how my program works. Functions basicly just fills different screens from programs but if it fails i am unable to continue and i must restart entire program. I know i should create more checks but i have been rather lazy. And as much as i know about citrix software, that can't be well checked otherways than imagesearch.

So my question is this. If my program stops in function 3, how can i exit from start function and go to while loop to wait to be started over via hotkey by the user? For now if i restart entire script it will open new excel. I probably could check if that excel is open to not open a new one if script is restarted.

 

HotKeySet("^{F9}", "Start")

Func Start()

    function1()
    function2()
    function3()
    function4()
    etc...

endfunc

While 1
    Sleep(100)
WEnd

 

Thanks for any help in advance :)

Share this post


Link to post
Share on other sites



I added an adLIbRegister at the beginning of the function, which will execute another. 

In the second function, I did a check for popups or something to indicate a failure, then you can return a value.

While that value is True, continue or however you want to state it

if all functions complete adLibUnregister

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now