AaiRez Posted March 8, 2016 Share Posted March 8, 2016 (edited) I am new to scripting and new to AutoIt.. I am trying to figure out how to setup my script so that it can check to see if a window is opened, close it, and re-open the window.. We use Citrix and so far I am able to get citrix to load, put in the username and password, open the windows that need to be opened, and end the script.. What I REALLY want to do is this.. I want to check machine names, run citrix and open the qlaunch remote program, enter the password and end. Now in between all of this, I want to check to see if the remote application is running, if it is not, then i want the remote application to re-launch.. I can't seem to figure this out and need some help.. Here's what I got: (removed usernames and passwords) expandcollapse popup;Checks Computer Name for Compatibility (Update Computer Name Below) Global $CCB1EDTB1 = "CCB1EDTB1" Global $CCB1EDTB2 = "CCB1EDTB2" Global $CCB1FCARERNSTTB = "CCB1FCARERNSTTB" Global $CCB1EPSTB = "CCB1EPSTB" ;Check if the script will run on the computer. If @ComputerName = $CCB1EDTB1 Or _ @ComputerName = $CCB1EDTB2 Or _ @ComputerName = $CCB1EPSTB Or _ @ComputerName = $CCB1FCARERNSTTBb Then ;MsgBox(16, @ComputerName, "Computer Accepted", 3) Else MsgBox(16, @ComputerName, "Please add this Workstation to FirstNet Auto Launch Script.",10) Exit EndIf ;Checks if Tracking Boarding is Running. If running script exits, if not will relaunch tracking board. If WinExists("[TITLE:FirstNet Organizer for CCB Main ED 1, SHOWBOARD]") or _ WinExists("[TITLE:FirstNet Organizer for CCB Main ED 2, SHOWBOARD]") or _ WinExists("[TITLE:FirstNet Organizer for CCB First Care RN, SHOWBOARD]") Then ;MsgBox(64, @ComputerName, "FirstNet is Open", 3) Exit Else ;MsgBox(64, @ComputerName, "FirstNet is Not Open", 3) EndIf ;Pause 10 Seconds for Network to Connect Sleep(10000) ;Launch Citrix connection Run('"C:\Program Files\Citrix\ICA Client\pnagent.exe" /QLaunch "chiExpFarm:FirstNet KYPRD No Timeout"') ;Wait for the FirstNet Logon Screen WinWaitActive("HNAM Logon") Sleep(500) ;*********************************************************************************************************************************** ;*********************************************MODIFY THIS PORTION FOR EACH TRACKING BOARD SIGN-ON*********************************** ;ULH Tracking Board Login Info if @ComputerName = $CCB1EDTB1 Then ;Send Username + hit tab key Send ("") Send ("{TAB}") ;Send Password + hit enter key Send ("") Send ("{ENTER}") EndIf If @ComputerName = $CCB1EDTB2 Then ;Send Username + hit tab key Send ("") Send ("{TAB}") ;Send Password + hit enter key Send ("") Send ("{ENTER}") EndIf If @ComputerName = $CCB1FCARERNSTTB Then ;Send Username + hit tab key Send ("") Send ("{TAB}") ;Send Password + hit tab key Send ("") Send ("{ENTER}") EndIf ;PowerChart If @ComputerName = $CCB1EPSTB Then ;Send Username + hit tab key Send ("") Send ("{TAB}") ;Send Password + hit tab key Send ("") Send ("{ENTER}") EndIf ;*********************************************************************************************************************************** ;*********************************************************************************************************************************** ;Pause 5 Seconds for Tracking Board to Load Sleep(5000) ;Send keystrokes to click on "List" in the menu bar, then click on "Show Board" Send ("{ALT}ll") Send ("{ENTER}b") ;Hide the mouse pointer MouseMove(0, 0, 0) ;Close AutoLaunch Script Exit Please help? Edited March 8, 2016 by Jos added codebox Link to comment Share on other sites More sharing options...
alienclone Posted March 9, 2016 Share Posted March 9, 2016 can you check to see if the process is running instead of searching for windows? If @error Then MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!") EndIf "Yeah yeah yeah patience, how long will that take?" -Ed Gruberman REAL search results | SciTE4AutoIt3 Editor Full Version Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now