-
Posts
314 -
Joined
-
Last visited
-
Days Won
1
Marc last won the day on March 16 2020
Marc had the most liked content!
About Marc
- Birthday 06/04/1971
Profile Information
-
Location
Düsseldorf, Germany
-
WWW
http://www.delhalle.de
Recent Profile Visitors
767 profile views
Marc's Achievements
-
Reg Key Export employing variables
Marc replied to mr-es335's topic in AutoIt General Help and Support
Well I just thought „how should the command look like if entered on the command line“ and came tobte conclusion of „out every Parameter in „“ and to be sure it is correct I added the consolewrite to see the result🙃 -
mr-es335 reacted to a post in a topic: Reg Key Export employing variables
-
Reg Key Export employing variables
Marc replied to mr-es335's topic in AutoIt General Help and Support
If I'm not mistaken, that's just what the code does... If you replace the line Local $Result = ShellExecuteWait('REG', 'EXPORT " ' & $_sRegKey[$i] & '" ' & $_RegFile[$i] & '') with my code, you'll get: ; ------------------------------------------------ #include <FileConstants.au3> ; ------------------------------------------------ Opt("MustDeclareVars", 1) ; ------------------------------------------------- _ExportRegKeys() ; ------------------------------------------------- Func _ExportRegKeys() ; Source data Local $_sRegKey[3] = [2] $_sRegKey[1] = "HKEY_CURRENT_USER\Software\Native Instruments" $_sRegKey[2] = "HKEY_LOCAL_MACHINE\Software\Native Instruments" ; ----------------- ; Destination data Local $_RegFile[3] = [2] $_RegFile[1] = "D:\Install\App_Config\Digital_Audio\2_GR5\Data\Reg_Keys\hkcu.reg" $_RegFile[2] = "D:\Install\App_Config\Digital_Audio\2_GR5\Data\Reg_Keys\hklm.reg" ; ------------------------------------------------- Local $sMessage = "Export Registry Keys data..." & @CRLF & @CRLF ; ------------------------------------------------- For $i = 1 To $_RegFile[0] Local $tmp = 'EXPORT "' & $_sRegKey[$i] & '" "' & $_RegFile[$i] & '" /Y' Local $Result = ShellExecuteWait('REG', $tmp) ConsoleWrite($tmp & @CRLF) Switch $Result Case 0 $Result = "The Registry Keys data...[" & $_RegFile[$i] & "]...was exported sucessfully!" Case 1 $Result = "The Registry Keys data...[" & $_RegFile[$i] & "]...was not exported sucessfully!" EndSwitch ; ----------------- $sMessage &= $Result & @CRLF Next ; ----------------------------------------------- $sMessage &= @CRLF & "Export Registry Keys completed..." & @CRLF ; ----------------------------------------------- SplashTextOn("NOTICE!!", $sMessage, 1050, 170, -1, -1, 4, "FuturaBQ-DemiBold", 14) Sleep(3000) SplashOff() EndFunc ;==>_ExportRegKeys ; ------------------------------------------------- and it seems to work fine. It displays the "successfully" message and two .reg files are created at the given location. And it uses the /y because it overwrites the files without asking if they are already there. ¯\_(ツ)_/¯ best regards, Marc -
DirCopy|FileMove|FileCopy and Error Checking
Marc replied to mr-es335's topic in AutoIt General Help and Support
Hi mr-es335, here's one possible solution. Using an array with 3 Columns - Source, Destination and Mode. If you don't need to copy one file and move the other file, you could make this thing easier to maintain. Kick out the last column and check if the Source is a file or a directory and then choose the appropriate action. #include <FileConstants.au3> Opt("MustDeclareVars", 1) _UpdateUserData() Func _UpdateUserData() ; Array with source paths, destination paths, and operation type (1 = DirCopy, 2 = FileCopy, 3 = FileMove) Local $aFileOperations[4][3] = [ _ ["D:\Install\App_Install\Digital_Audio\2_GR5\Assets\Tapedeck", "C:\Program Files\Common Files\Native Instruments\Guitar Rig 5\Content\Tapedeck", 1], _ ["D:\Install\App_Install\Digital_Audio\2_GR5\Assets\User_Impulses", "C:\Program Files\Native Instruments\Reflektor\User_Impulses", 1], _ ["C:\RML\SAC\VST_PlugIns\Guitar Rig 5.dll", "C:\RML\SAC\VST_PlugIns\Ampsim\", 3], _ ["D:\Install\App_Install\Digital_Audio\2_GR5\Assets\Ampsim.ini", "C:\RML\SAC\VST_PlugIns", 2] _ ] SplashTextOn("NOTICE!!", "Update User data...", 350, 50, -1, -1) Sleep(1000) ; Perform copy/move operations with error handling For $i = 0 To UBound($aFileOperations) - 1 Local $result = 0 ; Determine the operation type based on the third column Switch $aFileOperations[$i][2] Case 1 ; DirCopy $result = DirCopy($aFileOperations[$i][0], $aFileOperations[$i][1], $FC_OVERWRITE) Case 2 ; FileCopy $result = FileCopy($aFileOperations[$i][0], $aFileOperations[$i][1], $FC_OVERWRITE) Case 3 ; FileMove $result = FileMove($aFileOperations[$i][0], $aFileOperations[$i][1], $FC_OVERWRITE + $FC_CREATEPATH) EndSwitch ; Error handling If $result = 0 Then MsgBox(16, "Error", "Failed to process: " & $aFileOperations[$i][0]) Else ConsoleWrite("Successfully processed: " & $aFileOperations[$i][0] & @CRLF) EndIf Next SplashTextOn("NOTICE!!", "Update User data completed...", 350, 50, -1, -1) Sleep(1000) SplashOff() EndFunc ;==>_UpdateUserData best regards, Marc P.S: this code is powered by ChatGPT 😏 -
Reg Key Export employing variables
Marc replied to mr-es335's topic in AutoIt General Help and Support
Hi, mr-es335, to #1: I like to see the created command, so I extracted the parameters in a separate variable and wrote it to console. Makes it more visible to see what actually happens. Works quite fine this way. even with /y: Local $tmp = 'EXPORT "' & $_sRegKey[$i] & '" "' & $_RegFile[$i] & '" /Y' Local $Result = ShellExecuteWait('REG', $tmp) ConsoleWrite($tmp & @CRLF) to #2: Looks quite stable to me. best regards, Marc -
Not really sure what you want to achieve. If you want the copied bytes displayed in MB/GB then take a look ath the lines GUICtrlSetData($lbl_bytes, $str_done_bytes & " of " & $str_total_bytes & " (" & StringFormat("%.2f", $percent_bytes) & "%)") you could use the function from guinnes here instead to format the value. best regards, Marc
-
ioa747 reacted to a post in a topic: Simple Robocopy with Progressbar
-
Marc reacted to a post in a topic: Date Diffrence between _NowCalc() and FileGettime
-
Marc reacted to a post in a topic: AutoIt Snippets
-
Darn! Ooookay, Put it on the "stupid idiot"-list,.. Invoking your Scite-Editor manually does everything right. I'm always using the "total commander" filemanager. Several years ago I wrote a launcher to decide which editor to use depending on the file extension. Which contains a funny bug... 🤦♂️ Embarassing.
-
Jos reacted to a post in a topic: BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
-
Yepp, it fails with my testfile. Downloaded the original scite and go not problems when editing it. Here's what I see when opening first in original scite and after that in the latest Scite4AutoIt (destroying it): Some things I checked: Original file starts with 26 69 6e 63 6c 75 defect file starts with ef bb bf 63 75 - seems like the first 3 bytes are simply overwritten with the UTF-8 Header renaming the Folder AppData\Local\AutoIt v3\SciTE\ does not change anything in this behaviour after re-adding the overwritten "#in" and saving the file, it stays fine Notepad++ detects my testfile as "UTF" and the file after saving it with the Scite4AutoIt-Editor as "UTF-8-BOM" hope this helps...
-
Hi Jos, took the files from your zip and replaced the files from c:\Program Files (x86)\AutoIt3\SciTE\ with the contents. Help now says: 32-bit Version 5.3.5 Scintilla:5.3.4 Lexilla:5.2.4 Apr 8 2023 19:51:08 But: same result as before. As it seems to happen only on my system, perhaps I screwed up some config files...?
-
Marc reacted to a post in a topic: Python Code
-
Hm, am I the only onle having the issue that the first 3 characters of each file get cut off when editing it? Have an existing .au3 which starts with "#Region". When opening it in the new Scite, it starts with "gion", and the file immediatley gets saved with the first 3 Chars cut of. Re-Adding the "#Re" and saving, the file on the disk is fine and works, untit I dare to open it in Scite again... I'm sure it has to do with BOM... Re-installed the old version, everything's fine.
-
Marc reacted to a post in a topic: BETA: SciTE v5x & lua Dynamic_include and "Smart" AutoComplete for Vars/UDFs/Abbrevs
-
Marc reacted to a post in a topic: AutoIt Cheat Sheet
-
Marc reacted to a post in a topic: AutoIt Cheat Sheet
-
thank you very much - and happy new year to all, too
-
Hi all, here's a test snippet from a script I use daily. Worked fine, until roundabout last week. Problem is: I am checking for the next comic on the webpage. If the comic does not yet exist, the sourcecode contains the text <h1>404 Error</h1>. At least, that's the result in the Webbrowser. But I get a different sourcecode when using the edge browser or _InetGetSource. Especially the 404 Error-Tag is missing. Tried it with several variations of the UserAgent (my old value is "Mozilla / 5.0"). #include <INet.au3> ;HttpSetUserAgent('Mozilla / 5.0') HttpSetUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0') ;HttpSetUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36') ; HttpSetUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36') $result = lfg(1985) MsgBox(0,"lfg", $result) Func lfg($start) $name = "lfg" & $start $x = _INetGetSource("http://www.lfg.co/page/" & $start & "/") ClipPut($x) If StringInStr($x, "<h1>404 Error</h1>") Then Return 404 Return "nope" EndFunc ;==>lfg Desired result of the test-script: a messagebox with 404. Current result of the test script: "nope". Any ideas what I'm doing wrong? best regards, Marc