VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   MessageBox executed first than the previous WaitForString (https://forums.vandyke.com/showthread.php?t=13868)

Tonatiuh 08-07-2019 08:30 AM

MessageBox executed first than the previous WaitForString
 
This is my python script:

Code:

# $language = "python"
# $interface = "1.0"

import SecureCRT
import os
import sys

strPath = os.path.dirname(__file__)
if strPath not in sys.path: sys.path.insert(0, strPath)


import modPlatform
import modParseOutput
import modStrBoolean
reload(modPlatform)
reload(modParseOutput)
reload(modStrBoolean)

def Main():

    # Get the absolute path of the running script
        strSlash = modPlatform.GetSlashChar()
        strPath = os.path.dirname(__file__) + strSlash
       
        objTab = crt.GetScriptTab()
        objTab.Screen.Synchronous = True
               
        # Get the current Prompt
    # Send twice the RETURN keystroke to be able to read the prompt in the the second execution
        objTab.Screen.Send("\r")
        objTab.Screen.WaitForString("\n")
        objTab.Screen.Send("\r")
        strPrompt = objTab.Screen.ReadString("\n")
        #crt.Dialog.MessageBox("." + strPrompt + ".")
       
        strSrvctlSS = "srvctl status service -d myDB"
        objTab.Screen.Send (strSrvctlSS + "\r")
        objTab.Screen.WaitForString("]$")
        bAnswer = crt.Dialog.MessageBox("Do you want to continue","", BUTTON_YESNO)
       
Main()

The line: bAnswer = crt.Dialog.MessageBox("Do you want to continue","", BUTTON_YESNO)
Executes before the line: objTab.Screen.Send (strSrvctlSS + "\r")

What did I do wrong?

Regards,


All times are GMT -6. The time now is 03:36 PM.