Jump to content

Skype Window


Recommended Posts

After opening Skype if you click on [X] the Skype Window only closes [this does not QUIT the application] and the Skype Icon remains on the Windows Notification Bar. If you right click the Skype Icon then you are offered a menu which allows you to re-open the Skype window.

If you use this code:

$Title = "Skype"

WinActivate($Title, "")

WinClose($Title, "")

Skype is Quit which is not the condition I wish to achieve.

My question is with the Skype Window Active how do a simulate the user clicking on [X] so that the Skype remains running with the Icon appearing on the Windows Notification Bar rather than choosing to simply minimize the window.

Assistance is always appreciated.. Ant

Link to comment
Share on other sites

  • Moderators

anixon,

Try this:

$Title = "Skype"
WinActivate($Title, "")
; Reduce to tray icon only
WinSetState($Title, "", @SW_HIDE)
Sleep(2000)
; Reopen main window
WinSetState($Title, "", @SW_SHOW)

Works on my Skype. :blink:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

anixon,

Try this:

$Title = "Skype"
WinActivate($Title, "")
; Reduce to tray icon only
WinSetState($Title, "", @SW_HIDE)
Sleep(2000)
; Reopen main window
WinSetState($Title, "", @SW_SHOW)

Works on my Skype. Posted Image

M23

Thanks M23

Thats terrific but I want to leave the user with the ability to re-open the Skype Window by right clicking the Skype Icon on the Notification Bar. When you use @SW_HIDE the 'Skype open' Menu Function is disabled. Perhaps the best way would be to use the AutoIT Send function to perform the Skype Menu process 'Skype/Close'.

This appears to work well with Vista at least or is their a better or more robust way of achieving the same result?

$Title = "Skype"

WinActivate($Title, "")

Send("{ALT}{DOWN 8}{ENTER}")

Ant..

And this is the complete code:

;//Include [Autoit Library Routine/s]

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

;//Set Global Variables
Global $SkypeTitle = "Skype", $SkypeTitleClose = "Skype™", $sSkypeDir = "\Skype\Phone\", $sSkypeExe = "Skype.exe", $hSysTray_Handle

;//Open Skype
If Not ProcessExists($sSkypeExe) Then
 ShellExecute(@ProgramFilesDir & $sSkypeDir & $sSkypeExe, "", "", "", @SW_SHOWDEFAULT)
 WinWaitActive($SkypeTitle, "", 20)
Else
 ;//Check if Skype has Icon on Notification Area of the Taskbar
 $iSystray_ButtonNumber = _Get_Systray_Index($SkypeTitle)
 If $iSystray_ButtonNumber <> 0 Then
  Sleep(500)
  _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")
  Sleep(500)
  Send("{DOWN}{DOWN}{ENTER}")
 Else
  Msgbox(0,$SkypeTitle, "Please Open SKYPE", 20)
 EndIf
EndIf

;//Close Skype Window and Leave Running
Sleep(5000)
WinActivate($SkypeTitleClose, "")
Send("{ALT}{DOWN 8}{ENTER}")

;//Find Skype Tool Tip
Func _Get_Systray_Index($sToolTipTitle)
 While 1
  ; Find Systray Handle
  $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
  If @error Then ExitLoop   
  ; Get systray item count
  Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
  If $iSystray_ButCount = 0 Then ExitLoop  
  ; Look for wanted tooltip
  For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
   If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop
  Next
  If $iSystray_ButtonNumber = $iSystray_ButCount Then
   Return 0 ; Not found
  Else
   Return $iSystray_ButtonNumber ; Found
  EndIf
  ExitLoop
 WEnd
EndFunc   ;==>_Get_Systray_Index

For this close Skype and keep running code to work correctly and thereby avoiding it selecting a Skypelink window the code has been modified as follows:

;//Close Skype Window and Leave Running

Sleep(5000)

WinSetState($SkypeTitleClose, "", @SW_SHOWDEFAULT)

WinActivate($SkypeTitleClose)

WinWaitActive($SkypeTitleClose, "", 20)

Sleep(500)

Send("{ALT}{DOWN 8}{ENTER}")

please note that to select the Skype Window the $SkypeTitleClose variable containing the Skype TM symbol $SkypeTitleClose = "Skype™" is used.

Ant..

Edited by anixon
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...