Jump to content

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


Recommended Posts

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!

Link to comment
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]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...