MadCoder Posted May 26, 2010 Share Posted May 26, 2010 I have a script that builds our software projects every night. It's a complicated process but everything works like it should, HOWEVER... When it opens our Visual Studio C++ Projects and starts the build process it doesn't properly close, so the entire script hangs and skips the packaging, uploading, etc... processing. Here's where I'm hanging... ; / BUILD ShellExecute("S:\Nightly\Builds\ProjectName.sln") WinWaitActive("ProjectName") sleep (27000) ; Wait for Visual Studio to load all software projects (20+) ; start build Controlsend ("ProjectName","", "", "^!{F7}") ; Tell Visual Studio to begin building solution tree ; wait 15 minutes Sleep(900000) ControlSend("ProjectName", "", "", "!f{UP}{ENTER}") ; Send Alt + F, then move to exit and enter to close VS - this is where I'm hanging WinWaitClose("ProjectName") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Link to comment Share on other sites More sharing options...
Affe Posted May 26, 2010 Share Posted May 26, 2010 I have a script that builds our software projects every night. It's a complicated process but everything works like it should, HOWEVER... When it opens our Visual Studio C++ Projects and starts the build process it doesn't properly close, so the entire script hangs and skips the packaging, uploading, etc... processing. Here's where I'm hanging... ; / BUILD ShellExecute("S:\Nightly\Builds\ProjectName.sln") WinWaitActive("ProjectName") sleep (27000) ; Wait for Visual Studio to load all software projects (20+) ; start build Controlsend ("ProjectName","", "", "^!{F7}") ; Tell Visual Studio to begin building solution tree ; wait 15 minutes Sleep(900000) ControlSend("ProjectName", "", "", "!f{UP}{ENTER}") ; Send Alt + F, then move to exit and enter to close VS - this is where I'm hanging WinWaitClose("ProjectName") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Use ProcessExists() to get the process ID and then use a ProcessClose(). [center][/center] Link to comment Share on other sites More sharing options...
JohnOne Posted May 26, 2010 Share Posted May 26, 2010 try ControlSend("ProjectName", "", "", "!f") ; Send Alt + F, then move to exit and enter to close VS - this is where I'm hanging ControlSend("ProjectName", "", "", "{UP}") ControlSend("ProjectName", "", "", "{ENTER}") WinWaitClose("ProjectName") Im certain there is a better way, but you give no control id code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Affe Posted May 26, 2010 Share Posted May 26, 2010 tryControlSend("ProjectName", "", "", "!f") ; Send Alt + F, then move to exit and enter to close VS - this is where I'm hangingControlSend("ProjectName", "", "", "{UP}")ControlSend("ProjectName", "", "", "{ENTER}")WinWaitClose("ProjectName")Im certain there is a better way, but you give no control id code.Wouldn't you have to do an "{ALTDOWN}f{ALTUP}" instead of "!f"? [center][/center] Link to comment Share on other sites More sharing options...
JohnOne Posted May 26, 2010 Share Posted May 26, 2010 (edited) Nope, although he should probably use the 1 flag in the control send, seeing as how he seems to be just sending to the window rather than the control itself with a click. Edited May 26, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Affe Posted May 26, 2010 Share Posted May 26, 2010 Then what if I wanted to send the string "!f" to a control, instead of simulating the Alt+f keypress? Forgive me for pestering, just curious. [center][/center] Link to comment Share on other sites More sharing options...
JohnOne Posted May 26, 2010 Share Posted May 26, 2010 (edited) flag 0 default EDIT: hang on I might have that backwards Edited May 26, 2010 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
MadCoder Posted May 26, 2010 Author Share Posted May 26, 2010 I will try the ProcessExist function and report back Link to comment Share on other sites More sharing options...
JohnOne Posted May 26, 2010 Share Posted May 26, 2010 Id avoid that if I were you, its not really a graceful way of closing an application, you really ought to be looking at getting the control information of the buttons you want to click and using ControlClick. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
KaFu Posted May 26, 2010 Share Posted May 26, 2010 How about a WinClose()? OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) 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