blindwig
Active Members-
Posts
753 -
Joined
-
Last visited
About blindwig
- Birthday 09/09/1977
Profile Information
-
Location
New York City
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
blindwig's Achievements
Universalist (7/7)
2
Reputation
-
Zedna reacted to a post in a topic: Drawing Bezier Curves From An Array Of Points
-
Cheekybugger reacted to a post in a topic: UDF: _FileGetTreeList, _FileFindAllR
-
I answered my own question, I found this page: http://msdn.microsoft.com/en-us/library/ms819773.aspx Very useful - has the error codes used for all Windows API calls.
-
I'm working on error handling routines, specifically for the _Service_Start and _Service_Stop functions. I found the MSDN pages for StartService and ControlService, here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms686321(v=vs.85).aspx http://msdn.microsoft.com/en-us/library/windows/desktop/ms682108(v=vs.85).aspx They list the error codes but not their actual values. some values were listed by a user on the bottom of the ControlService page. Anyone know where I can find the rest of the values?
-
Hello! Thank you for writing this! I am looking for a way to stop/start a service and wait for it, as neither the NET.EXE tool nor the SC.EXE tool seem to have that functionality. I'm writing my own tool in autoit, and using this very useful UDF to access the services. Thank you for writing it! I also wrote this function to help me debug, without always having to look up all those codes: ; #FUNCTION# ======================================================================================================================================================= ; Name...........: _Service_StatusToString ; Description ...: Translates the status codes of Service Query Status into English phrases ; Syntax.........: _Service_StatusToString(Const ByRef $aServiceStatus) ; Parameters ....: $aServiceStatus - An array of service status codes, returned by _Service_QueryStatus(). ; Requirement(s).: Constants defined in services.au3 ; Return values .: Success - Returns a string of descriptive lines delimited by CRLF ; Failure - Sets @error, returns English string description of error meaning ; Author ........: Mike Ratzlaff ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; ================================================================================================================================================================== Func _Service_StatusToString($aServiceStatus) If (Not IsArray($aServiceStatus)) or (UBound($aServiceStatus)<>9) Then SetError(1) Return "Value passed to _Service_StatusToString was not a ServiceStatusArray" EndIf Local $sOutput="" $sOutput &= $aServiceStatus[0] & @TAB & "Type of service" & @CRLF If $aServiceStatus[0] = $SERVICE_KERNEL_DRIVER Then $sOutput &= @TAB & "The service is a device driver" & @CRLF If $aServiceStatus[0] = $SERVICE_FILE_SYSTEM_DRIVER Then $sOutput &= @TAB & "The service is a file system driver" & @CRLF If $aServiceStatus[0] = $SERVICE_WIN32_OWN_PROCESS Then $sOutput &= @TAB & "The service runs in its own process" & @CRLF If $aServiceStatus[0] = $SERVICE_WIN32_SHARE_PROCESS Then $sOutput &= @TAB & "The service shares a process with other services" & @CRLF If $aServiceStatus[0] = BitOR($SERVICE_WIN32_OWN_PROCESS, $SERVICE_INTERACTIVE_PROCESS) Then $sOutput &= @TAB & "The service runs in its own process and can interact with the desktop" & @CRLF If $aServiceStatus[0] = BitOR($SERVICE_WIN32_SHARE_PROCESS, $SERVICE_INTERACTIVE_PROCESS) Then $sOutput &= @TAB & "The service shares a process with other services and can interact with the desktop" & @CRLF $sOutput &= $aServiceStatus[1] & @TAB & "The current state of the service:" & @CRLF If $aServiceStatus[1] = $SERVICE_STOPPED Then $sOutput &= @TAB & "The service has stopped" & @CRLF If $aServiceStatus[1] = $SERVICE_START_PENDING Then $sOutput &= @TAB & "The service is starting" & @CRLF If $aServiceStatus[1] = $SERVICE_STOP_PENDING Then $sOutput &= @TAB & "The service is stopping" & @CRLF If $aServiceStatus[1] = $SERVICE_RUNNING Then $sOutput &= @TAB & "The service is running" & @CRLF If $aServiceStatus[1] = $SERVICE_CONTINUE_PENDING Then $sOutput &= @TAB & "The service is about to continue" & @CRLF If $aServiceStatus[1] = $SERVICE_PAUSE_PENDING Then $sOutput &= @TAB & "The service is pausing" & @CRLF If $aServiceStatus[1] = $SERVICE_PAUSED Then $sOutput &= @TAB & "The service is paused" & @CRLF $sOutput &= $aServiceStatus[2] & @TAB & "The control codes the service accepts and processes in its handler function" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_STOP) Then $sOutput &= @TAB & "The service can be stopped" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_PAUSE_CONTINUE) Then $sOutput &= @TAB & "The service can be paused and continued" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_SHUTDOWN) Then $sOutput &= @TAB & "The service is notified when system shutdown occurs" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_PARAMCHANGE) Then $sOutput &= @TAB & "The service can reread its startup parameters without being stopped and restarted" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_NETBINDCHANGE) Then $sOutput &= @TAB & "The service is a network component that can accept changes in its binding without being stopped and restarted" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_HARDWAREPROFILECHANGE) Then $sOutput &= @TAB & "The service is notified when the computer's hardware profile has changed" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_POWEREVENT) Then $sOutput &= @TAB & "The service is notified when the computer's power status has changed" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_SESSIONCHANGE) Then $sOutput &= @TAB & "The service is notified when the computer's session status has changed" & @CRLF If BitAND($aServiceStatus[2], $SERVICE_ACCEPT_PRESHUTDOWN) Then $sOutput &= @TAB & "The service can perform preshutdown tasks" & @CRLF $sOutput &= $aServiceStatus[3] & @TAB & "The error code that the service uses to report an error that occurs when it is starting or stopping" & @CRLF If $aServiceStatus[3] = $ERROR_SERVICE_SPECIFIC_ERROR Then $sOutput &= "An error code specific to the service is stored in the next element" & @CRLF If $aServiceStatus[3] = $NO_ERROR Then $sOutput &= @TAB & "Service is running or service terminates normally" & @CRLF $sOutput &= $aServiceStatus[4] & @TAB & "The service-specific error code that the service returns when an error occurs while the service is starting or stopping" & @CRLF If $aServiceStatus[3]<>$ERROR_SERVICE_SPECIFIC_ERROR Then $sOutput &= @TAB & "This value is ignored" & @CRLF $sOutput &= $aServiceStatus[5] & @TAB & "The check-point value that the service increments periodically to report its progress during a lengthy start, stop, pause, or continue operation" & @CRLF If ($aServiceStatus[5]<>0) and not (($aServiceStatus[1]=$SERVICE_START_PENDING) or _ ($aServiceStatus[1]=$SERVICE_STOP_PENDING) or _ ($aServiceStatus[1]=$SERVICE_CONTINUE_PENDING) or _ ($aServiceStatus[1]=$SERVICE_PAUSE_PENDING)) Then $sOutput &= @TAB & "This value is not valid and should be zero" & @CRLF $sOutput &= $aServiceStatus[6] & @TAB & "The estimated time required for a pending start, stop, pause, or continue operation, in milliseconds" & @CRLF $sOutput &= $aServiceStatus[7] & @TAB & "The process identifier of the service (PID)" & @CRLF $sOutput &= $aServiceStatus[8] & @TAB & "Service ""system process"" status" & @CRLF If $aServiceStatus[8] = 0 Then $sOutput &= @TAB & "The service is running in a process that is not a system process, or it is not running" & @CRLF If $aServiceStatus[8] = $SERVICE_RUNS_IN_SYSTEM_PROCESS Then $sOutput &= @TAB & "The service runs in a system process that must always be running" & @CRLF Return $sOutput EndFunc and it can be used as such: $sServiceName="w3svc" $sComputerName="" $aServiceStatus = _Service_QueryStatus($sServiceName, $sComputerName) If Not @error Then ConsoleWrite(_Service_StatusToString($aServiceStatus)) EndIf
-
Passing variable to batch file
blindwig replied to PeanutJoe's topic in AutoIt General Help and Support
Use this AutoIt Script: #AutoIt3Wrapper_Change2CUI=y ConsoleWrite(@OSVersion & @CRLF) Compile it to an EXE, for example OSVER.EXE And then put this line in your batch to read the output: FOR /f %%A in ('OSVER.EXE') do SET OSVER=%%A -
Running autoit script executable from command prompt
blindwig replied to Kanit's topic in AutoIt General Help and Support
Found it in The answer is the compiler directive: #AutoIt3Wrapper_Change2CUI=y -
Running autoit script executable from command prompt
blindwig replied to Kanit's topic in AutoIt General Help and Support
Is there no way to do this from within the script? -
Cool clock! I just had to "fix" the eyes to follow the beer instead of rotation arbitrarily, cuz I'm a nut for geometry. I un-rotate the eyes every time before I rotate them, so that I can rotate them to an absolute degree instead of a delta. There is probably a better way to do this, but I just did this quickly to see how it would come out. Here's the code: ; Basic version of the clock ; No Sizing, Transparency or Menus #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 1) $Size = 600 $Wid = $Size $Hgt = $Size $Lx = 247 $Ly = 240 $Rx = 353 $Ry = 240 $HoursX = $Size/2 $HoursY = $Size/2 $MinsX = $Size/2 $MinsY = $Size/2 Global Const $deg = ACos(-1) / 180 Global $secs, $Mins, $Hours, $Angle = 6, $RightMatrix, $eX, $eY Global $StringX, $StringY Dim $LeftEyeRot[60]=[34, 41, 47, 53, 59, 64, 69, 73, 78, 82, 87, 91, 95, 99, 103, 107, 111, 115, 119, 123, 126, 130, 134, 138, 141, 145, 149, 153, 157, 161, 164, 168, 172, 176, 180, 184, 189, 193, 197, 202, 207, 211, 217, 222, 228, 234, 241, 248, 257, 266, 277, 289, 302, 317, 331, 345, 357, 8, 18, 26] Dim $RightEyeRot[60]=[325, 333, 341, 351, 2, 14, 28, 42, 57, 70, 82, 93, 102, 111, 118, 125, 131, 137, 142, 148, 152, 157, 162, 166, 170, 175, 179, 183, 187, 191, 195, 198, 202, 206, 210, 214, 218, 221, 225, 229, 233, 236, 240, 244, 248, 252, 256, 260, 264, 268, 272, 277, 281, 286, 290, 295, 300, 306, 312, 318] $secscale = 0.6 ;make secs pointer smaller or larger $hGUI = GUICreate("Work", $Wid, $Wid, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE)) ;GUICtrlSetCursor(-1, 2) If @OSBuild < 7600 Then WinSetTrans($hGUI,"", 0xFF) ; only use this if solid background GUISetState(@SW_SHOW) GUISetOnEvent(-3, "close") ;=========================================== _GDIPlus_Startup() #region Window BckBuffer $graphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) $bitmap = _GDIPlus_BitmapCreateFromGraphics($Wid, $Hgt, $graphics) $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap) #EndRegion $hPen1 = _GDIPlus_PenCreate(0xFF800010, 4) ;Pem for Lines $bitmap1 = _GDIPlus_BitmapCreateFromGraphics($Wid, $Hgt, $graphics) $backbuffer1 = _GDIPlus_ImageGetGraphicsContext($bitmap1) $Homer = _GDIPlus_ImageLoadFromFile("Homer No Pupils.png") $Eye = _GDIPlus_ImageLoadFromFile("Eye.png") $EyeW = _GDIPlus_ImageGetWidth($Eye) $EyeH = _GDIPlus_ImageGetHeight($Eye) $eX = $EyeW/2 $eY = $EyeH/2 $LeftMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($LeftMatrix, $Lx, $Ly) $RightMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($RightMatrix, $Rx, $Ry) $HoursPointer = _GDIPlus_ImageLoadFromFile("Hours Pointer.png") ;"Hours Pointer1.png" $HoursMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($HoursMatrix, $HoursX, $HoursY) $MinsPointer = _GDIPlus_ImageLoadFromFile("Mins Pointer.png") ;"Mins Pointer1.png" $MinsMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($MinsMatrix, $MinsX, $MinsY) $secPointer = _GDIPlus_ImageLoadFromFile("Secs Pointer.png") $secMatrix = _GDIPlus_MatrixCreate() Global $rot_mid_x = $size / 2 ; set rotation point Global $rot_mid_y = $size / 2 _GDIPlus_MatrixTranslate($secMatrix, $rot_mid_x, $rot_mid_y) ; move to rotation point ; * eyes and secs pointer have an offset because they are rotated in the original image * $secs=@Sec _GDIPlus_MatrixRotate($RightMatrix, $RightEyeRot[$Secs] + 90 + 12) ;start eyes at current Seconds _GDIPlus_MatrixRotate($LeftMatrix, $LeftEyeRot[$Secs] + 90 + 12) _GDIPlus_MatrixRotate($HoursMatrix, @HOUR * 30 - 6) ; current Hours _GDIPlus_MatrixRotate($MinsMatrix, @MIN * 6 - 6) ; current Minutes _GDIPlus_MatrixRotate($secMatrix, @SEC * 6 + 90 - 12) ;start pointer at current Seconds $fs = 20 $cX = $Wid/2 $cY = $Hgt/2 -10 $cX1 = $cX + 10 $Cy1 = $cY + 20 $Lx = $Wid/2 $Ly = $Hgt/2 $Lx1 = $Wid/2 $Ly1 = $Hgt/2 Global Const $radius = $Hgt * 0.85 Global Const $cR = $radius * 0.42, $cR1 = $cR * 1.1 Global Const $cR2 = $cR * 0.86, $cR3 = $cR * 0.96 Global Const $cR4 = $cR * 0.9 ; ========================================== Do _GDIPlus_GraphicsClear($backbuffer, 0x00FFFFFF) _GDIPlus_GraphicsDrawImageRect($backbuffer1, $Homer, 0, 0, $Wid, $Hgt) ;Homer Static Image if $secs <> @SEC then ;Reverse previous rotation Rotate($LeftMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, -1 * $LeftEyeRot[$secs]) Rotate($RightMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, -1 * $RightEyeRot[$secs]) ;Do current rotation $Secs = @SEC Rotate($LeftMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, $LeftEyeRot[$secs]) Rotate($RightMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, $RightEyeRot[$secs]) Rotate($HoursMatrix, $HoursPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) Rotate($MinsMatrix, $MinsPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) Rotate($secMatrix, $secPointer, $secScale, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, $Angle) Else Rotate($LeftMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, 0) ;no rotation, but image updated Rotate($RightMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, 0) Rotate($HoursMatrix, $HoursPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) Rotate($MinsMatrix, $MinsPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) Rotate($secMatrix, $secPointer, $secScale, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) EndIF If $Mins <> @MIN then ; Rotate($LeftMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, 0) ; Rotate($RightMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, 0) ; Rotate($HoursMatrix, $HoursPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) Rotate($MinsMatrix, $MinsPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, $Angle) Rotate($secMatrix, $secPointer, $secScale, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) $Mins = @MIN EndIF If $Hours <> @HOUR then Rotate($HoursMatrix, $HoursPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, $Angle) ; put it infront of secs pointer Rotate($LeftMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, 0) ;no rotation, but image updated Rotate($RightMatrix, $Eye, 1, $eX, $eY, $EyeW, $EyeH, 0) Rotate($HoursMatrix, $HoursPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, $Angle) Rotate($MinsMatrix, $MinsPointer, 1, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) Rotate($secMatrix, $secPointer, $secScale, $rot_mid_x, $rot_mid_y, $Wid, $Hgt, 0) $Hours = @HOUR EndIF _GDIPlus_GraphicsDrawImageRect($backbuffer1, $bitmap, 0, 0, $Wid, $Hgt) _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap1, 0, 0, $Wid, $Hgt) Sleep(100) Until 0 Func Rotate($Matrix, $Pointer, $scale, $midX, $midY, $Wid, $Hgt, $nAngle) _GDIPlus_MatrixRotate($Matrix, $nAngle, False) _GDIPlus_GraphicsSetTransform ($backbuffer, $Matrix) _GDIPlus_GraphicsDrawImageRect($backbuffer, $Pointer, -$midX *$scale, -$midY * $scale, $Wid * $scale, $Hgt * $scale) EndFunc Func close() _GDIPlus_MatrixDispose($LeftMatrix) _GDIPlus_MatrixDispose($RightMatrix) _GDIPlus_MatrixDispose($SecMatrix) _GDIPlus_MatrixDispose($MinsMatrix) _GDIPlus_MatrixDispose($HoursMatrix) _GDIPlus_GraphicsDispose($graphics) _GDIPlus_PenDispose($hPen1) _WinAPI_DeleteObject($bitmap) _WinAPI_DeleteObject($bitmap1) _GDIPlus_GraphicsDispose($backbuffer) _GDIPlus_GraphicsDispose($backbuffer1) _GDIPlus_Shutdown() Exit EndFunc ;==>close ; And only if you're morbidly curious, here is the code I wrote to generate the rotation arrays: #region Math Functions ;Have some Pi! Global Const $pi = 3.14159265358979 ;Find the angle of a point relative to the origin Func GetAnglePO($x, $y) Select Case $x > 0 If $y >= 0 Then Return ATan($y / $x) Else Return ATan($y / $x) + 2 * $pi EndIf Case $x = 0 If $y = 0 Then Return 0 ElseIf $y > 0 Then Return $pi / 2 Else Return 3 * $pi / 2 EndIf Case $x < 0 Return ATan($y / $x) + $pi EndSelect EndFunc ;Find the angle of a point relative to the first point Func GetAnglePP($x1, $y1, $x2, $y2) Return GetAnglePO($x2 - $x1, $y2 - $y1) EndFunc #endregion #Region Graphics Data ;Graphical Artifact Constants - these don't change unless the graphics files are altered/replaced ;The (x,y) for the point the second hand spins around $SecHandCenterX=300 $SecHandCenterY=300 ;the distance from the spin point of the second hand to the "Target", AKA the center of the beer bottle $SecHandLen=137 ;the (x,y) for the center of the eye on the left $LeftEyeX=247 $LeftEyeY=240 ;the (x,y) for the center of the eye on the right $RightEyeX=353 $RightEyeY=240 #endregion ;Arrays to hold the rotations for all 60 seconds Dim $LeftEyeRot[60],$RightEyeRot[60] ConsoleWrite("Secs"&@TAB&"Hand"&@TAB&"LEye"&@TAB&"REye"&@CRLF) for $secs=0 to 59 ;Figure the (x,y) coordinates for the Target $sechandrad=$pi*($secs-15)/30 $sechanddeg=$sechandrad*180/$pi $sechandx=$SecHandCenterX+$SecHandLen*Cos($sechandrad) $sechandy=$SecHandCenterY+$SecHandLen*Sin($sechandrad) ;Find the Angle for the Left Eye, change to degrees, rotate so that 0 is straight up $lefteyerad=GetAnglePP($lefteyex,$lefteyey,$sechandx,$sechandy) $LeftEyeDeg=$lefteyerad*180/$pi $LeftEyeRot[$secs]=mod(int($LeftEyeDeg+90),360) ;Find the Angle for the Right Eye, change to degrees, rotate so that 0 is straight up $righteyerad=GetAnglePP($righteyex,$righteyey,$sechandx,$sechandy) $RightEyeDeg=$RightEyeRad*180/$pi $RightEyeRot[$secs]=mod(int($RightEyeDeg+90),360) ;debug ConsoleWrite($secs & @TAB & $Secs * 6 & @TAB & $LeftEyeRot[$secs] & @TAB & $RightEyeRot[$Secs] & @CRLF) Next ;Left Eye Array ready for Cut'n'Paste ConsoleWrite("Dim $LeftEyeRot[60]=[") for $secs=0 to 59 ConsoleWrite($LeftEyeRot[$secs]) If $secs<59 Then ConsoleWrite(", ") Next ConsoleWrite("]" & @CRLF) ;Right Eye Array ready for Cut'n'Paste ConsoleWrite("Dim $RightEyeRot[60]=[") for $secs=0 to 59 ConsoleWrite($RightEyeRot[$secs]) If $secs<59 Then ConsoleWrite(", ") Next ConsoleWrite("]" & @CRLF)
-
Slightly faster (maybe?) but still unplayably slow
-
Hello, to anyone that's been here long enough to remember me! I got a sudden hankering to check out my old 360 Snake game a few days ago, so I downloaded it and the latest version of AuoIt, wondering if it would still work. More or less, it does. It requires adding includes for WindowsConstants and ComboConstants (as these used to be part of GUIConstants) Executing the script gave me mixed results: On my home computer, a 2-core 32-bit WindowsXP machine, the script crashes AutoIt right after the game starts On my work computer, a 4-core 64-bit Windows 7 machine, running under Autoit 32-bit, it also crashes On my work computer, running under AutoIt 64-bit, it runs but very slow I traced the crashes down to 4 lines in the FoodDraw() routine; calls to function "LineTo" in GDI32 need to have the last parameter removed. So for example this: DllCall($hDLL_GDI32, "int", "LineTo", "hwnd", $hd[0], "int", $Food[2], "int", $Food[3], "int", 0) changes to this: DllCall($hDLL_GDI32, "int", "LineTo", "hwnd", $hd[0], "int", $Food[2], "int", $Food[3]) The script no longer crashes, and runs fine on my 32-bit XP machine. It also no longer crashes on my 64-bit W7 machine in 32-bit mode, but as with 64-bit mode it runs the script very slowly. It still run very slowly on the 64-bit machine with AutoIt64 So all this leaves me with a few questions: Why did this extra parameter crash the latest version of AutoIt, and why did it not crash earlier versions? And why does it only crash 32-bit versions? Why does it run so slowly on my 64-bit machine?
-
Ah, I see it now. In the help page for _Timer_SetTimer is the example, which runs just fine of course, with 2 timer-called functions, declared thusly: Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime These functions have the 4 parameters, but as you stated, the help page fails to state that timer-called functions MUST have these parameters. OK, problem solved, thank you very much for your help.
-
Ah, I see it now. In the help page for _Timer_SetTimer is the example, which runs just fine of course, with 2 timer-called functions, declared thusly: Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime These functions have the 4 parameters, but as you stated, the help page fails to state that timer-called functions MUST have these parameters. OK, problem solved, thank you very much for your help.
-
Ah, I see it now. In the help page for _Timer_SetTimer is the example, which runs just fine of course, with 2 timer-called functions, declared thusly: Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime Func _UpdateProgressBar($hWnd, $Msg, $iIDTimer, $dwTime) #forceref $hWnd, $Msg, $iIDTimer, $dwTime These functions have the 4 parameters, but as you stated, the help page fails to state that timer-called functions MUST have these parameters. OK, problem solved, thank you very much for your help.
-
I am writing a simple script that will use a timer. I wrote most of the script, but when I add the timer, it freezes the script to the point where I have to End Task on it. Trying to figure out what is causing the freeze, I cut the script down to it's most basic pieces, but it is still freezing. Can someone tell me why? Here is the most basic code I have, which still freezes on my PC: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <timers.au3> $frmAutoClicker = GUICreate("AutoClicker", 105, 65, 192, 114) GUISetState(@SW_SHOW) Func DoNothing() EndFunc $tmrAutoCLick = _Timer_SetTimer($frmAutoClicker,2000,"DoNothing") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
-
I've written program that had that issue before. Instead of a static delay, wait until there is no input: Pseudo-code: ;Wait for no movement While MouseMovement() or KeysPressed() Sleep(50) Wend ;Main Loop, until movement While Not MouseMovement() or KeysPressed() ... Wend
-
More: ;Find the angle at point 2 between line 1-2 and line 2-3 Func GetAnglePPP($x1,$y1,$x2,$y2,$x3,$y3) $A1 = GetAnglePP($x2, $y2, $x1, $y1) $A2 = GetAnglePP($x2, $y2, $x3, $y3) $A3 = GetAngleAA($A1,$A2) Return $A3 EndFunc ;Finds a circle whose perimeter touches all three given points ;Success: ; Return = [CenterX, CenterY, Radius] ;Failure: ; Error = 1 ; Return = descriptive message Func GetCirclePPP($x1,$y1,$x2,$y2,$x3,$y3) Local $a, $b, $c, $d, $e, $f, $g Local $h, $k, $r Local $Return='', $Error=0 ;*** (x1-h)^2 + (y1-k)^2 = (x2-h)^2 + (y2-k)^2 $a = 2 * ($x2 - $x1) $b = 2 * ($y1 - $y2) $c = $x2 ^ 2 + $y2 ^ 2 - $x1 ^ 2 - $y1 ^ 2 ;*** h = (k * B + C) / A ;*** (x2-h)^2 + (y2-k)^2 = (x3-h)^2 + (y3-k)^2 $d = 2 * ($y3 - $y2) $e = 2 * ($x2 - $x3) $f = $x3 ^ 2 + $y3 ^ 2 - $x2 ^ 2 - $y2 ^ 2 ;*** k = (h * E + F) / D $g = ($a * $d - $b * $e) If ($g <> 0) And ($d <> 0) Then $h = ($b * $f + $c * $d) / $g $k = ($h * $e + $f) / $d $r = Sqrt(($x1 - $h) ^ 2 + ($y1 - $k) ^ 2) Dim $Return[3] = [$h, $k, $r] Else $Error = 1 $Return = 'Could not plot a circle on given points: (' & $x1 & ',' & $y1 & '), (' & $x2 & ',' & $y2 & '), (' & $x3 & ',' & $y3 & ')' EndIf SetError($Error) Return $Return EndFuncSee also: Drawing Bezier Curves From An Array Of Points