I am trying to create an RPA based automation for running a vbscript in Secure CRT. In that, I am uploading vbscript to Secure CRT using pyautogui module. Now, my code ends even before all the logs download from vbscript is completed. How can I ensure that my python ends only after vbscript has run successfully and all the download is completed so that I can close secure CRT?
Asked
Active
Viewed 121 times
1 Answers
0
I solved this problem in following ways:
Instead of using pyautogui module to upload vbscript on secureCRT, I used subprocess module as secureCRT has command line abilities to run vbscript:
import subprocess RunVbs='\"'+ secureCRTPath +'\"' + ' /SCRIPT ' + '\"' + vbscriptPath + '\"' subprocess.Popen(RunVbs)
For ensuring that python script exits only after the vbscript has been run completely, I created a text file at the end of vbscript which was continuously scanned by python script. On finding the text file created by vbscript, python script would terminate:
import time, os isVbsExecuted = False while isVbsExecuted == False: if os.path.exists('C:\VBSPath\OutputVBS.txt'): isVbsExecuted = True else: time.sleep(2)

HobbyCoder
- 45
- 9