Leaderboard
Popular Content
Showing content with the highest reputation on 09/04/2024 in all areas
-
If you want to add more... https://en.wikipedia.org/wiki/List_of_file_signatures2 points
-
I had a problem when opening image files downloaded from the internet for editing, it seems that the file extension does not represent the file correctly. For example: MyPic.png but it is a jpg file so I wrote this function to distinguish the correct extension for the files. If you have a better solution or function, please share: ;~ #include <File.au3> ;~ Global $sPathToFiles = 'C:\_Website_\random-img\img\horizontal' ;~ Local $aArray = _FileListToArrayRec($sPathToFiles, "*.*", $FLTAR_FILES, $FLTAR_RECUR, 0, $FLTAR_FULLPATH) ;~ Local $sFile, $orgTYPE, $curTYPE ;~ For $i = 1 To UBound($aArray) - 1 ;~ $sFile = $aArray[$i] ;~ $orgTYPE = _FileDetectType($sFile) ;~ $curTYPE = __GetEXT($sFile) ;~ If $curTYPE <> $orgTYPE Then ;~ ConsoleWrite('! [' & $i & '] ' & $sFile & ' - [' & $curTYPE & ' > ' & $orgTYPE & ']' & @CRLF) ;~ FileMove($sFile, StringReplace($sFile, $curTYPE, $orgTYPE), 1) ;~ Else ;~ ConsoleWrite('- [' & $i & '] ' & $sFile & ' - [' & $curTYPE & ' > ' & $orgTYPE & ']' & @CRLF) ;~ EndIf ;~ Next Func _FileDetectType($sFile) Local $iExt = __GetEXT($sFile) Local $sExt = __ExtHeaderProcessing($sFile, 16) If $sExt = '' Then $sExt = __ExtHeaderProcessing($sFile, 256) $sExt = StringLeft($sExt, 16) Local $2String = StringLeft($sExt, 2) If StringInStr($sExt, 'Exif') Or StringInStr($sExt, 'JFIF') Or StringInStr($sExt, 'Adobe_d') Then Return '.jpg' ElseIf StringInStr($sExt, 'avif') Then Return '.avif' ElseIf StringInStr($sExt, 'WEBP') Then Return '.webp' ElseIf StringInStr($sExt, 'GIF') Then Return '.gif' ElseIf $2String == 'BM' Then Return '.bmp' ElseIf StringInStr($sExt, '_II') Then Return '.eps' ElseIf StringInStr($sExt, 'PDF') Then Return '.pdf' ElseIf StringInStr($sExt, 'PNG') Then Return '.png' ElseIf StringInStr($sExt, 'II') Then Return '.tif' ElseIf StringInStr($sExt, '8BPS') Then Return '.psd' ElseIf StringInStr($sExt, 'L_F') Or $sExt == 'L' Then Return '.lnk' ElseIf StringInStr($sExt, 'ITSF') Then Return '.chm' ElseIf StringInStr($sExt, 'MSCF') Then Return '.cab' ElseIf StringInStr($sExt, 'ADBE') Then Return '.icc' ElseIf StringInStr($sExt, 'SQLite_f') Then Return '.db' ElseIf $sExt == 'MZ' Or $sExt == 'MZx' Or $sExt == 'MZP' Then If StringInStr($iExt, 'dll') Then Return '.dll' If StringInStr($iExt, 'tlb') Then Return '.tlb' Return '.exe' ElseIf StringInStr($sExt, 'PA30') Or StringInStr($sExt, 'TPA30') Or StringInStr($sExt, 'F_B') Or $sExt == 't_B' Or $sExt == 's_B' Or $sExt == 'z_B' Or $sExt == 'B_V' Or $sExt == '00_h' Or $sExt == 'f_h' Or $sExt == 'v' Or $sExt == 'h' Or $sExt == 'B' Then Return '.ico' Else Return $iExt EndIf EndFunc ;==>_FileDetectType Func __ExtHeaderProcessing($sFile, $rCount = Default) Local $hOpen = FileOpen($sFile, 16) Local $Header = FileRead($hOpen, $rCount) FileClose($hOpen) Local $RegExNonStandard = "(?i)([^a-z0-9-_])", $RegExNoUnicode = "(*UCP)\x{2019}" Local $sExt = BinaryToString($Header) $sExt = StringRegExpReplace($sExt, $RegExNonStandard, "_") $sExt = StringRegExpReplace($sExt, $RegExNoUnicode, "_") While StringInStr($sExt, '__') $sExt = StringReplace($sExt, '__', '_') WEnd If StringRight($sExt, 1) == '_' Then $sExt = StringTrimRight($sExt, 1) If StringLeft($sExt, 1) == '_' Then $sExt = StringTrimLeft($sExt, 1) Return $sExt EndFunc ;==>__ExtHeaderProcessing Func __GetEXT($sFile) Local $iExt = StringRegExpReplace($sFile, "^.*\.", "") If ($iExt = '') Then $iExt = StringMid($sFile, StringInStr($sFile, ".", 2, -1)) If StringRight($iExt, 1) == '.' Then $iExt = StringTrimRight($iExt, 1) If StringLeft($iExt, 1) == '.' Then $iExt = StringTrimLeft($iExt, 1) Return '.' & $iExt EndFunc ;==>__GetEXT1 point
-
Using AutoIt v3.3.16.1 EXE-Installer (default Installation options, just clicking next) modifies: Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment Value-Name: PSModulePath Value-Type: REG_EXPAND_SZ Value before Installation: %ProgramFiles%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules Value after Installation: %ProgramFiles(x86)%\WindowsPowerShell\Modules;%SystemRoot%\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\AutoIt3\AutoItX Problem: %ProgramFiles%\WindowsPowerShell\Modules changed to %ProgramFiles(x86)%\WindowsPowerShell\Modules Running Uninstall does the same! It correctly removes AutoItX Path from PSModulePath but again changes %ProgramFiles%\WindowsPowerShell\Modules to %ProgramFiles(x86)%\WindowsPowerShell\Modules1 point
-
That is only possible in the Support forum.1 point
-
It sounds to me your installation is not complete when that file is missing. When you install the Full SciTE4AutoIt3 package, it needs to be installed form the account you want to use it with. In case you don't do that, but install it with another account, you could copy the complete "C:\Users\installedusername\AppData\Local\AutoIt v3\" to "C:\Users\myusername\AppData\Local\AutoIt v3\" to get the proper complete set of files required.1 point
-
1 point
-
there is a PersonalTools.lua file in C:\Users\ioa747\AppData\Local\AutoIt v3\SciTE\PersonalTools.lua take a look inside, and then you can add in SciTEUser.properties like: # 40 lua MoveSelectedLinesUp func command.name.40.$(au3)=MoveSelectedLinesUp command.mode.40.$(au3)=subsystem:lua,savebefore:no command.shortcut.40.$(au3)=Ctrl+Shift+F command.40.$(au3)=InvokeTool PersonalTools.MoveSelectedLinesUp1 point
-
Looking again at your last post, I'd urge you to normalize your database. Category should be a separate table and you should use it as a foreign key in your main table.1 point
-
You can use TrIDLib. It's capable to ID many files based on their signature. Here is a full list with definitions. #include-once #include <Array.au3> Global Const $TRID_GET_RES_NUM = 1 ; Get the number of results Global Const $TRID_GET_RES_FILETYPE = 2 ; Filetype descriptions Global Const $TRID_GET_RES_FILEEXT = 3 ; Filetype extension Global Const $TRID_GET_RES_POINTS = 4 ; Matching points Global Const $TRID_GET_VER = 1001 ; TrIDLib version Global Const $TRID_GET_DEFSNUM = 1004 ; Filetypes definitions loaded $aInfo = TrIDLib_AnalyzeFile('<FilePath>') _ArrayDisplay($aInfo) Func TrIDLib_AnalyzeFile($sFile, $DefsPack = '', $bVerbose = False, $LibPath = 'TrIDLib.dll') Local $aRet, $hTrIDLib, $iTotal = 0 $hTrIDLib = DllOpen($LibPath) If $hTrIDLib = -1 Then Return False If $bVerbose Then $aRet = DllCall($hTrIDLib, 'int', 'TrID_GetInfo', 'int', $TRID_GET_VER, 'int', 0, 'str', 0) ConsoleWrite(Round($aRet[0] / 100, 2) & @CRLF) EndIf $aRet = DllCall($hTrIDLib, 'int', 'TrID_LoadDefsPack', 'str', $DefsPack) If Not $aRet[0] Then DllClose($hTrIDLib) Return Null EndIf If Not FileExists($sFile) Then Return Null $aRet = DllCall($hTrIDLib, 'int', 'TrID_SubmitFileA', 'str', $sFile) If Not $aRet[0] Then DllClose($hTrIDLib) Return Null EndIf $aRet = DllCall($hTrIDLib, 'int', 'TrID_Analyze') If Not $aRet[0] Then DllClose($hTrIDLib) Return Null EndIf $aRet = DllCall($hTrIDLib, 'int', 'TrID_GetInfo', 'int', $TRID_GET_RES_NUM, 'int', 0, 'str', 9) If $aRet[0] < 1 Then DllClose($hTrIDLib) Return Null EndIf Local $aMatches[$aRet[0] + 1][4] $aMatches[0][0] = $aRet[0] For $Index = 1 To $aRet[0] $aRet = DllCall($hTrIDLib, 'int', 'TrID_GetInfo', 'int', $TRID_GET_RES_FILETYPE, 'int', $Index, 'str', 0) $aMatches[$Index][0] = $aRet[3] $aRet = DllCall($hTrIDLib, 'int', 'TrID_GetInfo', 'int', $TRID_GET_RES_FILEEXT, 'int', $Index, 'str', 0) $aMatches[$Index][1] = $aRet[3] $aRet = DllCall($hTrIDLib, 'int', 'TrID_GetInfo', 'int', $TRID_GET_RES_POINTS, 'int', $Index, 'str', 0) $aMatches[$Index][2] = $aRet[0] $iTotal += $aRet[0] Next If $iTotal > 0 Then For $Index = 1 To $aMatches[0][0] $aMatches[$Index][3] = Round($aMatches[$Index][2] * 100 / $iTotal, 2) Next EndIf DllClose($hTrIDLib) Return $aMatches EndFunc Here you can download the required dll.1 point
-
Do you have more information on how you search and learn in the forum?1 point
-
Unsure if this is intended, but as some of you noticed chromedriver now tries to use a random port on opening. You can override that by supplying the desired port number as a parameter -- _WD_Option('DriverParams', '--port=9515 --verbose --log-path="' & @ScriptDir & '\chrome.log"')1 point
-
Ended up doing this: Func ClearCache() If FileExists("C:Program FilesGoogleChromeApplicationchrome.exe") Then Run("C:Program FilesGoogleChromeApplicationchrome.exe about:blank", "C:Program FilesGoogleChromeApplication") WinWait("about:blank - Google Chrome") Send("^a chrome://settings/clearBrowserData{ENTER}") ElseIf FileExists("C:Program Files (x86)GoogleChromeApplicationchrome.exe") Then Run("C:Program Files (x86)GoogleChromeApplicationchrome.exe about:blank", "C:Program Files (x86)GoogleChromeApplication") WinWait("about:blank - Google Chrome") Send("^a chrome://settings/clearBrowserData{ENTER}") Else MsgBox(48,"Chrome Not Installed !!","Error !!" & @CRLF & "You can't delete cache from chrome as it is not installed." & @CRLF & "Please contact the IT Helpdesk.") EndIf EndFunc1 point
-
I'm using IrfanView as a viewer, which just tells me that the file has been renamed with the correct extension. Since you did it yourself, congratulations. p.s. in your script rename iFile to sFile0 points