View Single Post
  #1  
Old 08-07-2019, 08:30 AM
Tonatiuh Tonatiuh is offline
Registered User
 
Join Date: Jul 2006
Posts: 68
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,
Reply With Quote