agivx3 Posted April 15, 2023 Share Posted April 15, 2023 Hi, i am trying to read a file but i seems to be in an unknown file mode. I tried everything from ansi to utf but cant read it. Any idea or solution about this little problem ?? Also tried read to array and other stuff... Here is the example code. The registry key may be also another one: $cmd = Run(@ComSpec & ' /c reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\Outlook\Addins" /reg:64 /S >C:\TEMP\TEST.TXT',"",@SW_HIDE) $Target = "C:\TEMP\Test.txt" Local $hFileOpen = FileOpen($Target) While 1 $Text = FileReadline($hFileOpen) If @error Then ExitLoop ConsoleWrite("TEXT: " & $Text & @LF) Wend FileClose($hFileOpen) Thanks for help Andi Link to comment Share on other sites More sharing options...
Solution Danp2 Posted April 15, 2023 Solution Share Posted April 15, 2023 Add some error checking after your FileOpen. It's likely that the file doesn't exist or can't be accessed because it's in use. You should change Run >> RunWait to allow the launched process to finish before your script proceeds. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted April 15, 2023 Share Posted April 15, 2023 You should highly consider using IniRead* functions instead of running an external process... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
agivx3 Posted April 15, 2023 Author Share Posted April 15, 2023 1 hour ago, Danp2 said: Add some error checking after your FileOpen. It's likely that the file doesn't exist or can't be accessed because it's in use. You should change Run >> RunWait to allow the launched process to finish before your script proceeds. Thx, that was it. Seems i sometimes think too complicate. The easiest solution was so near... Link to comment Share on other sites More sharing options...
Danp2 Posted April 15, 2023 Share Posted April 15, 2023 @Nine You meant to say RegRead, correct? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted April 15, 2023 Share Posted April 15, 2023 @Danp2 yes “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
agivx3 Posted April 15, 2023 Author Share Posted April 15, 2023 I didn´t tell the purpose of the script. It was to read some special HKLM registry keys and values with all subkeys (also from remote computers) and then write the whole content to a working .REG file. I have tried several Registry UDF´s, got only one working on local computer, but none for remote. With reg query it should be possible. I now only need to do a little parsing work. But thats no problem. The final script is now nearly complete and working. Thanks once more ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now