NickFrost Posted June 17, 2012 Share Posted June 17, 2012 Hi there. I wrote a simple script that sends string that was passed as a parameter to the softphone dialer. The problem is the program is almost always will be minimized to tray and script stops until it is restored. I tried using WinSetState but was unsuccessful. Any help is appreciated, the snippet is below:Local Const $title = "Phone" Local Const $soft = @ProgramFilesDir & "\Phone\Phone.exe" Local $number = $CmdLine[1] $number = StringReplace($number, "/", "") ;strip unneded characters $number = StringReplace($number, "dial:", "") If WinExists($title) == 0 Then Run($soft, "", @SW_MAXIMIZE) WinWait($title) EndIf ;I tried using fance method, but decided to at least raise it somehow ;Local $state = WinGetState($title, "") ;If BitAND($state, 16) Then ;if it is ; WinSetState($title, "", @SW_MAXIMIZE) ;EndIf WinSetState($title, "", @SW_MAXIMIZE) ;doesn't do the trick, and neither do RESTORE or SHOW ControlSend($title, "", "Edit1", $number) WinActivate($title) ControlSend($title, "", "Edit1", "{ENTER}") Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 17, 2012 Moderators Share Posted June 17, 2012 NickFrost,Welcome to the AutoIt forum. I have used this code to rightclick on tray items to get to their menu - I have found that Send("{UP}/{DOWN}{ENTER}") works well from then on if you add a Sleep(100) between multiple commands to allow them time to have effect: expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSysTray_ButtonNumber Global $sToolTipTitle = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $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") EndIf Exit ;............ 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 EndFuncI hope that helps - ask again if not. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
NickFrost Posted June 17, 2012 Author Share Posted June 17, 2012 Thanks, that worked beautifully. It seems that there is more to this language then I thought initially Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now