Sign in to follow this  
Followers 0
IanN1990

[Solved] Close an Application

12 posts in this topic

#1 ·  Posted (edited)

I am trying to close skype when i hit a hotkey, that makes my system script end.

ControlSend("Windows Live Messenger", "", "[CLASS:WLXDUI; INSTANCE:2]", "^{F4}") Works for MSN but

ControlSend("[Class:tSkMainForm]", "", "[CLASS:TConversationsControl; INSTANCE:1]", ^{F4}") doesn't seam to work for skype. Not does any other controlsend combenation i tryed.

I cant use Winclose or Winkill as they make the application Log-out, which isnt what i am after.

**I am aware of Mouseclick and Send commands, but they are very unrealiable.

Are there any other ways of closing an application ?

Edited by IanN1990

Share this post


Link to post
Share on other sites



There is a Skype UDF available. I'm sure there is a function to close Skype.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

skype doesnt close with a close command, the process runs in the background. you have to run the following in the script:

Run("taskkill /im skype.exe /f /t")

its the same as going into the task manager and right clicking the process and killing it. it does not log you out

Share this post


Link to post
Share on other sites

Hi, IanN1990. As Water mentioned, the Skype COM UDF located has a _skype_shutdown function. Should be a lot more smooth than just killing the process.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Just used it that way in my experience. Seems clear cut because even in non scripting use, skype is just a pain in the ass because it never really closes unless you kill the process. Just wrote a SKYDIE.bat for my friends. (all win7 64-bit)

Share this post


Link to post
Share on other sites

Thanks for everyones input on the topic.

@Redneck Run("taskkill /im skype.exe /f /t"). I tryed this but it kills the application rather then closing the window. Which is what i am after, an example might be if i alt + f4 the msn window closes but it doesn't log me out of msn. As that kills the skype.exe when i re-run the application, instead of showing the window it needs to reconnect to skype

@Water I tryed the UDF on the laptop downstairs but had a nightmare trying to get it to work "not the fault of the UDF but rather then laptop, so when i carmed down as something big kinda happened i will see if i can try again" but i do fear it would prob kill the skype.exe rather then just closing the application window.

Share this post


Link to post
Share on other sites

OK. so you want to leave it open rather than kill it. I thought you meant as in alt+f4 just closes the window and you wanted to kill the process. If thats the case just:

$Title = "Skype"

WinActivate ($Title)

Sleep (50)

If WinActive ($Title) <> 0 Then

WinClose ($Title)

Else

MsgBox (0, "", "window was not active")

EndIf

Try that. If it doesnt work try replacing: $Title = "Skype" with $Title = "Skype - *" and if that still doesnt work try $Title = "Skype - Username" where Username is your skype logon name.

If none of those work then were back to the drawing board

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I tryed that :(

WinClose("[Class:tSkMainForm]")

but this closes skype and makes the application exit.

Alt + F4 just makes the window close "while in the trayicon skype remains active"

**EDIT i dont suppose there is a quick-fix to this topic with the controlsend idea and maybe i have just used the function wrong ?

Edited by IanN1990

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

When you minimize the window, does it go to the tray? If so, try this.

WinSetState("[Class:tSkMainForm]", "", @SW_MINIMIZE)

Adam

Edited by AdamUL

Share this post


Link to post
Share on other sites

@Adam

Tryed your code but it just minimizes the window. Doesnt close it

@John

I ran your code but got an error message

D:DesktopNew AutoIt v3 Script.au3 (1) : ==> Unterminated string.:
ControlSend("[Class:tSkMainForm]", "", "", ^{F4}")

I changed it to ControlSend("[Class:tSkMainForm]", "", "", "^{F4}") but all it does is make the menu system a bit bigger. Doesn;t close the application

I Thank everyone for their help, but i think skype is just too troublesome so i will put this idea to rest and try something else.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

@Adam

Tryed your code but it just minimizes the window. Doesnt close it

@John

I ran your code but got an error message

D:DesktopNew AutoIt v3 Script.au3 (1) : ==> Unterminated string.:
ControlSend("[Class:tSkMainForm]", "", "", "^{F4}")

I changed it to ControlSend("[Class:tSkMainForm]", "", "", "^{F4}") but all it does is make the menu system a bit bigger. Doesn;t close the application

I Thank everyone for their help, but i think skype is just too troublesome so i will put this idea to rest and try something else.

Missing something there an ", i tried the code and it's running.

Cheers

ControlSend("[Class:tSkMainForm]", "", "", "^{F4}")
Edited by November

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Share this post


Link to post
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
Sign in to follow this  
Followers 0