Jump to content

Search the Community

Showing results for tags 'filegetencoding'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hello, I'm stuck, again. I'm not grasping why FileGetEncoding works on one folders contents and not others. Why it works partly on one system (The best I've seen) and on other systems it fails on any file. Likely I've made a mistake and probably I'm lucky it is working at all. I have a problem in that the only way I can search for a file is to identify it by its file name because people have named the file differently on many systems and they have even tampered with the file extension. So I thought to see if it had any unique file encoding value that set itself apart from the rest of the files in the folder. As luck would have it, that has turned out to be the case; well, it looks that way because on the couple of systems that this works on, it is returned as 2048 and the other files are a mix of other encoding options. I just don't know where to go from here since the results are hit an miss and I have about 400 systems I need to do a software upgrade on. That upgrade requires me to backup and restore configuration files that are important to registers working. Here is what I have so far, nothing fancy. Any insight would be appreciated. I struggle to read behind the lines so I may not have inferred something from the help file correctly. #RequireAdmin #include <Array.au3> #include <MsgBoxConstants.au3> ;Local $aArray_Base[1][2] = [["File Name","Encoding"]] Local $aArray_Base[0][2] ;_ArrayDisplay($aArray_Base, "2D - Base array") ; Change working directory and FileSelectFolder doesn't change working directory on its own or leave it set if it does FileChangeDir ( FileSelectFolder ( "Select Folder", "C:\" )) ; Define a variable to hold a search "handle" as we loop through the files in a directory $FileSearch = FileFindFirstFile(@WorkingDir & "\*.*") ; Check if the search was successful If $FileSearch = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf ;A while loop where we identify each file in the directory, then read and get its file encoding, and then push the file name and encodinng into an arry While 1 $AFile = FileFindNextFile($FileSearch) If @error Then ExitLoop ;Exclude some known directory names that should not be terminal file names If $AFile == "backup" Or $AFile == "log" Or $AFile == "OUT" Or $AFile == "TR" Then Else ;Get encoding of file $AFile_Encoding = FileGetEncoding ( "C:\CRS\" & $AFile) ;Pass file and and encoding $result to a variable $sFill = $AFile & '|' & $AFile_Encoding ;Use that variable to add data to the array _ArrayAdd($aArray_Base, $sFill) EndIf WEnd ; Close the search handle FileClose($FileSearch) ; Display the results to see what was found. _ArrayDisplay($aArray_Base, "2D - Base array") ; On a few systems this will return an array with file encodings ; On many systems this will return a list of file names but encoding is all -1 ; I do not understand encoding enough to understand why the latter happens ; The systems where this works the most have AutoIt installed so I don't ; Know if that has any bearing. Even on those systems it only works on ; a handful of folders, not all. Why would that be? ; Antivirus is disabled and it was compiled as an admin and run as an admin.
×
×
  • Create New...