Jump to content

g_BonE

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Location
    GER

g_BonE's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. thanks rasim, that was exactly what i'd been looking for. where did you get the hex number for $BROADCAST_QUERY_DENY = 0x424D5144 from ?
  2. Just to bump this one up once more... i'm still looking for a way to send the BROADCAST_QUERY_DENY message via API. Anyone ?!?
  3. To get the info that system is rebooting i now use a OnAutoItExit() function and look at the @ExitMethod to be equal to 4. Func OnAutoItExit() Switch @EXITMETHOD Case 1 WriteToLog($g_szVersion&" exited by Close...") Case 2 WriteToLog($g_szVersion&" exited by SysTray...") Case 3 WriteToLog($g_szVersion&" exited by LogOff...") Case 4 WriteToLog($g_szVersion&" exited by Reboot...") WriteToLog("Rebooting system...") EndSwitch EndFunc
  4. what... nobody ? and i thought its such a nice example of what can be done with autoit
  5. hi folks: this i what im currently using to check standby messages from windows and react on them: #include "au3_inc\GuiConstantsEx.au3" $logfile = @ScriptDir&"\mp_standby-hook.log" $delystdby = 30 ;seconds to delay standby $mes = "" Global $WM_POWERBROADCAST = 536 Global $PBT_APMQUERYSUSPEND = 0x0000 Global $PBT_APMQUERYSTANDBY = 0x0001 Global $PBT_APMQUERYSUSPENDFAILED = 0x0002 Global $PBT_APMQUERYSTANDBYFAILED = 0x0003 Global $PBT_APMSUSPEND = 0x0004 Global $PBT_APMSTANDBY = 0x0005 Global $PBT_APMRESUMECRITICAL = 0x0006 Global $PBT_APMRESUMESUSPEND = 0x0007 Global $PBT_APMRESUMESTANDBY = 0x0008 Global $PBT_APMBATTERYLOW = 0x0009 Global $PBT_APMPOWERSTATUSCHANGE = 0x000A Global $PBT_APMOEMEVENT = 0x000B Global $PBT_APMRESUMEAUTOMATIC = 0x0012 Global $PBTF_APMRESUMEFROMFAILURE = 0x00000001 Global $ES_DISPLAY_REQUIRED = 0x00000002; zero the display's idle timer Global $ES_SYSTEM_REQUIRED = 0x00000001; zero the system's idle timer Global $ES_CONTINUOUS = 0x80000000; keep the display or system on (doesn't work?) $hGUI = GUICreate("Standby", 1,1,1,1,-1) GUIRegisterMsg($WM_POWERBROADCAST, "Standby") ;hook into win32 pm API GUISetState(@SW_MINIMIZE,$hGUI) $g_szVersion = "MP_StandBy-Hook" If WinExists($g_szVersion) Then Exit ; It's already running AutoItWinSetTitle($g_szVersion) WriteToLog($g_szVersion&" started...") While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch Sleep (60000) ; Sleep for a minute WEnd Func Standby($hWnd, $Msg, $wParam, $lParam) Switch $wParam Case $PBT_APMQUERYSUSPEND ; gets called first on standby request WriteToLog("PBT_APMQUERYSUSPEND received...") For $i=$delystdby to 1 Step -1 DllCall("kernel32.dll","int","SetThreadExecutionState","int", $ES_SYSTEM_REQUIRED) WriteToLog("Delaying Standby: "&$i&" s.") Sleep(1000) Next Case $PBT_APMSUSPEND ; gets called second on standby request WriteToLog("PBT_APMSUSPEND received...") WriteToLog("Entering Standby...") Case $PBT_APMRESUMEAUTOMATIC ; gets called first after resume WriteToLog("PBT_APMRESUMEAUTOMATIC received...") WriteToLog("Resuming from Standby..." Case $PBT_APMRESUMESUSPEND ; gets called second after resume WriteToLog("PBT_APMRESUMESUSPEND received...") WriteToLog("Checking MediaPortal...") Sleep(5000) If Not ProcessExists("mediaportal.exe") Then Run("c:\_mp\mediaportal.exe","c:\_mp") EndIf Sleep(5000) WriteToLog("Running RTC updater...") ShellExecute("timeupdate.au3","","c:\_tvtools\") Sleep(5000) WriteToLog("Faking user interaction...") $pos = MouseGetPos() MouseMove($pos[0]+50, $pos[1]+50) MouseMove($pos[0]-50, $pos[1]-50) MouseMove($pos[0], $pos[1]) Case $PBT_APMQUERYSTANDBY WriteToLog("PBT_APMQUERYSTANDBY received...") Case $PBT_APMQUERYSUSPENDFAILED WriteToLog("PBT_APMQUERYSUSPENDFAILED received...") Case $PBT_APMQUERYSTANDBYFAILED WriteToLog("PBT_APMQUERYSTANDBYFAILED received...") Case $PBT_APMRESUMECRITICAL WriteToLog("PBT_APMRESUMECRITICAL received...") Case $PBT_APMRESUMESTANDBY WriteToLog("PBT_APMRESUMESTANDBY received...") Case $PBT_APMSTANDBY WriteToLog("PBT_APMSTANDBY received...") Case $PBT_APMPOWERSTATUSCHANGE WriteToLog("PBT_APMPOWERSTATUSCHANGE received...") Case $PBT_APMOEMEVENT WriteToLog("PBT_APMOEMEVENT received...") Case Else WriteToLog("Some unknown standby related message received... WTF?") EndSwitch EndFunc Func WriteToLog($mes) $file=FileOpen($logfile,1) FileWrite($logfile,@MDAY&@MON&@YEAR&"-"&@HOUR&@MIN&@SEC&": "&$mes&@CRLF) FileClose($logfile) Endfunc ...i could use some guide on optimizing this baby and also maybe some of you API gods might help on how i could send the BROADCAST_QUERY_DENY message instead of using SetThreadExecutionState if it's feasible? Also if someone can show me how i can react on System booting and shutting down events ? Thanks in advance... g_
  6. hi there, i know i can create a NTFS junction via: If Not FileExists('C:\test1junc\') Then MsgBox(0, "", FileCreateNTFSLink("C:\test1\", "C:\test1junc\"),1) EndIfnow, how can i remove this junction ? If usingt FileDelete() i end up deleting both the folders (junction and source) , also overwriting the junction with an empty target wont work. Regards, g_
  7. /me smacks forehead.... Yes, sure, why didn't i think of that Thanks valuater !
  8. ... i was wondering if there is a way to snatch the current color of a control ( a label or button) and put it into a variable. my use for that would be to safe the current colors of a label, change it for some loop and then put it back to its original colors depending on the outcome of the loop. Help appreciated
  9. array-a-phobia!, thats the right word . i couldnt think my head into doing what i wanted with an array tho it seems like a really nice way. i ended up using a if-then-else loop over the 8 possible enries similar to this: if count >0 then ;only one entry $ypos1=$ypos1 endif if count >1 then ;2 entries $ypos2=$ypos1+42 endif if ;3 entries $ypos3=$ypos1+84 endif ;...and so on thanks for the quick replies and helpful information. it's much appreciated !
  10. Guru's once again i came across a little problem i cant solve myself. im trying to modify the name of a variable according to the return of a for-next-loop: Dim $MyCount=4 Dim $ypos1=719 For $i=2 to $MyCount+2 $ypos&$i=$ypos1+42 Next ...is this possible at all ?
  11. I was able to do what i wanted via PixelSearch. Now, how can i create a PixelChecksum of a certain are on the screen and then use it to find that exact location on the screen again ? Draft: $bla=CreatePixelChecksum(screenarea) LocateChecksum(screen,$bla) Thanks folks.
  12. ...eagerly awaiting the new version. Keep it up JeB !
  13. autoit3dir=$(SciteDefaultHome)\..\Beta This worked very nice Thanks for the tips!
  14. is there some way to compare two PixelChecksum's in a more "diffuse" way ? I'd like to know how to simulate the PixelSearch Shade-Variation when using PixelChecksum. This is needed for some simple OCR experiment for a game.
  15. yeah i'd like a real world example on using that analizer.dll too i just cant get my head into the examples included with it, and actually none are working at all so far.
×
×
  • Create New...