Jump to content
Sign in to follow this  
MadCoder

What's a sure proof method of closing a application

Recommended Posts

MadCoder

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")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Share this post


Link to post
Share on other sites
Affe

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]

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
Affe

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]

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
Affe

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]

Share this post


Link to post
Share on other sites
MadCoder

I will try the ProcessExist function and report back

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
KaFu

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
Sign in to follow this  

×