maxcronjob Posted August 19, 2005 Share Posted August 19, 2005 Hi, I'm using a _RegExport function that I found on this forum to do a quick check of another user's desktop settings. It basically does a RunAs for that user and dumps some HKCU settings into a textfile. Problem is, when I try to read from the textfile to check some values, I get nada. The file is there and I can open it after the test runs, but during the test if I try a FileRead, I get some gibberish: ypw (but the y has a horizontal : above it and the p has an extended l going through it) ?? any suggestions? Thanks! max Link to comment Share on other sites More sharing options...
GaryFrost Posted August 19, 2005 Share Posted August 19, 2005 might post the non working script. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Holger Posted August 19, 2005 Share Posted August 19, 2005 (edited) Maybe unicode format?Try exporting as "Win9x/NT4"-regfile.!!!Edit try using in commandline as additional parameter /NT4.Then the file is exported as 'normal' ANSI-textfile.RegardsHolger Edited August 19, 2005 by Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
maxcronjob Posted September 2, 2005 Author Share Posted September 2, 2005 might post the non working script.<{POST_SNAPBACK}>Hi, As requested, below are 1. the function I'm having a problem with getting the FileReadLine to work right. 2. Below this function is the _RegExport function I'm using3. Below that is a copy of the gibberish I'm seeing in the Log file where I should be seeing text from the textfile:1. The main function************************************************************Func userSystemConfig()FileWriteLine ( $TestLog, "" & @CRLF)FileWriteLine ( $TestLog, @TAB & "Running user account configuration tests...")FileWriteLine ( $TestLog, "" & @CRLF)FileWriteLine ( $TestLog, "" & @CRLF); User RunAsSet along with the _RegExport function to peek at user's HKCU settingsRunAsSet ("user", @Computername, "password"); dumps the HKCU settings into a separate file and reads them from the file_RegExport("HKCU\Control Panel\Desktop", "C:\" & "userTest.txt")RunAsSet()sleep(2000); opens the C:\userTest.txt file and reads the info $ListUpdateOutput= FileOpen("C:\userTest.txt", 0) If $ListUpdateOutput = -1 Then FileWriteLine( $TestLog, "ERROR: Unable to open C:\userTest.txt") Exit EndIf; Here are the lines of information we're extracting from userTest.txt $anything = FileReadLine ( $ListUpdateOutput, 1) $screensaveActive = FileReadLine( $ListUpdateOutput, 27) $wallpaper = FileReadLine( $ListUpdateOutput, 33) ; Test if the ScreenSaver is active$user_screensaveActive_test = StringMid($screensaveActive, 21, 1) FileWriteLine( $TestLog, @TAB & "Checking Screen Saver settings: ") FileWriteLine( $TestLog, "$user_screensaveActive_test: " & $user_screensaveActive_test) FileWriteLine( $TestLog, "$screensaveActive: " & $screensaveActive) FileWriteLine( $TestLog, "$anything: " & $anything) If $user_screensaveActive_test = "0" Then FileWriteLine( $TestLog, "PASS: user's Screen Saver has been deactivated.") FileWriteLine( $TestLog, "" & @CRLF) Else FileWriteLine( $TestLog, "FAIL: user's Screen Saver has NOT been deactivated!") FileWriteLine( $TestLog, "" & @CRLF) EndIf ; Test if wallpaper is installed$user_wallpaper_test = StringMid($wallpaper, 14, 36) FileWriteLine( $TestLog, @TAB & "Checking if Wallpaper is installed: ") FileWriteLine( $TestLog, "$user_wallpaper_test: " & $user_wallpaper_test) FileWriteLine( $TestLog, "$wallpaper: " & $wallpaper) If $user_wallpaper_test = "C:\\WINDOWS\\server_wallpaper.bmp" Then FileWriteLine( $TestLog, "PASS: Server Wallpaper has been installed on user's desktop.") FileWriteLine( $TestLog, "" & @CRLF) ElseIf $user_wallpaper_test = "(None) " Then FileWriteLine( $TestLog, "FAIL: Server Wallpaper has NOT been installed on user's desktop. In fact, user's desktop contains NO wallpaper!") FileWriteLine( $TestLog, "" & @CRLF) Else FileWriteLine( $TestLog, "FAIL: Server Wallpaper has NOT been installed on user's desktop!") FileWriteLine( $TestLog, "" & @CRLF) EndIf; close the userTest.txt file so we can delete it in CleanupFileClose($ListUpdateOutput)FileWriteLine( $TestLog, "" & @CRLF)FileWriteLine( $TestLog, "------------------")FileWriteLine ( $TestLog, "" & @CRLF)EndFunc*****************************************************2. the _RegExport function*********************************; Here's the RegExport function, which is a wrapper for the REG Export function in WindowsFunc _RegExport($sKey2Export, $sWhere2SaveTo) RunWait(@SystemDir & '\Reg.exe EXPORT "' & $sKey2Export & '" "' & $sWhere2SaveTo & '"', "", @SW_HIDE) If Not FileExists($sWhere2SaveTo) Then SetError(1) Return 0 EndIf SetError(0) Return 1EndFunc ;==>_RegExport************************************3. The Logfile results:********************------------------ Running user account configuration tests...screensaveActive2: Checking Screen Saver settings: $user_screensaveActive_test: $screensaveActive: $anything: ÿþWFAIL: user's Screen Saver has NOT been deactivated! Checking if Wallpaper is installed: $user_wallpaper_test: $wallpaper: FAIL: Server Wallpaper has NOT been installed on user's desktop!------------------Any suggestions?Thanks!max Link to comment Share on other sites More sharing options...
maxcronjob Posted September 2, 2005 Author Share Posted September 2, 2005 Maybe unicode format?Try exporting as "Win9x/NT4"-regfile.!!!Edit try using in commandline as additional parameter /NT4.Then the file is exported as 'normal' ANSI-textfile.RegardsHolger<{POST_SNAPBACK}>Can't seem to find that parameter for the Reg command...This is a Windows 2003 Server OS.-max Link to comment Share on other sites More sharing options...
Holger Posted September 2, 2005 Share Posted September 2, 2005 @max: did you try it? this parameter is hidden! RunWait(@SystemDir & '\Reg.exe EXPORT "' & $sKey2Export & '" "' & $sWhere2SaveTo & '" /nt4', "", @SW_HIDE) Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
Westi Posted September 3, 2005 Share Posted September 3, 2005 The problem is the unicode format. You have to convert the file or use Holger's method. If you want to read/write other unicode files too: RunWait(@ComSpec & " /c type inputfile>outputfile","",@SW_HIDE ) Link to comment Share on other sites More sharing options...
maxcronjob Posted September 6, 2005 Author Share Posted September 6, 2005 @max: did you try it? this parameter is hidden!RunWait(@SystemDir & '\Reg.exe EXPORT "' & $sKey2Export & '" "' & $sWhere2SaveTo & '" /nt4', "", @SW_HIDE)<{POST_SNAPBACK}>The function wasn't working when I added in the parameter. I went forward and used the "type /c inputfile>outputfile" call before I opened the file to read, so it works now.Thanks for the awesome support!-max Link to comment Share on other sites More sharing options...
maxcronjob Posted September 6, 2005 Author Share Posted September 6, 2005 The problem is the unicode format.You have to convert the file or use Holger's method.If you want to read/write other unicode files too:RunWait(@ComSpec & " /c type inputfile>outputfile","",@SW_HIDE )<{POST_SNAPBACK}>Right on! Got it to work! Thanks!!!!!-max 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