Jump to content

[Solved] Close an Application


Recommended Posts

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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.

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]

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