Leaderboard
Popular Content
Showing content with the highest reputation on 04/08/2018 in all areas
-
How do I filter a string by using Regexp
Earthshine and one other reacted to jchd for a topic
I highly recommend you use http://regex101.com/ to try patterns and get a detailed explanation about their meaning. Also offers a debugging mode to see how things work step by step.2 points -
TAMIRI, I would have thought this better - you quit the For...Next loop immediately, whereas your version runs the loop for 1000 times regardless: For $x = 1 to 1000 If $bInterrupt Then ExitLoop Else Sleep(500) ConsoleWrite("again " & $x & @CRLF) EndIf Next M231 point
-
How to get output of Run
HamidZaeri reacted to Danyfirex for a topic
Hello. RunWait Return the procress Exit Code. check StdoutRead and StderrRead in help file. Saludos1 point -
Something like this? : ;This will become file name $sNewImageFileName = StringFormat("%04i%02i%02i_%02i%02i%02i.jpg",$aMyDate[1],$aMyDate[2],$aMyDate[3],$aMyTime[1],$aMyTime[2],$aMyTime[3]) Jos1 point
-
A script to download and install the latest stable version of AutoIt
Xandy reacted to argumentum for a topic
I figure that is not "a" remote PC, but to run the Scite/AutoIt IDE anywhere, and if my guts are right you may want to create a portable "Scite/AutoIt IDE" environment. Now, getting the latest and greatest is not a very good idea, as it may break your existing scripts due to the evolution of the language and UDFs,1 point -
Help my one-hit-wonder!
argumentum reacted to Jos for a topic
Nice ... try this version and find the difference #include <WindowsConstants.au3> #include <WinAPI.au3> #include <StaticConstants.au3> MagWindow() MagWindow() ; Magnifier-Color-Picker.. ; Props to McBarby for the cross-hairs. Func MagWindow() Global $iMagZoom = 5 Global $iMagWidth = Ceiling(100 / $iMagZoom) Global $iMagHeight = Ceiling(100 / $iMagZoom) Global $hDCDesk = 0, $hDCZoom = 0, $hPen = 0 Global $hUser32 = DllOpen("user32.dll") Global $hGDI32 = DllOpen("gdi32.dll") Global $pixel_color, $mag_open = False Local $mX = 0, $mY = 0 Global $hCross = GUICreate('', 48, 48, -1, -1, $WS_POPUP, $WS_EX_TOPMOST) WinSetTrans($hCross, '', 0) GUISetCursor(3, 1, $hCross) Global $hZoom = GUICreate("MagPicker", $iMagWidth * $iMagZoom, $iMagHeight * $iMagZoom, _ MouseGetPos(0), MouseGetPos(1), $WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST) Global $mag_label = GUICtrlCreateLabel("placehold", (($iMagHeight * $iMagZoom) / 2) + 2, ($iMagHeight * $iMagZoom) - 13, _ (($iMagHeight * $iMagZoom) / 2) - 3, 12, $SS_RIGHT) ; put this after the GUICreate()s so that it will not error on startup with mouse already moving. (now trapped! but we will leave them here.) Global $__hMouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") Global $__hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($__hMouseProc), _WinAPI_GetModuleHandle(0)) GUISetState(@SW_SHOW, $hCross) GUISetState(@SW_SHOW, $hZoom) $mag_open = True ; once at start, then from the mouse-callback-function.. _Magnify() While $mag_open Sleep(50) $mX = MouseGetPos(0) $mY = MouseGetPos(1) $pixel_color = Hex(PixelGetColor($mX, $mY), 6) GUICtrlSetData($mag_label, $pixel_color) WEnd GUIDelete($hZoom) GUIDelete($hCross) ReleaseHooks() EndFunc ;==>MagWindow Func _Magnify($_iX = -1, $_iY = -1, $reset = False) Local Static $fInit = True If $fInit Then $fInit = False $hDCDesk = (DllCall($hUser32, "int", "GetDC", "hwnd", 0))[0] $hDCZoom = (DllCall($hUser32, "int", "GetDC", "hwnd", $hZoom))[0] $hPen = (DllCall($hGDI32, "int", "CreatePen", "int", 0, "int", 3, "int", 0x008b9094))[0] ; 0=PS_SOLID, dark-blue (0x00BBGGRR) DllCall($hGDI32, "int", "SelectObject", "int", $hDCZoom, "hwnd", $hPen) $_iX = MouseGetPos(0) $_iY = MouseGetPos(1) EndIf Local $iW = $iMagWidth * $iMagZoom, $iH = $iMagHeight * $iMagZoom If Not @error Then DllCall($hGDI32, "int", "StretchBlt", "int", $hDCZoom, "int", _ 0, "int", 0, "int", $iW, "int", $iH, "int", $hDCDesk, "int", _ $_iX - $iMagWidth / 2, "int", $_iY - $iMagHeight / 2, "int", $iMagWidth, "int", $iMagHeight, _ "long", $SRCCOPY) ; draw the crosshair (start x, start y, end x, end y) _GDI32_DrawLine($hDCZoom, ($iW / 2) - 2, $iH / 8, ($iW / 2) - 2, 4 * ($iH / 8) - 6, $hGDI32) ; vertical top _GDI32_DrawLine($hDCZoom, ($iW / 2) - 2, 5 * ($iH / 8) - 10, ($iW / 2) - 2, 7 * ($iH / 8), $hGDI32) ; vertical bottom _GDI32_DrawLine($hDCZoom, $iW / 8, ($iH / 2) - 2, (3 * ($iW / 8)) + 6, ($iH / 2) - 2, $hGDI32) ; horizontal left _GDI32_DrawLine($hDCZoom, 4 * ($iW / 8) + 3, ($iH / 2) - 2, 7 * ($iW / 8), ($iH / 2) - 2, $hGDI32) ; horizontal right EndIf If $reset Then $fInit = True EndIf EndFunc ;==>_Magnify Func _GDI32_DrawLine(ByRef $_hDC, $_iX0, $i_Y0, $_iX1, $i_Y1, $_hDll = -1) If $_hDll = -1 Then $_hDll = "gdi32.dll" Local $tCurrent = DllStructCreate("struct; long X;long Y; endstruct") DllCall($_hDll, "int", "MoveToEx", "int", $_hDC, "int", $_iX0, "int", $i_Y0, "ptr", DllStructGetPtr($tCurrent)) DllCall($_hDll, "int", "LineTo", "int", $_hDC, "int", $_iX1, "int", $i_Y1) Return $tCurrent EndFunc ;==>_GDI32_DrawLine Func _MouseProc($_nCode, $_wParam, $_lParam) Local $tMSLLHOOKSTRUCT = DllStructCreate("struct; long X;long Y; endstruct; " & _ "DWORD mouseData; DWORD flags; DWORD time; ULONG_PTR dwExtraInfo;endstruct", $_lParam) If $_nCode < 0 Then Return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam) Local $iX = $tMSLLHOOKSTRUCT.X, $iY = $tMSLLHOOKSTRUCT.Y Switch $_wParam Case $WM_LBUTTONDOWN CloseMag() Case $WM_MOUSEMOVE If Not $mag_open Then Return WinMove($hCross, "", $iX - 24, $iY - 24) Local $iXz = ($iX + 24 + $iMagWidth * $iMagZoom > @DesktopWidth) ? $iX - (24 + $iMagWidth * $iMagZoom) : $iX + 24 Local $iYz = ($iY + 24 + $iMagHeight * $iMagZoom > @DesktopHeight) ? $iY - (24 + $iMagHeight * $iMagZoom) : $iY + 24 WinMove($hZoom, "", $iXz + $iMagWidth / 2, $iYz) _Magnify($iX, $iY) EndSwitch Return _WinAPI_CallNextHookEx($__hHook, $_nCode, $_wParam, $_lParam) EndFunc ;==>_MouseProc Func ReleaseHooks() _Magnify(Default, Default, True) DllCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", $hPen) DllCall($hUser32, "int", "ReleaseDC", "int", $hDCDesk, "hwnd", 0) DllCall($hUser32, "int", "ReleaseDC", "int", $hDCZoom, "hwnd", 0) DllClose($hUser32) DllClose($hGDI32) _WinAPI_UnhookWindowsHookEx($__hHook) DllCallbackFree($__hMouseProc) EndFunc ;==>ReleaseHooks Func CloseMag() ; called by mouse left click $mag_open = False EndFunc ;==>CloseMag Jos1 point -
Hello I think you can compile AutoUpdateIt.au3 and call it with the following parameters. AutoUpdateIt.exe /release /silent Saludos1 point
-
A script to download and install the latest stable version of AutoIt
Earthshine reacted to Danp2 for a topic
Have you considered using Chocolatey for this task? Here's an article that describes the process.1 point -
Would this fit the bill? Local $strLine = "whatever : whatsoever [100.11 Q9, c, 5]" Local $filterString = StringRegExpReplace($strLine, ".*\[(\d+\.\d+\s)\D*(\d+).*", "$1$2") MsgBox(0, "", ">" & $filterString & "<")1 point
-
You could add some logging so that you can narrow down where the error is occurring. Just looking at the code, I only see the one instance of _IELoadWait. You may want to try changing it to the following to see if that helps -- _IELoadWait($TagWindow)1 point
-
Yirrlaar, How about this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $StartButton = 0 Global $PauseButton = 0 Global $StopButton = 0 Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 250, 250) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Start = GUICtrlCreateButton("START", 10, 10, 80, 30) GUICtrlSetOnEvent($Start, "StartUp") $Pause = GUICtrlCreateButton("PAUSE", 10, 50, 80, 30) GUICtrlSetOnEvent($Pause, "PauseThis") $Stop = GUICtrlCreateButton("STOP", 10, 90, 80, 30) GUICtrlSetOnEvent($Stop, "STOPThis") GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Sleep(10) WEnd Func _Interrupt_Sleep($iDelay) Local $iBegin = TimerInit() Do Sleep(10) If $StopButton Then Return "Stop" ElseIf $PauseButton Then Return "Pause" ElseIf $StartButton Then Return "Start" EndIf Until TimerDiff($iBegin) > $iDelay Return "" EndFunc ;==>_Interrupt_Sleep Func StartUp() $StartButton = 0 For $i = 1 To 100 ConsoleWrite("-StartUp Running - " & $i & @CRLF) Switch _Interrupt_Sleep(1000) Case "Stop" $StopButton = 0 ConsoleWrite("!StartUp interrrupted by STOP" & @CRLF) STOPThis() Case "Pause" $PauseButton = 0 ConsoleWrite("!StartUp interrrupted by Pause" & @CRLF) PauseThis() EndSwitch Sleep(100) Next ConsoleWrite(">Func 1 Ended" & @CRLF) EndFunc ;==>StartUp Func PauseThis() $PauseButton = 0 For $i = 1 To 100 ConsoleWrite("-PauseThis Running - " & $i & @CRLF) Switch _Interrupt_Sleep(1000) Case "Stop" $StopButton = 0 ConsoleWrite("-PauseThis interrrupted by STOP" & @CRLF) STOPThis() Case "Start" $StartButton = 0 ConsoleWrite("!StartUp interrrupted by Pause" & @CRLF) Return EndSwitch Sleep(100) Next ConsoleWrite(">PauseThis Ended" & @CRLF) EndFunc ;==>PauseThis Func STOPThis() _Exit() EndFunc ;==>STOPThis Func _Exit() Exit EndFunc ;==>_Exit Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam) If BitAND($wParam, 0x0000FFFF) = $Start Then $StartButton = 1 EndIf If BitAND($wParam, 0x0000FFFF) = $Pause Then $PauseButton = 1 EndIf If BitAND($wParam, 0x0000FFFF) = $Stop Then $StopButton = 1 EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND M231 point
-
for sport $str = "100.11 Q9" msgbox(0, '' , number($str) & " " & number(StringReverse($str))) edit: and i think you will find the official forums more useful and engaging than stackoverflow, but that is purely my biased opinion.1 point
-
This also works. $strLine = "100.11 Q9" $sortString = StringRegExpReplace($strLine, '[A-Za-z]', "") ; Removes all ASCII letters. ; or $sortString = StringRegExpReplace($strLine, '(?i)[A-Z]', "") MsgBox(0, "", $sortString, 2)1 point
-
How do I filter a string by using Regexp
Mocha reacted to abberration for a topic
I do not understand your question. Do you have more strings you need to omit letters and then sort them? If so, can you give some examples of other strings? Also, do you want the space in the string? If you do that will affect how your numbers will be sorted.1 point -
This filters "100.11 Q9" to "100.11 9" by removing all ASCII letters. $strLine = "100.11 Q9" $sortString = StringRegExpReplace($strLine, '[[:alpha:]]', "") ; Removes all ASCII letters. MsgBox(0, "", $sortString, 2)1 point
-
Your description is vague. Is this all your script has to do? This filter has to be apply to other strings? If yes how in whici way these strings are different?1 point
-
Checkout the _GDIPlus_ImageGetPropertyIdList() and _GDIPlus_ImageGetPropertyItem() functions in the help file. I believe property 306 is DateTaken. I think the FileSetTime() function will set the Date Created.1 point
-
Run multiple script on win 10
HamidZaeri reacted to JLogan3o13 for a topic
@HamidZaeri welcome to the forum. You will find that when you provide 0 information, you will get 0 response. Think about trying to answer that question if it was asked of you. What things would you need to know? What exactly are the two scripts doing? How might they interfere? What is your ultimate goal? Does it even need to be two scripts, or can it be one? How about some more explanation; help us help you1 point -
AutoIt v3.3.14.4 has been released. Thanks to everyone involved, both visible and behind the scenes. Download it here. Complete list of changes: History1 point
-
Here's a simple way to show a dragged area. #include<Misc.au3> #include <windowsconstants.au3> $area = GUICreate("", 1, 1, 1, 1, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x0000ff, $area) WinSetTrans($area, "", 80) GUISetState() While 1 If _IsPressed("1") Then $mp = MouseGetPos() WinMove($area, "", $mp[0], $mp[1], 1, 1) While _IsPressed('01') $pos = MouseGetPos() $lefts = Order($mp[0], $pos[0]) $tops = Order($mp[1], $pos[1]) WinMove($area, "", $lefts[0], $tops[0], $lefts[1], $tops[1]) ConsoleWrite($lefts[0] & ', ' & $tops[0] & ', ' & $lefts[1] & ', ' & $tops[1] & @CRLF) WEnd EndIf WEnd Func Order($a, $b) Dim $res[2] If $a < $b Then $res[0] = $a $res[1] = $b - $a Else $res[0] = $b $res[1] = $a - $b EndIf Return $res EndFunc ;==>Order1 point