Jump to content

What's a sure proof method of closing a application


Recommended Posts

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

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

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

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.

Wouldn't you have to do an "{ALTDOWN}f{ALTUP}" instead of "!f"?

[center][/center]

Link to comment
Share on other sites

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 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...