Jump to content
Sign in to follow this  
kiboost

MouseMove when session is locked

Recommended Posts

kiboost

Hi,

I have a script that runs everydays (task sheduler). It happens at 7:00 when all workstations are locked.

In this script, it kill a process that has a systray icon (another autoit script) and restart it after some stuff.

I have put a few lines to find systray coordinates and a mousemove to refresh the systray (removing the tray icon of the process I killed).

All works nice when the session is open. But every morning when unlocking sessions to start working, I see the mousemove didn't worked.

So is there a solution to refresh the systray when the session is locked ? (win7 pro x64)

here is my mousemove tricks :

$TrayPos = WinGetPos("[class:Shell_TrayWnd]")
$MousePos = MouseGetPos()
MouseMove($TrayPos[2], $TrayPos[1]+($TrayPos[3]/2), 0)
MouseMove($TrayPos[2]-400, $TrayPos[1]+$TrayPos[3]/2, 20)
MouseMove($MousePos[0], $MousePos[1], 0)
sleep(50)

Thanks

Edited by kiboost

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites
Ramzes

Maybe "#NoTrayIcon" will better for you?

Edited by Ramzes

Sorry for my bad English but nobody is perfect. [font=arial, helvetica, sans-serif]Ramzes[/font]

Share this post


Link to post
Share on other sites
kiboost

Well, this process I need to kill/refresh is another autoit script which is precisely a tray menu to directly access a lot of things internally. It is only a tray menu.

Nearly all my autoit scripts have notrayicon.

Edited by kiboost

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites
kiboost

Yes that's exactly what I do. But processclose doesn't remove tray icon of the killed process.


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites
JohnOne

Try a ControlClick(), maybe 2.

EDIT:

Something like this maybe.

$hWnd = WinGetHandle("[class:Shell_TrayWnd]")
ControlClick($hWnd,"","[CLASS:ToolbarWindow32; INSTANCE:1]")
Sleep(1000)
ControlClick($hWnd,"","[CLASS:MSTaskListWClass; INSTANCE:1]")
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
kiboost

Hi John, sorry but it doesn't work. Your script work but it doesn't remove old icon from tray. I will try with systray udf to list all tray icon, find my process, and controlclick on it.


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites
kiboost

Doesn't work either.

it works anyway with systray udf :

#include <UDF/SysTray_UDF.au3>
$iTitles = _SysTrayIconTitles ()
$iProcesses = _SysTrayIconProcesses ()
For $i = 0 To UBound($iTitles) - 1
If $iProcesses[$i] = "" Then _SysTrayIconRemove($i)
Next

I've tested with sleep giving me time to lock the session, and it works !

Thanks for your help, you pointed me in good direction :-)


Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Share this post


Link to post
Share on other sites
rover

Well, this process I need to kill/refresh is another autoit script which is precisely a tray menu to directly access a lot of things internally. It is only a tray menu.

Nearly all my autoit scripts have notrayicon.

If the script you're closing only has a tray menu (no gui to WinClose),

then close it by the hidden AutoIt v3 class gui that every script has.

If a blocking function is run (MsgBox), WinClose won't work,

but a processing intensive function such as DirGetSize won't block WinClose.

OnAutoItExitRegister functions will run except if blocked.

Exiting does not rely on a scripts message loop or on-event exit.

(i.e. script will still close even if processing and gui is unreponsive)

No need to refresh the icons in the notification area/systray.

Local $iPID = ProcessExists("GUISetOnEvent.exe"), $aWin, $iTmp
If $iPID = 0 Then Exit
$aWin = WinList("[CLASS:AutoIt v3]") ;get all running autoit scripts
If $aWin[0][0] = 0 Then Exit ;If UBound($aWin) = 1 Then Exit
For $i = 1 To $aWin[0][0]
$iTmp = WinGetProcess($aWin[$i][1]) ;get owner process for AutoIt v3 class hidden gui
If $iTmp = -1 Or $iTmp = @AutoItPID Then ContinueLoop
If $iTmp = $iPID Then ;found target scripts hidden gui handle
  WinClose($aWin[$i][1])
  If WinWaitClose($aWin[$i][1], "", 5) = 0 Then
   WinKill($aWin[$i][1])
   If WinWaitClose($aWin[$i][1], "", 5) = 0 Then ProcessClose($iPID)
  EndIf
  ExitLoop
EndIf
Next

I see fascists...

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  

×