apollo13 Posted July 25, 2012 Posted July 25, 2012 I have wrote this script in order to move mouse on systray icon of my programs and entry in their menus. It's all right! QUESTION: If i don't have programs loaded in systray and i want Move Mouse on systray Clock how can I do ?? I can manually insert coordinates "x", "y" of the position of "DATE CLOCK" but if i change screen resolution change also coordinates. How can test Systray Clock Position and move mouse there ??? I can't insert into variable $st_process because there is no process running and now how can do ?? #NoTrayIcon #include <SysTray_UDF.au3> $st_process = "MyProgram.exe" If not processexists($st_process) then Run("C:\Program Files\Prog\" & $st_process) endif ; -------- wait until TootlTip NOT EXIST (program is loading not ready yet) --------- while not _SysTrayIconTooltip(_SysTrayIconIndex($st_process))="ProgramToolTip" sleep (100) wend ; -------------------------------------------------------------------------------------- $pos = _SysTrayIconPos(_SysTrayIconIndex($st_process)) mouseMove($pos[0], $pos[1], 0) Thank you
PhoenixXL Posted July 25, 2012 Posted July 25, 2012 in windows seven the class of the control is [Class:TrayClockWClass] this may help My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 25, 2012 Author Posted July 25, 2012 Thanks, but I'm using Xp Sp3 in virtual Machine
PhoenixXL Posted July 25, 2012 Posted July 25, 2012 This may be messed up U can try to coordinate with the Resolution That is check the values using trial and error method and make an approx equation and then your mouseclick should be done with respect to the coordinates you found of the resolution My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 25, 2012 Author Posted July 25, 2012 But if i use resolution and the taskbar have a different dimension (more rows ) or taskbar is not on bottom but in different position as right corner or other your council runs equal ?
PhoenixXL Posted July 25, 2012 Posted July 25, 2012 U can get the position of the taskbarTry this link and search ABM_GETTASKBARPOSCLICK ME!! My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
PhoenixXL Posted July 25, 2012 Posted July 25, 2012 (edited) Well This will surely help you out Global $_Positions[5+4]=['Left','Top','Right','Bottom','X','Y','Width','Height'] Global $tag_AppBarData='DWORD;HWND;UINT;UINT;STRUCT;INT;INT;INT;INT;ENDSTRUCT;LPARAM;' Func GetTaskBarPos() Local $ABM_GETTASKBARPOS=0x00000005 Local $pData=DllStructCreate($tag_AppBarData) DllStructSetData($pData,1,DllStructGetSize($pData)) DllStructSetData($pData,2,WinGetHandle('[CLASS:Shell_TrayWnd]','')) Local $aResult=DllCall('Shell32.dll','BOOL','SHAppBarMessage','DWORD',$ABM_GETTASKBARPOS,'ptr',DllStructGetPtr($pData)) If @error Then Return SetError(@error,0,-1) If Not $aResult[0] Then Return SetError($aResult[0],0,-2) Return SetError(0,0,DllStructCreate('UINT;INT;INT;INT;INT;',DllStructGetPtr($pData,4))) EndFunc Local $_Struct=GetTaskBarPos() ConsoleWrite('Taskbar Position - Docked at '&$_Positions[DllStructGetData($_Struct,1)]&@CR&'--------'&@CR) For $i=2 To 5 ConsoleWrite($_Positions[$i-2]&'='&DllStructGetData($_Struct,$i)&@CR) Next ;Try the Following it works in my Win_7 ; ConsoleWrite(@CR&'Clock Position'&@CR&'--------'&@CR) $_Struct=ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:TrayClockWClass; INSTANCE:1;]") For $i=1 To 4 ConsoleWrite($_Positions[$i+3]&'='&$_Struct[$i-1]&@CR) Next Thumbs Up if it helped Edited July 25, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
PhoenixXL Posted July 25, 2012 Posted July 25, 2012 (edited) The above code sometimes gives wrong values This code is more efficient Just changed the Array Dimension and Data Types Global $_Positions[8]=['Left','Top','Right','Bottom','X','Y','Width','Height'] Global $tag_AppBarData='LONG;HWND;INT;INT;STRUCT;INT;INT;INT;INT;ENDSTRUCT' Func GetTaskBarPos() Local $ABM_GETTASKBARPOS=0x00000005 Local $pData=DllStructCreate($tag_AppBarData) DllStructSetData($pData,1,DllStructGetSize($pData)) DllStructSetData($pData,2,WinGetHandle('[CLASS:Shell_TrayWnd]','')) Local $aResult=DllCall('Shell32.dll','BOOL','SHAppBarMessage','DWORD',$ABM_GETTASKBARPOS,'ptr',DllStructGetPtr($pData)) If @error Then Return SetError(@error,0,-1) If Not $aResult[0] Then Return SetError($aResult[0],0,-2) Return SetError(0,0,DllStructCreate('INT;INT;INT;INT;INT;',DllStructGetPtr($pData,4))) EndFunc Local $_Struct=GetTaskBarPos() ConsoleWrite('Taskbar Position - Docked at '&$_Positions[DllStructGetData($_Struct,1)]&@CR&'--------'&@CR) For $i=2 To 5 ConsoleWrite($_Positions[$i-2]&'='&DllStructGetData($_Struct,$i)&@CR) Next #cs ;Try the Following it works in my Win_7 ; ConsoleWrite(@CR&'Clock Position'&@CR&'--------'&@CR) $_Struct=ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:TrayClockWClass; INSTANCE:1;]") For $i=1 To 4 ConsoleWrite($_Positions[$i+3]&'='&$_Struct[$i-1]&@CR) Next #ce Edited July 25, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 26, 2012 Author Posted July 26, 2012 Thank you very much PhoenixXL but I'm not an expert user of AutoIT I'm studying it from less time (just few weeks) and proving your script i have obtained only "X" position of clock. To know also height pixel poistion if i drag Taskbar at half screen ?? And to know if taskbar in on left right bottom... ? Proved only this part under Win7 and WinXP =========================================================================================== Global $_Positions[5+4]=['Left','Top','Right','Bottom','X','Y','Width','Height'] Global $tag_AppBarData='DWORD;HWND;UINT;UINT;STRUCT;LONG;LONG;LONG;LONG;ENDSTRUCT;LPARAM;' ConsoleWrite(@CR&'Clock Position'&@CR&'--------'&@CR) $_Struct=ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:TrayClockWClass; INSTANCE:1;]") For $i=1 To 4 ConsoleWrite($_Positions[$i+3]&'='&$_Struct[$i-1]&@CR) Next msgbox(0, "", "Clock at Pixel X " & $_Struct[0]) ; coordinates "X" MouseMove($_Struct[0], ??????????, 2) =========================================================================================== I need also "Y" coordinates and is not $_Struct[1] How part of script i must run only under XP and how part only into Seven. If i use this part of script and i add msgbox(0,"", $_Struct[0]) ; !!!!! do error !!!!!! msgbox(0,"", $_Positions[0]) ; Tell me always left also Taskbar is in other positions .......but where i will try the "Y" coordinate to complete command MouseMove ?? Global $_Positions[5+4]=['Left','Top','Right','Bottom','X','Y','Width','Height'] Global $tag_AppBarData='DWORD;HWND;UINT;UINT;STRUCT;LONG;LONG;LONG;LONG;ENDSTRUCT;LPARAM;' Func GetTaskBarPos() Local $ABM_GETTASKBARPOS=0x00000005 Local $pData=DllStructCreate($tag_AppBarData) DllStructSetData($pData,1,DllStructGetSize($pData)) DllStructSetData($pData,2,WinGetHandle('[CLASS:Shell_TrayWnd]','')) Local $aResult=DllCall('Shell32.dll','BOOL','SHAppBarMessage','DWORD',$ABM_GETTASKBARPOS,'ptr',DllStr uctGetPtr($pData)) If @error Then Return SetError(@error,0,-1) Return SetError(0,0,DllStructCreate('UINT;LONG;LONG;LONG;LONG;',DllStructGetPtr($pData,4))) EndFunc Local $_Struct=GetTaskBarPos() ConsoleWrite('Taskbar Position - Docked at '&$_Positions[DllStructGetData($_Struct,1)]&@CR&'--------'&@CR) For $i=2 To 5 ConsoleWrite($_Positions[$i-2]&'='&DllStructGetData($_Struct,$i)&@CR) Next
PhoenixXL Posted July 26, 2012 Posted July 26, 2012 If you are a beginner then does this help ControlSend("[CLASS:Shell_TrayWnd]",'', "[CLASS:TrayClockWClass; INSTANCE:1;]",'{ENTER}') My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
PhoenixXL Posted July 26, 2012 Posted July 26, 2012 (edited) Orelse this would also help Your code #include <SysTray_UDF.au3> Global $st_process = "MyProgram.exe" Global $_Path=@ScriptDir&''&$st_process If not processexists($st_process) then If Not FileExists($_Path) Then MsgBox(16,'Error',"Path Doesn't Exist") Exit -1 EndIf Run($_Path) Endif ; -------- wait until TootlTip NOT EXIST (program is loading not ready yet) --------- while not _SysTrayIconTooltip(_SysTrayIconIndex($st_process))="Heya" sleep (100) wend ; -------------------------------------------------------------------------------------- $pos = _SysTrayIconPos(_SysTrayIconIndex($st_process)) mouseMove($pos[0], $pos[1], 0) and this is MyProgram.exe place it in ScriptDir after compiling it #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=MyProgram.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If Not @Compiled Then MsgBox(64,'Information','Compile me to Execute') Exit -1 EndIf TraySetToolTip('Heya') Sleep(10000) Exit Well please tell what do you want to do with the clock do you want to set the LocalTime or do you want to click any third-party application's tray Regards Phoenix XL Edited July 26, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 26, 2012 Author Posted July 26, 2012 (edited) I have made a small script that drag taskbar (Hide-Show) because EXE files or AutoIT script that i found on web (that do this) causes problem on visualization of Win7 screen when i run program Guest XP virtualized into seamless invisible mode therefore i must only hide taskbar using autoIT command for DRAGGING One click= If Taskbar have dimension NOT minimal return to minimal (default dimension) or the taskbar is HIDE then SHOW it default dimension One click = hide taskbar if dimension is already minimal this is what i want that program do in every position of taskbar LEFT - RIGHT - TOP - BOTTOM and for every definition of screen but if i use x, y systray positions sometimes have problems that are solved if i choose manually the position of clock. Now I'm thinking to use Screen definition: IF : systray x position< "Screen x definition"/2 --> LEFT BAR systray y position<"Screen y Definition"/2 --> TOP Bar systray x position = Clock x position (using part of your script that for now i have understood how use) --> Bar is on right corner then correct position of the drag Edited July 26, 2012 by apollo13
PhoenixXL Posted July 26, 2012 Posted July 26, 2012 systray x position< "Screen x definition"/2 --> LEFT BAR systray y position<"Screen y Definition"/2 --> TOP Bar systray x position = Clock x position (using part of your script that for now i have understood how use) --> Bar is on right corner then correct position of the drag This would me messy try this code to find where the Taskbar is docked Global $_Positions[8]=['Left','Top','Right','Bottom','X','Y','Width','Height'] Global $tag_AppBarData='LONG;HWND;INT;INT;STRUCT;INT;INT;INT;INT;ENDSTRUCT' Func GetTaskBarPos() Local $ABM_GETTASKBARPOS=0x00000005 Local $pData=DllStructCreate($tag_AppBarData) DllStructSetData($pData,1,DllStructGetSize($pData)) DllStructSetData($pData,2,WinGetHandle('[CLASS:Shell_TrayWnd]','')) Local $aResult=DllCall('Shell32.dll','BOOL','SHAppBarMessage','DWORD',$ABM_GETTASKBARPOS,'ptr',DllStructGetPtr($pData)) If @error Then Return SetError(@error,0,-1) If Not $aResult[0] Then Return SetError($aResult[0],0,-2) Return SetError(0,0,DllStructCreate('INT;INT;INT;INT;INT;',DllStructGetPtr($pData,4))) EndFunc Local $_Struct=GetTaskBarPos() ConsoleWrite('Taskbar Position - Docked at '&$_Positions[DllStructGetData($_Struct,1)]&@CR&'--------'&@CR) $_Struct=0 My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 26, 2012 Author Posted July 26, 2012 ok is equal to previously post but how is variable that contain LEFT - RIGHT... bottom in order to test it. can you include here ? msgbox(0, "", "taskbar is in the position " & ?????Variable____)
PhoenixXL Posted July 26, 2012 Posted July 26, 2012 0=Left 1=Top 2=Right 3=Bottom I made the Array Index same as the Return Value. My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 26, 2012 Author Posted July 26, 2012 (edited) tell me if i understood: The result of taskbar position is inserted in the variable $_Struct if value contained into $_Struct is 0 means that is on left if value= 1 means that taskbar is on top etc... therefore i can write if $_Struct=0 then msgbox(0, "", "left") is correct ? Edited July 26, 2012 by apollo13
PhoenixXL Posted July 26, 2012 Posted July 26, 2012 Actually the returned value is a DllStruct, so to get the data try to use DllStructGetData with element 1 if you arent confident with those things then this would do.. Global $_Positions[4]=['Left','Top','Right','Bottom'] Global $tag_AppBarData='LONG;HWND;INT;INT;STRUCT;INT;INT;INT;INT;ENDSTRUCT' Func GetTaskBarDockedEdge() Local $ABM_GETTASKBARPOS=0x00000005 Local $pData=DllStructCreate($tag_AppBarData) DllStructSetData($pData,1,DllStructGetSize($pData)) DllStructSetData($pData,2,WinGetHandle('[CLASS:Shell_TrayWnd]','')) Local $aResult=DllCall('Shell32.dll','BOOL','SHAppBarMessage','DWORD',$ABM_GETTASKBARPOS,'ptr',DllStructGetPtr($pData)) If @error Then Return SetError(@error,0,-1) If Not $aResult[0] Then Return SetError($aResult[0],0,-2) Return SetError(0,0,DllStructGetData($pData,4)) EndFunc Local $_Struct=GetTaskBarDockedEdge() ConsoleWrite('Taskbar Position - Docked at '&$_Positions[$_Struct]&@CR&'--------'&@CR) If $_Struct=0 Then MsgBox(64,'','Left') My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
apollo13 Posted July 26, 2012 Author Posted July 26, 2012 Thanks you. Tomorrow when i come back to home i prove immediately on my computer and i will think how obtain "y" coordinates when taskbar is enlarged and not in default size
UEZ Posted July 26, 2012 Posted July 26, 2012 Is this working for you: $aPosHwnd = WinGetPos("[CLASS:Shell_TrayWnd]") $aPosCtrl = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:TrayClockWClass; INSTANCE:1]") MouseMove($aPosHwnd[0] + $aPosCtrl[0] + $aPosCtrl[2] / 2, $aPosHwnd[1] + $aPosCtrl[1] + $aPosCtrl[3] / 2) Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
apollo13 Posted July 27, 2012 Author Posted July 27, 2012 Thank you all forum. Tonight when i come back to my home i prove immediately and i will think how complete script with function that test Dimension of taskbar and do "MouseClickDrag" if taskbar dimension is more big than standard (24 pixel for BOTTOM AND TOP,..... ??? LEFT and Right ???) then DRAG to standard dimension if taskbar dimension is Standard then reduce dimension to 0 pixel (Hide taskbar) if taskbar dimension is 0 pixel then report taskbar dimension to standard dimension (SHOW)
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