Sign in to follow this  
Followers 0
anixon

WinSetState

9 posts in this topic

Skype is running with an online icon [white tick in a green oval] displayed on the Windows Notification Taskbar.

When maximized the Skype Window Title consists of a Skype Graphic then the text 'Skype' then a trademark 'TM' then '- Username'

This code will not set the focus and maximize the Skype.

WinSetState("[CLASS:Skype]", "", @SW_MAXIMIZE)

and neither will

WinActivate(.....

can anyone help me with the magic.. Ant..Posted Image

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

To start maximized: Right click on Skype's link, -->Properties--> Window: Maximized

Edited by wwwvgtulzcomua

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

To start maximized: Right click on Skype's link, -->Properties--> Window: Maximized

Thanks for that but Skype is already running with its Icon displayed on the Notification Area of the Taskbar what I need is the script to focus on Skype and maximise the window for the running application.. Ant

Edited by anixon

Share this post


Link to post
Share on other sites

If Maximize button have a CTRL ID, try ControlClick


_____________________________________________________________________________

Share this post


Link to post
Share on other sites

Thanks for that this does not work

ControlClick("Skype", "", "ToolbarWindow32:INSTANCE:1")

To perform the task manually to maximise the window you right click the Icon in the Windows Notification area of the Taskbar and then you have to select one of three menu items 'Open Skype' to open the window. Perhaps it is simply easier to prompt the user to open the window manually Ant..

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Skype-->Tools-->Options-->Advanced-->Hotkeys : Focus Skype (assign hotkey)

WinSetState("[CLASS:Skype]", "", @SW_SHOW)

> Possible, if you switch Skype to Classic Window(in Skype's options), but:

- Window will be shown Without any controls!

- Skype don't know that window is shown, therefore window can't be closed(need to click in tray menu "Open Skype" before)

Edited by GodlessSinner

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

Skype-->Tools-->Options-->Advanced-->Hotkeys : Focus Skype (assign hotkey)

WinSetState("[CLASS:Skype]", "", @SW_SHOW)

> Possible, if you switch Skype to Classic Window(in Skype's options), but:

- Window will be shown Without any controls!

- Skype don't know that window is shown, therefore window can't be closed(need to click in tray menu "Open Skype" before)

Thanks for the reply cannot get your code to work even in either Skype or Classic mode even with the Skype window minimized onto the Taskbar. It should be noted that you still have the Skype Icon appearing on the Notification Area of the Taskbar [Right click gives you the Menu 'Change Online Status', 'Open Skype' and 'Quit' whereas if you click on the minimized Skype Window Button on the Taskbar it opens to the last size and xy position.

WinSetState("[CLASS:Skype]", "", @SW_SHOW)
has no effect of maximising the minimised Skype Window

Assigning a hotkey to 'Focus Skype' works a treat but this would involve advising the end user what key combination had to be configured in tools my preference would be for WinSetState to open and close

the Skype window that way you can check that Skype is running and maximize the screen. Ant..

Share this post


Link to post
Share on other sites

anixon,

Here you go - this works for my Skype: :(

#Include <GuiToolBar.au3>

Global $hSysTray_Handle, $iSystray_ButtonNumber

Global $sToolTipTitle = "Skype"

Open_Skype()

Exit

Func Open_Skype()

    $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)

    If $iSystray_ButtonNumber = 0 Then
        MsgBox(16, "Error", "Icon not found in system tray")
        Exit
    Else
        Sleep(500)
        _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")
        Sleep(500)
        Send("{DOWN}{DOWN}{ENTER}")
    EndIf

EndFunc

Func Get_Systray_Index($sToolTipTitle)

    ; Find systray handle
    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    EndIf

    ; Get systray item count
    Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSystray_ButCount = 0 Then
        MsgBox(16, "Error", "No items found in system tray")
        Exit
    EndIf

    ; Look for wanted tooltip
    For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) > 0 Then ExitLoop
    Next

    If $iSystray_ButtonNumber = $iSystray_ButCount Then
        Return 0 ; Not found
    Else
        Return $iSystray_ButtonNumber ; Found
    EndIf

EndFunc

Enjoy the F1 Grand Prix tomorrow - I will be up early to watch it. Good luck to Mark Webber (although I will not cry too much if he comes 2nd to Jenson Button, who lives just down the road!). :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

anixon,

Here you go - this works for my Skype: Posted Image

#Include <GuiToolBar.au3>

Global $hSysTray_Handle, $iSystray_ButtonNumber

Global $sToolTipTitle = "Skype"

Open_Skype()

Exit

Func Open_Skype()

    $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)

    If $iSystray_ButtonNumber = 0 Then
        MsgBox(16, "Error", "Icon not found in system tray")
        Exit
    Else
        Sleep(500)
        _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")
        Sleep(500)
        Send("{DOWN}{DOWN}{ENTER}")
    EndIf

EndFunc

Func Get_Systray_Index($sToolTipTitle)

    ; Find systray handle
    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    EndIf

    ; Get systray item count
    Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSystray_ButCount = 0 Then
        MsgBox(16, "Error", "No items found in system tray")
        Exit
    EndIf

    ; Look for wanted tooltip
    For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) > 0 Then ExitLoop
    Next

    If $iSystray_ButtonNumber = $iSystray_ButCount Then
        Return 0 ; Not found
    Else
        Return $iSystray_ButtonNumber ; Found
    EndIf

EndFunc

Enjoy the F1 Grand Prix tomorrow - I will be up early to watch it. Good luck to Mark Webber (although I will not cry too much if he comes 2nd to Jenson Button, who lives just down the road!). Posted Image

M23

How clever are we then, I guess with all your help I will have to talk about you in the most favourable terms... he he.... Yep we are looking forward to the F1 always good to see someone we know win on their own turf. In his presence I can remember the Doohan winning at Philip Island on from memory a 'Honda' that was exciting. I also had the privilege of being invited by Qantas to the first F1 their corporate box was above the 'Ferrari' pits the noise was horrific but the tea and sticky buns was well worth it... but all of that was in a previous life.. Thanks again Ant..

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