Sign in to follow this  
Followers 0
CadDeVille

Noob help needed with if...Then..Else

5 posts in this topic

I need help with If, then, Else functionality. Should be easy, but having a hard time figuring out where i'm going wrong. I've tried several iteration and have had trouble with the script not prompting to remove the keystore. So I created two different scripts to test the functions that i want independantly and they work.

When keystorecleaner.exe file runs, it checks if there is a current keystore and prompts the user to confirm that they want to delete the "keystore".

Script 1:

Run ("C:\Program Files\Lizard Safeguard PDF Viewer\KeystoreCleaner.exe")

WinWaitActive ("PDC Keystore Cleaner", "&Yes")

Send ("!y")

WinWaitActive ("PDC Keystore Cleaner", "Lizard Safeguard keystore succesfully removed.")

Send ("{SPACE}")

If keystorecleaner.exe runs and no keystore if found, the user is prompted that there is "No keystore found" and they have to press ok.

Script 2:

Run ("C:\Program Files\Lizard Safeguard PDF Viewer\KeystoreCleaner.exe")

WinWaitActive ("PDC Keystore Cleaner","No Keystore found. Nothing to do.")

Send ("{SPACE}")

What i need to do is combine these two scripts into one and figure out how to have the logic perform the specific steps depending on if there is a keystore or not.

It may be easier to check with the code in script 2 first as there is only one prompt box that appears if there is no keystore.

At the end of the script, it needs to terminate and exit cleanly. The working script will be ran at machine shutdown and if it does not exit cleanly, then shutdown hangs.

I provided screenshots of the prompts that appear so you have a visual reference.

Thanks in advance for your help!

Share this post


Link to post
Share on other sites



Hi CadDeVille,

what would be if you do a WinWaitActive("PDC keystore Cleaner") (without the text-check), and run afterwards sth. like:

WinWaitActive("PDC keystore Cleaner")
$s_text = WinGetText("PDC keystore Cleaner")
If StringInStr($s_text, "No Keystore found. Nothing to do.") Then
 ; Do what Script 2 does...
Else
 ; DO what Script 1 does
EndIf

:)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

I'll give it a try.

Share this post


Link to post
Share on other sites

Looks good so far! Thank you very much for your help.

Share this post


Link to post
Share on other sites

Glad I could help you,

thaoug I am not really experienced in program automation.

I tend to avoid it and use cmdline where possible.

:)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

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
Sign in to follow this  
Followers 0