eHrgo Posted April 28, 2007 Share Posted April 28, 2007 (edited) Hi guys, I've codded this script to apply it to another script, I though I would just put Loop this part: expandcollapse popup$Curspos=MouseGetPos() $WinPos=WinGetPos('WinTest') If $Curspos[1]<40 Then ;If the cursor is located in a specific area Call('Appear') Else Call('Disapear') EndIf GUISetState(@SW_SHOW)oÝ÷ Ú)í¢Ø^{¬µéí)nëHq©í!ò¢ØZ¶Ø^è¬jZ-¡óh x{ô¡£bæÞq«¬zߺw-ÜjYpÈmjG{rÝ°KÞ¯-t±ç,¨ºIèÂ'Èq©Ý¢ØZ·¶¬)Z+a¶½éí^J¶§X¤xéĽéí ê좹hq«^v)Ú²øj·jëh×6#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $Curspos Global $WinPos Global $spd=10 GUICreate('WinTest', 400, 20, @DesktopWidth/2-200 , -20, $WS_POPUP,$WS_EX_TOPMOST ) ;Create a centered GUI on top [hidden] of the screen. ;QUIT BUTTON $quit=GUICtrlCreateButton('Quit', 350, 1, 50, 20) GUICtrlSetOnEvent($quit, 'Quit') ;LOOP TO CHECK CURSOR POS------------------------------------------------------------- While 1 $Curspos=MouseGetPos() $WinPos=WinGetPos('WinTest') If $Curspos[1]<40 Then ;If the cursor is located in a specific area Call('Appear') Else Call('Disapear') EndIf GUISetState(@SW_SHOW) Wend ;/LOOP TO CHECK CURSOR POS------------------------------------------------------------- Func Appear() While $WinPos[1]<0 $WinPos=WinGetPos('WinTest') WinMove('WinTest', '', $WinPos[0], $WinPos[1]+1) Sleep($spd) ;Speed modification WEnd EndFunc Func Disapear() While $WinPos[1]>-20 $WinPos=WinGetPos('WinTest') WinMove('WinTest', '', $WinPos[0], $WinPos[1]-1) Sleep($spd) ;Speed modification WEnd EndFunc Func Quit() Exit 0 EndFunc Thanks for your precious help Edited April 28, 2007 by eHrgo Sorry for my Bad English. Link to comment Share on other sites More sharing options...
eHrgo Posted April 28, 2007 Author Share Posted April 28, 2007 Wow.. You didn't read half of my script. My two funcs Appear/disapear move the windows like a Autohide window. Try it I cant really explain it. Sorry for my Bad English. Link to comment Share on other sites More sharing options...
martin Posted April 28, 2007 Share Posted April 28, 2007 Wow.. You didn't read half of my script. My two funcs Appear/disapear move the windows like a Autohide window. Try it I cant really explain it. This is a way to amke the window move but only 1 pixel for every loop of the main while loop. This means that other things can be done while the window is moving but then the window movement will be jerky. The other way to do it is to have a seperate script which you call to set the window position. expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $Curspos Global $WinPos Global $spd=10 Global $startpd, $startpu GUICreate('WinTest', 400, 20, @DesktopWidth/2-200 , -20, $WS_POPUP,$WS_EX_TOPMOST );Create a centered GUI on top [hidden] of the screen. ;QUIT BUTTON $quit=GUICtrlCreateButton('Quit', 350, 1, 50, 20) GUICtrlSetOnEvent($quit, 'Quit') GUISetState(@SW_SHOW) $pulleddown = False $pullingdown = False $pullingup = False $pulledup = True While 1 setposition() ;do other things here Wend Func setposition() $Curspos=MouseGetPos() $WinPos=WinGetPos('WinTest') If $Curspos[1]<40 And Not $pulleddown And Not $pullingdown Then $startpd = TimerInit() $pullingdown = True;If the cursor is located in a specific area $pullingup = False $pulledup = False Else If $Curspos[1] > 40 And Not $pulledup And Not $pullingup Then $pullingup = True $pulleddown = False $Pullingdown = False $startpu = TimerInit() EndIf EndIf If $pullingdown Then if TimerDiff($startpd) > $spd Then If $WinPos[1] > -1 Then $pullingdown = False $pulleddown = True Else WinMove('WinTest', '', $WinPos[0], $WinPos[1]+1) $startpd = TimerInit() EndIf EndIf Else If $pullingup Then If TimerDiff($startpu) > $spd Then If $WinPos[1] < -20 Then $pullingup = False $pulledup = True Else WinMove('WinTest', '', $WinPos[0], $WinPos[1]-1) $startpu = TimerInit() EndIf EndIf EndIf EndIf EndFunc #cs Func Appear() While $WinPos[1]<0 $WinPos=WinGetPos('WinTest') WinMove('WinTest', '', $WinPos[0], $WinPos[1]+1) Sleep($spd);Speed modification WEnd EndFunc Func Disapear() While $WinPos[1]>-20 $WinPos=WinGetPos('WinTest') WinMove('WinTest', '', $WinPos[0], $WinPos[1]-1) Sleep($spd);Speed modification WEnd EndFunc #ce Func Quit() Exit 0 EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 28, 2007 Share Posted April 28, 2007 Have AdlibEnable() do your window check independently of the rest of the script. This will check it twice per second: AdlibEnable("_CheckMousePos", 500) Func _CheckMousePos() $Curspos = MouseGetPos() ; $WinPos = WinGetPos('WinTest') ; <--- Variable $WinPos doesn't get used in this function? If $Curspos[1] < 40 Then ;If the cursor is located in a specific area Appear() Else Disapear() EndIf EndFunc ;==>_CheckMousePos P.S. You don't normally need Call() to run a function (see above). That's only for the rare occasions when you have to specify the function name with variables. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
martin Posted April 28, 2007 Share Posted April 28, 2007 Have AdlibEnable() do your window check independently of the rest of the script. This will check it twice per second: AdlibEnable("_CheckMousePos", 500) Func _CheckMousePos() $Curspos = MouseGetPos() ; $WinPos = WinGetPos('WinTest') ; <--- Variable $WinPos doesn't get used in this function? If $Curspos[1] < 40 Then ;If the cursor is located in a specific area Appear() Else Disapear() EndIf EndFunc ;==>_CheckMousePos P.S. You don't normally need Call() to run a function (see above). That's only for the rare occasions when you have to specify the function name with variables. PsaltyDS, that's a better idea than mine. I was trying to stop the window move taking the time from other functions but still give a smooth movement, but I see that I was getting things round the wrong way! Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
eHrgo Posted April 30, 2007 Author Share Posted April 30, 2007 Thanks a lot, i'm gonna try it. Sorry for my Bad English. 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