Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/20/2016 in all areas

  1. MrCreatoR

    MouseOnEvent UDF!

    This UDF allows to set an events handler for Mouse device. The beginning... I searched for a way to disable the Mouse Primary click, and be able to call some function when the click event is received... Big thanks to amel27 for this one, i only organized the whole stuff to UDF style. Example: #include <GUIConstantsEx.au3> #include "MouseOnEvent.au3" HotKeySet("{ESC}", "_Quit") _Example_Intro() _Example_Limit_Window() Func _Example_Intro() MsgBox(64, "Attention!", "Let's set event function for mouse wheel *scrolling* up and down", 5) ;Set event function for mouse wheel *scrolling* up/down and primary button *down* action (call our function when the events recieved) _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT, "_MouseWheel_Events") _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT, "_MouseWheel_Events") _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event") Sleep(3000) ;UnSet the events _MouseSetOnEvent($MOUSE_WHEELSCROLLDOWN_EVENT) _MouseSetOnEvent($MOUSE_WHEELSCROLLUP_EVENT) _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ToolTip("") MsgBox(64, "Attention!", "Now let's disable Secondary mouse button up action, and call our event function.", 5) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseSecondaryUp_Event", 0, 1) Sleep(5000) _MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) ToolTip("") EndFunc Func _Example_Limit_Window() Local $hGUI = GUICreate("MouseOnEvent UDF Example - Restrict events on specific window") GUICtrlCreateLabel("Try to click on that specific GUI window", 40, 40, 300, 30) GUICtrlSetFont(-1, 12, 800) GUICtrlCreateLabel("Press <ESC> to exit", 10, 10) GUISetState() _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT, "_MousePrimaryDown_Event", $hGUI) ;A little(?) bugie when you mix different events :( ;_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT, "_MouseSecondaryUp_Event", $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN MsgBox(0, "", "Should not be shown ;)") EndSwitch WEnd _MouseSetOnEvent($MOUSE_PRIMARYDOWN_EVENT) ;_MouseSetOnEvent($MOUSE_SECONDARYUP_EVENT) EndFunc Func _MouseWheel_Events($iEvent) Switch $iEvent Case $MOUSE_WHEELSCROLLDOWN_EVENT ToolTip("Wheel Mouse Button (scrolling) DOWN Blocked") Case $MOUSE_WHEELSCROLLUP_EVENT ToolTip("Wheel Mouse Button (scrolling) UP Blocked") EndSwitch Return $MOE_BLOCKDEFPROC ;Block EndFunc Func _MousePrimaryDown_Event() ToolTip("Primary Mouse Button Down Blocked") Return $MOE_BLOCKDEFPROC ;Block EndFunc Func _MouseSecondaryUp_Event() ToolTip("Secondary Mouse Button Up Blocked") EndFunc Func _Quit() Exit EndFunc Available Events Constants: ------------------------------------------ CHANGELOG: Download: Attached: MouseOnEvent_2.4.zip Old version: MouseOnEvent.zip - v2.3 MouseOnEvent_2.1.zip MouseOnEvent_2.0.zip MouseOnEvent_UDF_1.9.zip MouseSetOnEvent_UDF_1.8.zip MouseSetOnEvent_UDF_1.7.zip MouseSetOnEvent_UDF_1.6.zip MouseSetOnEvent_UDF_1.5.zip MouseSetOnEvent_UDF_1.4.zip MouseSetOnEvent_UDF_1.3.zip Previous downloads: 146 + 200 + 804 MouseOnEvent.zip MouseOnEvent.zip
    1 point
  2. careca

    Script debugging

    The problem is that you had $filelist0 reading a location not set by the parameter, it is above the cmdline therefor it will retrieve an error. Move this bit to under the cmd line like so: If $cmdline[0]>0 Then $maplocatie= $cmdline[1] Switch $maplocatie Case "" Assign("maplocatie", $maplocatie) EndSwitch EndIf $filelist0= _fileListToArrayRec($maplocatie, "*" ,$FLTAR_FILES,$FLTAR_NORECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) $filelist1= _fileListToArrayRec($maplocatie, "*" ,$FLTAR_FILES,$FLTAR_RECUR, $FLTAR_NOSORT, $FLTAR_FULLPATH) Now it will set the var $maplocatie to something, a folder, and it will check how many files there are there.
    1 point
  3. Yes an ExitLoop with a working example. #include <MsgBoxConstants.au3> #include <Array.au3> ; -------- Create ini file ----------- FileWrite("Search.ini", _ "[Search Animals]" & @CRLF & _ "IGNORE_ERRORS=0" & @CRLF & _ "01=Dog" & @CRLF & _ "02=Cat" & @CRLF & _ "03=Bird" & @CRLF & _ "04=Fish") Sleep(1000) ; ------ End of Create ini file ------ _read() FileDelete("Search.ini") ; Tidy up Func _read() Local Const $hostfile = "Search.ini" $var = IniReadSection($hostfile, "Search Animals") If @error Then MsgBox(4096, "Error", "Unable to read section.") Else For $number = 1 To $var[0][0] ; MsgBox(4096, "", "Key: " & $var[$i][0] & @CRLF & "Value: " & $var[$number][1]) If $var[$number][1] == "Cat" Then MsgBox($MB_SYSTEMMODAL, "Search", "The " & $var[$number][1] & " was found at " & $var[$number][0], 5) ExitLoop ; Exits For - Next loop (stops) when search value, "Cat", is found? EndIf Next EndIf _ArrayDisplay($var, "Search Animals") EndFunc ;==>_read
    1 point
  4. Also if you say the safe word regexp will stop whatever it is doing to you
    1 point
  5. use GUICtrlSetState($Pic1, $GUI_DISABLE)
    1 point
  6. careca

    Menu for Web links

    Had to change firefox path a bit to suit mine: Case $Button1 ; INOTES $Website = 'google.pt' SplashTextOn($Storedivision & " Weblinks", "Loading iNotes" & @CRLF & "Please Wait...", "300", "100", "-1", "50", 0, "Arial Black", "12", "700") Run('C:\Program Files (x86)\Mozilla Firefox\firefox.exe ' & $Website, "", @SW_MAXIMIZE) WinSetOnTop ($Form1, '', 0) WinWaitActive('CLASS:[MozillaWindowClass]') SplashOff() WinSetOnTop ('CLASS:[MozillaWindowClass]', '', 0) Sleep(5000) ;Exit I think you get the idea.
    1 point
  7. It appears the _StringAddThousandsSepEx function from the old String.au3 UDF include file is still among the worst versions of StringAddThousandsSep functions out there. Try this one. It's a little better. ConsoleWrite(_StringAddThousandsSep("61234567890.54321") & @CRLF) ConsoleWrite(_StringAddThousandsSep("-$123123.50") & @CRLF) ConsoleWrite(_StringAddThousandsSep("-8123.45") & @CRLF) ConsoleWrite(_StringAddThousandsSep("-123.45") & @CRLF) ConsoleWrite(_StringAddThousandsSep("-$25") & @CRLF) ConsoleWrite(_StringAddThousandsSep("-$hello") & @CRLF) ; Instead of :- ; "Local $rKey = "HKCU\Control Panel\International" ; If $sDecimal = -1 Then $sDecimal = RegRead($rKey, "sDecimal") ; If $sThousands = -1 Then $sThousands = RegRead($rKey, "sThousand") ", ; ; $sThousands = ",", $sDecimal = "." are function parameters. ; Func _StringAddThousandsSep($sString, $sThousands = ",", $sDecimal = ".") Local $aNumber, $sLeft, $sResult = "", $iNegSign = "", $DolSgn = "" If Number(StringRegExpReplace($sString, "[^0-9\-.+]", "\1")) < 0 Then $iNegSign = "-" ; Allows for a negative value If StringRegExp($sString, "\$") And StringRegExpReplace($sString, "[^0-9]", "\1") <> "" Then $DolSgn = "$" ; Allow for Dollar sign $aNumber = StringRegExp($sString, "(\d+)\D?(\d*)", 1) If UBound($aNumber) = 2 Then $sLeft = $aNumber[0] While StringLen($sLeft) $sResult = $sThousands & StringRight($sLeft, 3) & $sResult $sLeft = StringTrimRight($sLeft, 3) WEnd $sResult = StringTrimLeft($sResult, 1); Strip leading thousands separator If $aNumber[1] <> "" Then $sResult &= $sDecimal & $aNumber[1] ; Add decimal EndIf Return $iNegSign & $DolSgn & $sResult ; Adds minus or "" (nothing)and Adds $ or "" EndFunc ;==>_StringAddThousandsSep
    1 point
×
×
  • Create New...