
upnorth
Active Members-
Posts
107 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
upnorth's Achievements

Adventurer (3/7)
0
Reputation
-
untested While 1 $msg = GuiGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 $File1 = @ScriptDir & '\Images\blue.bmp' Case $Picture_3, $Picture_4, $Picture_5, $Picture_6 GUICtrlSetImage( $msg, $File1) EndSwitch $GuiCursor = GUIGetCursorInfo() Switch $GuiCursor[4] Case $Picture_0, $Picture_1, $Picture_2 GuiCtrlSetImage( $GuiCursor[4], $Blue) For $i = 0 To 2 If Eval( 'Picture_' & $i) <> $GuiCursor[4] Then GuiCtrlSetImage( Eval( 'Picture_' & $i), $Blank) EndIf Next Case $Picture_3, $Picture_4, $Picture_5, $Picture_6 If $GuiCursor[3] Then GUICtrlSetImage( $GuiCursor[4], $Blank) EndIf EndSwitch WEnd Exit
-
#NoTrayIcon #include<misc.au3> Dim $right_state, $left_state, $user32 = DllOpen( 'user32') HotKeySet( '{PGUP}', '_LeftClick') HotKeySet( '{PGDN}', '_RightClick') ;HotKeySet( '{somekey}', 'quit') While 1 If $left_state And Not _IsPressed( 21, $user32) Then MouseUp( 'left') $left_state = False EndIf If $right_state And Not _IsPressed( 22, $user32) Then MouseUp( 'right') $right_state = False EndIf Sleep(100) WEnd Func _LeftClick() If $left_state Then Return MouseDown( 'left') $left_state = True EndFunc Func _RightClick() If $right_state Then Return MouseDown( 'right') $right_state = True EndFunc Func quit() Exit EndFunc Func OnAutoItExit() DllClose( $user32) EndFunc
-
you could draw to a memorydc, GUIRegisterMsg( $WM_PAINT,) , BitBlt from the memorydc. http://www.autoitscript.com/fileman/users/outeast/files/clock.au3 http://www.autoitscript.com/fileman/users/outeast/files/gdi32.au3 http://www.autoitscript.com/fileman/users/outeast/files/user32.au3
-
Drawing a rectangle during mouse movement
upnorth replied to pastl's topic in AutoIt General Help and Support
#include <Misc.au3> #include <GUIConstants.au3> Opt( 'GUIOnEventMode', 1) $UserDLL = DllOpen("user32.dll") $gui = GUICreate( '') GUISetOnEvent( $GUI_EVENT_CLOSE, 'quit') GUISetState() While 1 draw_label() WEnd Func draw_label() Local $MouseCoordMode, $Start_Pos, $Ausschnitt, $Mouse_Pos While 1 If _IsPressed("01", $UserDLL) Then $MouseCoordMode = Opt( 'MouseCoordMode', 2) $Start_Pos = MouseGetPos() $Ausschnitt = GUICtrlCreateLabel( 'text...', 0, 0, 1, 1, $SS_SUNKEN) GUICtrlSetBkColor( $Ausschnitt, 0) While _IsPressed("01", $UserDLL) $Mouse_Pos = MouseGetPos() GUICtrlSetPos( $Ausschnitt, $Start_Pos[0], $Start_Pos[1], $Mouse_Pos[0] - $Start_Pos[0], $Mouse_Pos[1] - $Start_Pos[1]) Sleep( 10) WEnd Opt( 'MouseCoordMode', $MouseCoordMode) Return $Ausschnitt EndIf Sleep( 10) WEnd EndFunc Func quit() Exit EndFunc Func onautoitexit() DllClose( $UserDLL) EndFunc -
GUICreate( $Title, @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_SYSMENU), BitOR( $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
-
To slow but... HotKeySet("{Numpad1}", '_count') HotKeySet("{ESC}", "Terminate") Dim $count = 0 Dim $timer = TimerInit() Dim $sounds = StringSplit( @WindowsDir & '\media\ding.wav|' & _ @WindowsDir & '\media\tada.wav|' & _ @WindowsDir & '\media\ringin.wav', '|') AdlibEnable( '_play', 200) While 1 Sleep(100) WEnd Func _play() If ($count > 0) And (TimerDiff( $timer) > 500) Then If $count <= $sounds[0] Then SoundPlay( $sounds[$count]) EndIf MsgBox( 0, '', $count) $count = 0 EndIf EndFunc Func _count() $count += 1 $timer = TimerInit() EndFunc Func Terminate() Exit 0 EndFunc
-
Func _restart() If @Compiled = 1 Then Run( FileGetShortName(@ScriptFullPath)) Else Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)) EndIf Exit EndFunc
-
Using a variable to define part of a GUI Contorl ID
upnorth replied to KSum's topic in AutoIt GUI Help and Support
GUICtrlRead( Eval ( "CB_" & $ApplicationName)) -
compare txt file contents
upnorth replied to B3TA_SCR1PT3R's topic in AutoIt General Help and Support
#include <file.au3> Opt("WinTitleMatchMode", 2) Dim $filename = "C:\popup.txt", $filesize[2], $filecont[1] While 1 $filesize[0] = FileGetSize( $filename) If $filesize[0] <> $filesize[1] Then $filesize[1] = $filesize[0] _FileReadToArray( $filename, $filecont) ;~ ToolTip( $filesize[0] & " - " & $filesize[1], 0, 0) EndIf For $i = 1 To $filecont[0] If $filecont[$i] <> "" Then WinKill( $filecont[$i]) EndIf Sleep( 1) Next Sleep( 50) WEnd 14623_test.au3 -
maybe while 1 for $i = 1 to 5 send("{F6}") sleep( 2000) next send("{F1]") sleep( "a certain amount of seconds") send("{F1}") sleep( 2000) wend
-
You can go to the left or right settings menu and pick mouse.Yes you can modify it if you want to.
-
; AutoItCOM 3.1.1.x beta ; ; COM Test file ; ; Test usage of Events with SAPI ; ; NOTE: To be able to run this example, you must first ; download and install the Microsoft SAPI SDK 5.1 ; http://www.microsoft.com/speech/download/sdk51/ ; ; See also: http://www.microsoft.com/speech/techinfo/apioverview/ ; ; And..READ the documentation carefully! Speech recognition is very complex stuff ! #include "GUIConstants.au3" ; Create a simple GUI for our output GUICreate ( "Event Speech API Test", 640, 480 ) $GUIEdit=GUICtrlCreateEdit ( "Debug Log:" & @CRLF, 10, 10 , 600 , 400 ) GUISetState () ;Show GUI $RecoContext=ObjCreate("SAPI.SpSharedRecoContext") if @error then Msgbox(0,"","Error opening $RecoContext: " & @error) exit endif ; Initialize our Event Handler ; Note: The default outgoing event interface will be: _ISpeechRecoContextEvents $SinkObject=ObjEvent($RecoContext,"MYEvent_") if @error then GUICtrlSetData ( $GUIEdit, "ObjEvent error: " & @error & @CRLF , "append" ) else GUICtrlSetData ( $GUIEdit, "ObjEvent created Successfully!" & @CRLF , "append" ) ;Imported from: SAPI.H $SPRS_INACTIVE = 0 $SPRS_ACTIVE = 1 $SGDSActive=$SPRS_ACTIVE $SGDSInactive=$SPRS_INACTIVE $Grammar = $RecoContext.CreateGrammar(1) $Grammar.Dictationload $Grammar.DictationSetState($SGDSActive) ; Dictation starts here...you may speak now ! GUICtrlSetData ( $GUIEdit, "You have 10 seconds speaking time now...open your microphone and say something !" & @CRLF , "append" ) sleep(10000) ; Stop dictation $Grammar.DictationSetState($SGDSInactive) endif sleep (5000); Some events arrive late... GUICtrlSetData ( $GUIEdit, @CRLF & "End of dictation time." & @CRLF , "append" ) GUICtrlSetData ( $GUIEdit, "You may close this window now !" & @CRLF , "append" ) ; Waiting for user to close the window While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend GUIDelete () exit ;-------------------- ; SAPI Event functions Func MYEvent_StartStream($StreamNumber, $StreamPosition) ; StreamNumber As Long, ; StreamPosition As Variant GUICtrlSetData ( $GUIEdit, "StartStream(): StreamNumber is:" & $StreamNumber & @CRLF , "append" ) EndFunc Func MYEvent_Hypothesis($StreamNumber,$StreamPosition,$Result ) ; StreamNumber As Long, ; StreamPosition As Variant, ; Result As ISpeechRecoResult GUICtrlSetData ( $GUIEdit, "Hypothesis(): Hypothized text is: " & $Result.PhraseInfo.GetText & @CRLF , "append" ) EndFunc Func MYEvent_Interference($StreamNumber,$StreamPosition,$Interference) ; StreamNumber As Long, ; StreamPosition As Variant, ; Interference As SpeechInterference GUICtrlSetData ( $GUIEdit, "Interference(): StreamNumber is:" & $StreamNumber & @CRLF , "append" ) EndFunc Func MYEvent_Recognition($StreamNumber,$StreamPosition,$RecognitionType,$Result) ; StreamNumber As Long, ; StreamPosition As Variant, ; RecognitionType As SpeechRecognitionType, ; Result As ISpeechRecoResult GUICtrlSetData ( $GUIEdit, "Recognition(): Recognized text is: " & $Result.PhraseInfo.GetText & @CRLF , "append" ) EndFunc ; SAPI has MANY more Events, but we won't use these here Func MYEvent_SoundEnd($StreamNumber,$StreamPosition) ; StreamNumber As Long, ; StreamPosition As Variant ;GUICtrlSetData ( $GUIEdit, "SoundEnd(): StreamNumber is:" & $StreamNumber & @CRLF , "append" ) EndFunc Func MYEvent_EndStream($StreamNumber,$StreamPosition,$StreamReleased) ; StreamNumber As Long, ; StreamPosition As Variant, ; StreamReleased As Boolean ; GUICtrlSetData ( $GUIEdit, "EndStream(): StreamNumber is:" & $StreamNumber & @CRLF , "append" ) ; GUICtrlSetData ( $GUIEdit, "EndStream(): StreamReleased is:" & $StreamReleased & @CRLF , "append" ) EndFunc Func MYEvent_SoundStart($StreamNumber,$StreamPosition) ; StreamNumber As Long, ; StreamPosition As Variant ;GUICtrlSetData ( $GUIEdit, "SoundStart(), StreamNumber is: " & $StreamNumber & @CRLF , "append" ) ;GUICtrlSetData ( $GUIEdit, "SoundStart(): StreamPosition is:" & $StreamPosition & @CRLF , "append" ) EndFunc Func MYEvent_PhraseStart($StreamNumber,$StreamPosition) ; StreamNumber As Long, ; StreamPosition As Variant ;GUICtrlSetData ( $GUIEdit, "PhraseStart(): StreamNumber is:" & $StreamNumber & @CRLF , "append" ) EndFunc In the beta tests.
-
MouseMove(x ,y ,0) should be as fast as SetCursorPos but it looks like it is about 60 to 70 times slower useing thius test. ;~ #include<user32.au3> Opt("MouseClickDelay", 0) ;10 milliseconds Opt("MouseClickDownDelay", 0) ;10 milliseconds Opt("MouseClickDragDelay", 0);250 milliseconds ;~ I dont think these affect mousemove but just incase :) $left = (@DesktopWidth - 1) $bottom = (@DesktopHeight - 1) $mm = 20 $scp = 20 $tests = 25 $beep_delay = 1 $c = 0 Dim $timer[3], $timera[3], $dll = DllOpen( "user32.dll") #region - tests $timer[0] = TimerInit() For $it = 1 to $tests beep( 2500, $beep_delay) $timer[1] = TimerInit() For $i = 1 To $mm MouseMove( Random( 0, $left, 1), Random( 0, $bottom, 1), 0) Next $timer[1] = TimerDiff($timer[1]) beep( 2500, $beep_delay) $timer[2] = TimerInit() For $i = 1 To $scp _SetCursorPos( Random( 0, $left, 1), Random( 0, $bottom, 1), $dll) Next $timer[2] = TimerDiff($timer[2]) beep( 2500, $beep_delay) $c += 1 $timera[1] += $timer[1] $timera[2] += $timer[2] Next #endregion $timera[0] = "ms=" & Int(TimerDiff($timer[0])) $timera[1] = "ms=" & Int($timera[1] / $tests) $timera[2] = "ms=" & Int($timera[2] / $tests) DllClose( $dll) MsgBox( 0, "Average out of " & $c & " tests:", "MouseMove( random, random, 0) * " & $mm & ": " & $timera[1] & @LF _ & "_SetCursorPos( random, random) * " & $scp & ": " & $timera[2] & @LF & "Total test time: " & $timera[0]) Func _SetCursorPos( $x, $y, $dll_h = "user32.dll") ;~ http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/setcursorpos.asp Local $return = DllCall( $dll_h, "int", "SetCursorPos", "int", $x, "int", $y) Return $return[0] EndFunc Results... --------------------------- Average out of 25 tests: --------------------------- MouseMove( random, random, 0) * 20: ms=312 _SetCursorPos( random, random) * 20: ms=4 Total test time: ms=9002 ... MouseMove( random, random, 0) * 20: ms=313 _SetCursorPos( random, random) * 20: ms=4 Total test time: ms=9017 ... MouseMove( random, random, 0) * 20: ms=313 _SetCursorPos( random, random) * 20: ms=5 Total test time: ms=9010
-
;~ #include<user32.au3> Opt("MouseClickDelay", 0) ;10 milliseconds Opt("MouseClickDownDelay", 0) ;10 milliseconds Opt("MouseClickDragDelay", 0);250 milliseconds ;~ I dont think these affect mousemove but just incase :) $left = (@DesktopWidth - 1) $bottom = (@DesktopHeight - 1) $mm = 250 $scp = 5000 Dim $timer[3], $dll = DllOpen( "user32.dll") #region - tests beep( 2500, 100) $timer[1] = TimerInit() For $i = 1 To $mm MouseMove( Random( 0, $left, 1), Random( 0, $bottom, 1), 0) Next $timer[1] = TimerDiff($timer[1]) beep( 2500, 100) $timer[2] = TimerInit() For $i = 1 To $scp _SetCursorPos( Random( 0, $left, 1), Random( 0, $bottom, 1), $dll) Next $timer[2] = TimerDiff($timer[2]) beep( 2500, 100) #endregion DllClose( $dll) MsgBox( 0, "Test complete.", "MouseMove( random, random, 0) * " & $mm & ": " & $timer[1] & @LF _ & "_SetCursorPos( random, random) * " & $scp & ": " & $timer[2]) Func _SetCursorPos( $x, $y, $dll_h = "user32.dll") ;~ http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/setcursorpos.asp Local $return = DllCall( $dll_h, "int", "SetCursorPos", "int", $x, "int", $y) Return $return[0] EndFunc