Jump to content

All Activity

This stream auto-updates

  1. Today
  2. the icon's $SS_NOTIFY style is responsible for this. I don't know how this can change Edit: I found another way Special Edition: ; https://www.autoitscript.com/forum/topic/211721-round-buttons/ ;---------------------------------------------------------------------------------------- ; Title...........: RoundButtonsSpecial.au3 ; Description.....: collection of round buttons - Special Edition ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $MyGui, $aBtn[7][2] Example() ;---------------------------------------------------------------------------------------- Func Example() $MyGui = GUICreate(" My GUI Icons", 300, 500) $aBtn[0][0] = 6 ; cnt of buttons $aBtn[1][1] = "red" $aBtn[1][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[1][1] & "_normal.ico", 0, 20, 20, 64, 64) $aBtn[2][1] = "yellow" $aBtn[2][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[2][1] & "_normal.ico", 0, 20, 100, 64, 64) $aBtn[3][1] = "green" $aBtn[3][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[3][1] & "_normal.ico", 0, 20, 180, 64, 64) $aBtn[4][1] = "turquoise" $aBtn[4][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[4][1] & "_normal.ico", 0, 20, 260, 64, 64) $aBtn[5][1] = "cyan" $aBtn[5][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[5][1] & "_normal.ico", 0, 20, 340, 64, 64) $aBtn[6][1] = "magenta" $aBtn[6][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[6][1] & "_normal.ico", 0, 20, 420, 64, 64) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch _IsOver() WEnd GUIDelete() EndFunc ;==>Example ;---------------------------------------------------------------------------------------- Func _IsOver() Local Static $iActive, $iClicked = 0 Local $aActive = GUIGetCursorInfo($MyGui) If $aActive[2] And $iClicked = 1 Then Return If $iActive <> $aActive[4] Then $iActive = $aActive[4] For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $aActive[4] Then GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_hover.ico") Else GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_normal.ico") EndIf Next EndIf If $aActive[2] Or $iClicked = 1 Then For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $aActive[4] Then If $iClicked = 0 Then GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_click.ico") $iClicked = 1 Else GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_hover.ico") $iClicked = 0 _ButtonCaller($aBtn[$i][0]) EndIf EndIf Next EndIf EndFunc ;==>_IsOver ;---------------------------------------------------------------------------------------- Func _ButtonCaller($Btn) Switch $Btn Case $aBtn[1][0] ConsoleWrite($aBtn[1][1] & @CRLF) Case $aBtn[2][0] ;"yellow" ConsoleWrite($aBtn[2][1] & @CRLF) Case $aBtn[3][0] ;"green" ConsoleWrite($aBtn[3][1] & @CRLF) Case $aBtn[4][0] ;"turquoise" ConsoleWrite($aBtn[4][1] & @CRLF) Case $aBtn[5][0] ;"cyan" ConsoleWrite($aBtn[5][1] & @CRLF) Case $aBtn[6][0] ;"magenta" ConsoleWrite($aBtn[6][1] & @CRLF) EndSwitch EndFunc ;----------------------------------------------------------------------------------------
  3. Edited with added my search image script and source code
  4. Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states: Moderation Team
  5. Hello, I have one gui and i search 2 images. My problem is if i want stop a soft i need wait end search image. Local $btnback = _ImageSearch("IMG/INTERFACE/BtnClose.png", 1, 80) If $showGUI <> 0 Then While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $closebtn Exit EndSwitch Local $btnback = _WaitForImageSearch("IMG/INTERFACE/BtnBack.png", 25, 1, 110, 0) If IsArray($btnback) Then Sleep(300) MouseMove($btnback[0], $btnback[1]) ;MouseDown("left") ;Sleep(100) ;MouseUp('left') EndIf $minimiseMenu = _WaitForImageSearch("IMG/INTERFACE/minimisGUI.jpg", 25, 1, 110, 0) If IsArray($minimiseMenu) Then Sleep(300) MouseMove($minimiseMenu[0], $minimiseMenu[1]) MouseDown("left") Sleep(100) MouseUp('left') EndIf Wend EndIf My code is here. If i press boutton close on my GUI i need wait a searshing image time end. Can you help me please . TY My imagesearch script is : If Not FileExists("ImageSearch\dll\") Then DirCreate("ImageSearch\dll\") ; This script's functionality depends on these DLLs being present in the script's path #Region Required DLLs If Not FileExists("ImageSearch\dll\ImageSearchDLLx32.dll") Then FileInstall("ImageSearch\dll\ImageSearchDLLx32.dll", "ImageSearch\dll\ImageSearchDLLx32.dll") If Not FileExists("ImageSearch\dll\ImageSearchDLLx64.dll") Then FileInstall("ImageSearch\dll\ImageSearchDLLx64.dll", "ImageSearch\dll\ImageSearchDLLx64.dll") ; Microsoft Visual C++ Redistributable x32 If Not FileExists("ImageSearch\dll\msvcr110.dll") Then FileInstall("ImageSearch\dll\msvcr110.dll", "ImageSearch\dll\msvcr110.dll") ; Microsoft Visual C++ Redistributable x64 If Not FileExists("ImageSearch\dll\msvcr110d.dll") Then FileInstall("ImageSearch\dll\msvcr110d.dll", "ImageSearch\dll\msvcr110d.dll") #EndRegion ; When working with multiple monitors, we need to determine absolute desktop dimensions manually, so we can escape the boundaries of the primary monitor ; Ref: https://msdn.microsoft.com/en-us/library/ms724385(v=vs.85).aspx Global $desktopLeft = _WinAPI_GetSystemMetrics(76) Global $desktopTop = _WinAPI_GetSystemMetrics(77) Global $desktopWidth = _WinAPI_GetSystemMetrics(78) Global $desktopHeight = _WinAPI_GetSystemMetrics(79) Global $desktopRight = $desktopLeft + $desktopWidth Global $desktopBottom = $desktopTop + $desktopHeight ; Will become the Handle returned by DllOpen() that will be referenced in the _ImageSearchRegion() function Local $hImageSearchDLL = -1 #Region ImageSearch Startup/Shutdown Func _ImageSearchStartup() _WinAPI_Wow64EnableWow64FsRedirection(True) ; Check OS and AutoIt architectures ; @OSArch - Returns one of the following: "X86", "IA64", "X64" - this is the architecture type of the currently running operating system ; @AutoItX64 - Returns 1 if the script is running under the native x64 version of AutoIt If @OSArch = "X86" Or @AutoItX64 = 0 Then cr("@OSArch=" & @OSArch & " | " & "@AutoItX64=" & @AutoItX64 & " | " & "Using x32 ImageSearch DLL") $hImageSearchDLL = DllOpen("ImageSearch\dll\ImageSearchDLLx32.dll") If $hImageSearchDLL = -1 Then Return "DllOpen Error: " & @error ElseIf @OSArch = "X64" And @AutoItX64 = 1 Then cr("@OSArch=" & @OSArch & " | " & "@AutoItX64=" & @AutoItX64 & " | " & "Using x64 ImageSearch DLL") $hImageSearchDLL = DllOpen("ImageSearch\dll\ImageSearchDLLx64.dll") If $hImageSearchDLL = -1 Then Return "DllOpen Error: " & @error Else Return "Inconsistent or incompatible Script/Windows/CPU Architecture" EndIf Return True EndFunc ; _ImageSearchStartup Func _ImageSearchShutdown() DllClose($hImageSearchDLL) _WinAPI_Wow64EnableWow64FsRedirection(False) cr("_ImageSearchShutdown() completed") Return True EndFunc ; _ImageSearchShutdown #EndRegion ImageSearch Startup/Shutdown #Region ImageSearch UDF ;=============================================================================== ; Description: Find the position of an image in a specified area ; Syntax: _ImageSearchArea ( findImage, resultPosition, left, top, right, bottom [, tolerance = 0 [, $transparency = 0]] ) ; Parameter(s): ; $findImage ; Path to image to locate. ; $resultPosition ; Set where the returned x,y location of the image is. ; 0 = top left of image, 1 = center of image ; $left, $top, $right, $bottom ; Bounding coordinates of the desired search area. ; $tolerance - [OPTIONAL], default = 0 ; 0 = no tolerance, valid range is 0-255. Needed when colors of ; image differ from screen. e.g GIF ; $transparency - [OPTIONAL], default = 0 ; TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of the color ; to be used as transparency. ; ; Return Value(s): On Success - Returns [x,y] array, location of found image ; On Failure - Returns False ;=============================================================================== Func _ImageSearchArea($findImage, $resultPosition, $left, $top, $right, $bottom, $tolerance = 0, $transparency = 0) If Not FileExists($findImage) Then Return False If $tolerance < 0 Or $tolerance > 255 Then $tolerance = 0 If $hImageSearchDLL = -1 Then _ImageSearchStartup() If $transparency <> 0 Then $findImage = "*Trans" & $transparency & " " & $findImage If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage Local $dllResult = DllCall($hImageSearchDLL, "str", "ImageSearch", "int", $left, "int", $top, "int", $right, "int", $bottom, "str", $findImage) If @error Then Return "DllCall Error: " & @error If $dllResult = "0" Or Not IsArray($dllResult) Or $dllResult[0] = "0" Then Return False Local $array = StringSplit($dllResult[0], "|") If (UBound($array) >= 4) Then Local $result[2] ; Get the x,y location of the match $result[0] = Int(Number($array[2])) $result[1] = Int(Number($array[3])) If $resultPosition = 1 Then ; Account for the size of the image to compute the center of search $result[0] = $result[0] + Int(Number($array[4]) / 2) $result[1] = $result[1] + Int(Number($array[5]) / 2) EndIf Return $result EndIf EndFunc ; _ImageSearchArea ;=============================================================================== ; Description: Find the position of an image in a specified window, or the entire screen ; Syntax: _ImageSearch ( findImage, resultPosition [, tolerance = 0 [, $transparency = 0 [, hWindow = 0]]] ) ; Parameter(s): ; $findImage ; Path to image to locate. ; $resultPosition ; Set where the returned x,y location of the image is. ; 0 = top left of image, 1 = center of image ; $tolerance - [OPTIONAL], default = 0 ; 0 = no tolerance, valid range is 0-255. Needed when colors of ; image differ from screen. e.g GIF ; $transparency - [OPTIONAL], default = 0 ; TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of the color ; to be used as transparency. ; $hWindow - [OPTIONAL], default = 0 ; Handle to the window in which we're searching. ; ; Return Value(s): On Success - Returns [x,y] array, location of found image ; On Failure - Returns False ;=============================================================================== Func _ImageSearch($findImage, $resultPosition, $tolerance = 0, $transparency = 0, $hWindow = 0) ; Try to get the position of the window handle, success will return an array Local $winPos = WinGetPos($hWindow) ; If we have a window position array, use its boundaries for the search If IsArray($winPos) Then Return _ImageSearchArea($findImage, $resultPosition, $winPos[0], $winPos[1], $winPos[0]+$winPos[2], $winPos[1]+$winPos[3], $tolerance, $transparency) Else ; Otherwise use the entire screen Return _ImageSearchArea($findImage, $resultPosition, $desktopLeft, $desktopTop, $desktopWidth, $desktopHeight, $tolerance, $transparency) EndIf EndFunc ; _ImageSearch ;=============================================================================== ; Description: Wait for a specified number of seconds for an image to appear ; Syntax: _WaitForImageSearch ( findImage, resultPosition [, tolerance = 0 [, $transparency = 0 [, hWindow = 0]]] ) ; Parameter(s): ; $waitSecs ; Seconds to try and find the image. ; $findImage ; Path to image to locate. ; $resultPosition ; Set where the returned x,y location of the image is. ; 0 = top left of image, 1 = center of image ; $tolerance - [OPTIONAL], default = 0 ; 0 = no tolerance, valid range is 0-255. Needed when colors of ; image differ from screen. e.g GIF ; $transparency - [OPTIONAL], default = 0 ; TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of the color ; to be used as transparency. ; $hWindow - [OPTIONAL], default = 0 ; Handle to the window in which we're searching. ; ; Return Value(s): On Success - Returns [x,y] array, location of found image ; On Failure - Returns False ;=============================================================================== Func _WaitForImageSearch($findImage, $waitSecs, $resultPosition, $tolerance = 0, $transparency = 0, $hWindow = 0) $waitSecs = $waitSecs * 1000 Local $startTime = TimerInit() While TimerDiff($startTime) < $waitSecs Sleep(100) Local $result = _ImageSearch($findImage, $resultPosition, $tolerance, $transparency, $hWindow) If IsArray($result) Then Return $result EndIf WEnd Return False EndFunc ; _WaitForImageSearch ;=============================================================================== ; Description: Wait for a specified number of seconds for any of a set of images to appear ; Syntax: _WaitForImagesSearch ( waitSecs, findImage, resultPosition [, tolerance = 0 [, $transparency = 0 [, hWindow = 0]]] ) ; Parameter(s): ; $waitSecs ; Seconds to try and find the image. ; $findImage ; The ARRAY of paths to images to locate. ; ARRAY[0] is set to the number of images to loop through. ; ARRAY[1] is the first image. ; $resultPosition ; Set where the returned x,y location of the image is. ; 0 = top left of image, 1 = center of image ; $tolerance - [OPTIONAL], default = 0 ; 0 = no tolerance, valid range is 0-255. Needed when colors of ; image differ from screen. e.g GIF ; $transparency - [OPTIONAL], default = 0 ; TRANSBLACK, TRANSWHITE or hex value (e.g. 0xffffff) of the color ; to be used as transparency. ; $hWindow - [OPTIONAL], default = 0 ; Handle to the window in which we're searching. ; ; Return Value(s): On Success - Returns the index of the successful find, starting at 1 ; On Failure - Returns False ;=============================================================================== Func _WaitForImagesSearch($findImage, $waitSecs, $resultPosition, $tolerance = 0, $transparency = 0, $hWindow = 0) $waitSecs = $waitSecs * 1000 Local $startTime = TimerInit() While TimerDiff($startTime) < $waitSecs For $i = 1 To $findImage[0] Sleep(100) Local $result = _ImageSearch($findImage[$i], $resultPosition, $tolerance, $transparency, $hWindow) If IsArray($result) Then Return $i EndIf Next WEnd Return False EndFunc ; _WaitForImagesSearch #EndRegion ImageSearch UDF #Region Custom ConsoleWrite/debug Function Func cr($text = "", $addCR = 1, $printTime = True) ; Print to console Local Static $sToolTip If Not @Compiled Then If $printTime Then ConsoleWrite("+>" & @HOUR & ":" & @MIN & ":" & @SEC & " ") ConsoleWrite($text) If $addCR >= 1 Then ConsoleWrite(@CR) If $addCR = 2 Then ConsoleWrite(@CR) Else If $printTime Then $sToolTip &= "+>" & @HOUR & ":" & @MIN & ":" & @SEC & " " $sToolTip &= $text If $addCR >= 1 Then $sToolTip &= @CR If $addCR = 2 Then $sToolTip &= @CR ToolTip($sToolTip) EndIf Return $text EndFunc ; cr #EndRegion Custom ConsoleWrite/debug Function
  6. I need a script equivalent to the following in AHK *r::{     loop{         send "e"         sleep 2030         if not GetKeyState("r", "P"){             break         }     } } Basically you press "r" or "shift+r" and it sends "e", waits 2s then if you are pressing the "r" button at any point leading into the end of this 2s interval it repeats the behaviour. The 2s intervals need to be respected, so you should never be able to send "e" more than once every 2s. i.e. e...2s...e....2s....e.....5s...e....2s.....e....4s....e I have the following: ;#RequireAdmin  #include <MsgBoxConstants.au3> #include <Misc.au3> HotKeySet("{f4}", "fnTerminate") HotKeySet("{f3}", "fnPause") HotKeySet("r", "fnR") HotKeySet("+r", "fnR") func fnTerminate()     exit endfunc Func fnPause()     $g_bPaused = Not $g_bPaused     While $g_bPaused         Sleep(200)         ToolTip('Script is "Paused"', 0, 0)     WEnd     ToolTip("") EndFunc  Func fnR()     while 1         send("e")         Sleep(2000)         if _IsPressed("52")=false then             ExitLoop         endif     wend EndFunc while 1 sleep(100) wend Your forum syntaxer didn't like the comments so I took them out. The pause function doesn't pause/suspend anything (I thought it was supposed to work by getting stuck in the loop but the other hotkeys work fine meaning the main loop never stoppped), and the loop within fnR() is just plain broken. The behaviour in the fnR() makes no sense whatsoever to me: Take just a simplified form of the sleep() function....why this behaviour? How is this actually running? It seems to create infinite keypresses of "r"->"e" but only 1 instance of the code in fnR() is run. Func fnR()     send("e") ;works     sleep(2000) ;DOESNT WORK Func fnR()     sleep(2000);works     send("e");works In AHK there is only 1 instance. r::send("e") sleep(2000) would literally mean I can only send the letter "e" once every 2s no matter how many times I tap/hold So I'm clearly not understanding how this process even works. I need to be able to setup loops in my hotkey code, some kind of ifkeypressed() check function, and have duplicates of the code running for separate keys....so q->w like r->e (without any timers/loops freezing up when q and r are overlappingly active). And the ability to use ctrl/shift as hotkeys....although the doc said this isn't allowed 'because they are modifier keys!'....I find it hard to believe there is no workaround there, they work in AHK... the fact they are modifier keys doesn't exclude them from functioning as hotkeys. If the program has an outright limitation it should say so clearly. There is no reload key like in AHK and the code for that I found online is outright broken, it'll work once initially if ur lucky. The only other thing I can think of is having a console/text-editor open(note ideal) and controlsending to it in the background, similar to how they showed u can send words offscreen to notepad.     If @Compiled Then         ShellExecute(@ScriptFullPath)     Else         ShellExecute(@AutoItExe, @ScriptFullPath)     EndIf The only examples I've found for hotkeys are basic rebinds (make the "a" key work like the "b" key), and behavior related to pressing buttons on a generated GUI. The only info found on the main loop is that 'it keeps the script running' and could use a sleep of 50 to takeup less resources....that's great, but I don't understand how the runtime+sleepdelay of that mainloop interacts with the hotkeys and any loops in the hotkey etc.
  7. Very nice. Do place the example in the zip for those that are lazy ( not me ) And a request would be that the action is on button release ( up ) instead of down Again, quite nice. Thanks for sharing.
  8. collection of round buttons ; https://www.autoitscript.com/forum/topic/211721-round-buttons/ ;---------------------------------------------------------------------------------------- ; Title...........: RoundButtons.au3 ; Description.....: collection of round buttons ; AutoIt Version..: 3.3.16.1 Author: ioa747 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Global $MyGui, $aBtn[7][2] Example() Func Example() $MyGui = GUICreate(" My GUI Icons", 300, 500) $aBtn[0][0] = 6 ; cnt of buttons $aBtn[1][1] = "red" $aBtn[1][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[1][1] & "_normal.ico", 0, 20, 20, 64, 64, $SS_NOTIFY) $aBtn[2][1] = "yellow" $aBtn[2][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[2][1] & "_normal.ico", 0, 20, 100, 64, 64, $SS_NOTIFY) $aBtn[3][1] = "green" $aBtn[3][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[3][1] & "_normal.ico", 0, 20, 180, 64, 64, $SS_NOTIFY) $aBtn[4][1] = "turquoise" $aBtn[4][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[4][1] & "_normal.ico", 0, 20, 260, 64, 64, $SS_NOTIFY) $aBtn[5][1] = "cyan" $aBtn[5][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[5][1] & "_normal.ico", 0, 20, 340, 64, 64, $SS_NOTIFY) $aBtn[6][1] = "magenta" $aBtn[6][0] = GUICtrlCreateIcon(@ScriptDir & "\Buttons\" & $aBtn[6][1] & "_normal.ico", 0, 20, 420, 64, 64, $SS_NOTIFY) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $aBtn[1][0] ConsoleWrite($aBtn[1][1] & @CRLF) Case $aBtn[2][0] ConsoleWrite($aBtn[2][1] & @CRLF) Case $aBtn[3][0] ConsoleWrite($aBtn[3][1] & @CRLF) Case $aBtn[4][0] ConsoleWrite($aBtn[4][1] & @CRLF) Case $aBtn[5][0] ConsoleWrite($aBtn[5][1] & @CRLF) Case $aBtn[6][0] ConsoleWrite($aBtn[6][1] & @CRLF) EndSwitch _IsOver() WEnd GUIDelete() EndFunc ;==>Example Func _IsOver() Local Static $iActive, $iClicked = 0 Local $aActive = GUIGetCursorInfo($MyGui) If $aActive[2] And $iClicked = 1 Then Return If $iActive <> $aActive[4] Then $iActive = $aActive[4] For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $aActive[4] Then GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_hover.ico") Else GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_normal.ico") EndIf Next EndIf If $aActive[2] Or $iClicked = 1 Then For $i = 1 To $aBtn[0][0] If $aBtn[$i][0] = $aActive[4] Then If $iClicked = 0 Then GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_click.ico") $iClicked = 1 Else GUICtrlSetImage($aBtn[$i][0], @ScriptDir & "\Buttons\" & $aBtn[$i][1] & "_hover.ico") $iClicked = 0 EndIf EndIf Next EndIf EndFunc ;==>_IsOver Extract buttons folder in @ScriptDir Buttons.zip Please, every comment is appreciated! leave your comments and experiences here! Thank you very much
  9. Yesterday
  10. There is no answer to that question, as it is impossible!. an utf8 without BOM encoded file will be read, and an encoding is assigned depending on its content. When you want to force the file encoding, you need to make it utf8 with BOM. By the way: all ASCII high characters have their Unicode version too, which should be used instead when you want it to show as utf8.
  11. The thing is that removing something from the problematic script could correct the issue and the part that is removed contains normal ASCII characters. The strange thing is that I had no issues with x86 version of the script until yesterday. The script I'm using has worked for many years without issues. What would be the downside if my script contained "High ASCII" character and I used UTF-8 encoding?
  12. And it indeed does. Even on Win 11. Thank you! Even though it reacts for every application, at least now I don't need to worry about keep track if application was closed or opened second instance. My main goal to reduce CPU usage is definitely achieved. Thank you all for the help!
  13. That means that the content you paste contains a "High ASCII" character hence SciTE will revert to Ascii (code page property).
  14. Why is a comma between file path and filename? RunWait($sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index), "\setup.exe") should be RunWait($sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index) & "\setup.exe") Or RunWait("setup.exe", $sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index)) Or if you want to check if setup.exe exists before running $sSetupPath = $sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index) & "\setup.exe" If FileExists($sSetupPath) Then RunWait($sSetupPath) Please read the documentation of the function that you use.
  15. Hmm... [\\\^] will only look for back slash and "to the power of" ^ ... both codes I provided in my last post are correct (for all my different testing), but the operator regex is [\*/^]
  16. I have tested a new regular expression "(\d+\h*[\\\^]\h*\d+)" Working good
  17. Dear Andreik i need some help, For example after this command: DirCopy($sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index), $sDestinationDir, 1) I would like to add: RunWait($sSourceDir & '\' & _GUICtrlListView_GetItemText($cList, $Index), "\setup.exe") But it doesn't work Setup.exe is an simple sfx archive (sometimes will be usefull to apply some registry keys, .bat scripts and so on... ) We may use this RunWait( "checked folder", "\setup.exe") for each checked folder even setup.exe doesn't exist into folder. if there is no setup, the script will continue without questions.. How can we find the checked folder when we use RunWait command ? Hope you understand my reach English Thank you
  18. Thank you for the reply. I have installed the latest SciTE (4.4.6) as I mentioned earlier. I added those values to SciTEUser.properties, made a new file, and copied the content to the new file. The Encoding under File menu reverts to "Code Page Property" if I close and open the file. The positive change is that the German characters are displayed correctly (I think because we set the codepage to 65001).
  19. One question regarding the VS Code extension AutoIT v1.0.12 (Damien)... Is it possible to see function documentation / header of customer functions? Means, the same way when I hover cursor on function call of homebrew functions, like it is done when I call a standard AutoIt function? I have seen this in other AutoIT extensions, supporting DocBook.
  20. It seems to work I'm sharing it it must not be perfect but I'm moving forward thank you very much #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <Date.au3> $date = @MDAY & "-" & @MON $today = @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC Local $sourceFolder = @UserProfileDir & "\Documents" Local $backupFolder = "E:\" & $date & "\Documents" Local $logFile = @ScriptDir & "\robocopy.log" ; Vérifier si le dossier de sauvegarde existe, sinon le créer If Not FileExists($backupFolder) Then DirCreate($backupFolder) EndIf ; Exécuter Robocopy pour copier le contenu de la bibliothèque "Mes Documents" vers le dossier de sauvegarde Local $result = RunWait(@ComSpec & ' /c ROBOCOPY "' & $sourceFolder & '" "' & $backupFolder & '" /E /NP /R:2 /W:2 /LOG:' & $logFile, "", @SW_MINIMIZE) ; Vérifier si la sauvegarde a réussi en vérifiant le contenu du fichier journal If FileExists($logFile) Then If StringInStr(FileRead($logFile), "Succès") Then MsgBox($MB_ICONINFORMATION, "Sauvegarde réussie", "La sauvegarde de la bibliothèque 'Mes Documents' a été effectuée avec succès.") Else MsgBox($MB_ICONERROR, "Erreur lors de la sauvegarde", "Une erreur s'est produite lors de la sauvegarde de la bibliothèque 'Mes Documents'.") EndIf FileDelete($logFile) ; Supprimer le fichier journal après vérification ;Else ; MsgBox($MB_ICONERROR, "Erreur lors de la sauvegarde", "Une erreur s'est produite lors de la sauvegarde de la bibliothèque 'Mes Documents'.") EndIf Exit
  21. As for me, it’s a pretty convenient project without any unnecessary problems. Respect to the author
  22. Use /XD to exclude certain directories. And this $excludeFolders = ("@MyDocumentsDir\Ma musique") should be: $excludeFolders = @MyDocumentsDir & "\Ma musique" Also you overwrite $excludeFolders so after this: $excludeFolders = ("@MyDocumentsDir\Ma musique") $excludeFolders = ("@MyDocumentsDir\Mes images") $excludeFolders =("@MyDocumentsDir\Mes videos") $excludeFolders contains the last assignment. You have also some inconsistencies: DirCreate("D:\" & $date & '.\Mes Documents') $dest = ("D:\" &($date) & 'Documents') What exactly it is de destination here? #RequireAdmin $sDate = @MDAY & "-" & @MON $sToday = @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC $sSource = '"' & @UserProfileDir & '\Documents"' $sDestination = '"D:\' & $sDate & '\Documents"' If Not FileExists($sDestination) Then DirCreate($sDestination) Local $sExclude = ' /XD ' $sExclude &= ' "' & @MyDocumentsDir & '\My Music"' $sExclude &= ' "' & @MyDocumentsDir & '\My Pictures"' $sExclude &= ' "' & @MyDocumentsDir & '\My Videos"' RunWait(@ComSpec & " /c ROBOCOPY " & $sSource & " " & $sDestination & " /MIR /R:2 /TEE /XF desktop.ini" & $sExclude, @ScriptDir, @SW_MINIMIZE) If @error Then MsgBox(0x10, "Erreur", "Une erreur s'est produite lors de la sauvegarde.") Else MsgBox(0, "Succès", "La sauvegarde a été effectuée avec succès.") EndIf
  23. Hello @teodoric666 When you post code, please use the method described in the link. You can now edit your post, go back to your post and use the ... in the upper right to do so. You should take the time to read forum rules. In there you will find all you should know of what it is allowed and what is not. Before embarking in coding, you should take a moment to plan your algorithmic approach. Once you start coding, you should be able to debug your code, there is a _Debug UDF, that can help you in your process of finding a solution. Now dropping a bunch of code to us to rewrite it so it will work for you, is definitely not the best way to learn how to program with AutoIt. Since you are new to AutoIt and you may not be familiar to all its intrinsic, I would recommend to use AutoIt functions (as far as possible) instead of relying on external programs. In your case, you may want to look at _FileListToArray or _FileListToArrayRec (which has a mask to exclude folders). Having a list of folders to copy into an array will help you to understand what is going on. Use _ArrayDisplay to read the content of an array. Finally look at DirCopy to perform the actual copy/backup of your folders.
  1. Load more activity
×
×
  • Create New...