Togego Posted November 22, 2021 Posted November 22, 2021 I have a very simple ini-Files: [variables] testentry="successful" my attempt to read the line: $initest = IniRead($ini, "variables", "testentry", "failed") That worked fine for a while. Now we got a new server and for some reason, IniRead can no longer access the file. Unfortunately IniRead has no error-flags, so I currently have no idea what might be the problem. I can access the ini-file by windows, so I am not missing access rights. Does anyone have an idea? TG
Nine Posted November 22, 2021 Posted November 22, 2021 Sorry crystal ball is at repair shop. You may want to tell us with is the exact content of $ini. Even with it, not sure if anyone can help you, but you give yourself a chance... “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Togego Posted November 22, 2021 Author Posted November 22, 2021 $ini is just the path to the server, "\\servername\share\ini\test.ini" I tried to get enerything as basic as possible, so I stripped everything I found not connected to the issue. Everything worked till the server was replaced by another one, but from what I checked so far, the permissions and all shares were cloned from the old one.
Musashi Posted November 22, 2021 Posted November 22, 2021 Please do a test with : #include <Array.au3> Local $sIniFile, $aSections, $initest $sIniFile = "\\servername\share\ini\test.ini" ; TEST : adding a FileExists with the same path just before reading : If FileExists($sIniFile) Then MsgBox(BitOR(4096, 64), "Message :", "File found" & @CRLF) Else MsgBox(BitOR(4096, 16), "Message :", "ERROR : File not found" & @CRLF) Exit EndIf ; TEST : try to read all section names in the ini file : $aSections = IniReadSectionNames($sIniFile) _ArrayDisplay($aSections, "1. Sections :") ; read value : $initest = IniRead($sIniFile, "variables", "testentry", "failed") MsgBox(BitOR(4096, 64), "Message :", "Value = " & $initest & @CRLF) "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
junkew Posted November 23, 2021 Posted November 23, 2021 Try another function fileread to see if that works #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> Example() Func Example() ; Create a constant variable in Local scope of the filepath that will be read/written to. Local Const $sFilePath = "\\servername\share\ini\test.ini" ; Open the file for reading and store the handle to a variable. Local $hFileOpen = FileOpen($sFilePath, $FO_READ) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.") Return False EndIf ; Read the contents of the file using the handle returned by FileOpen. Local $sFileRead = FileRead($hFileOpen) ; Close the handle returned by FileOpen. FileClose($hFileOpen) ; Display the contents of the file. MsgBox($MB_SYSTEMMODAL, "", "Contents of the file:" & @CRLF & $sFileRead) EndFunc ;==>Example FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
crackdonalds Posted November 25, 2021 Posted November 25, 2021 On 11/22/2021 at 3:17 PM, Togego said: $ini is just the path to the server, "\\servername\share\ini\test.ini" I tried to get enerything as basic as possible, so I stripped everything I found not connected to the issue. Everything worked till the server was replaced by another one, but from what I checked so far, the permissions and all shares were cloned from the old one. what is the OS version of the old server and what is the OS version of the new server? Also what is the OS version of the system used to run the script?
Togego Posted December 15, 2021 Author Posted December 15, 2021 Sorry for the delay, I got busy on another project. The Problem was indeed the access to the share. While it should have been a clone, it was done manually and the person accidently switched two numbers. So no problem with iniread at all. Thanks everyone!
ad777 Posted December 15, 2021 Posted December 15, 2021 (edited) Global $initest = IniRead("test.ini", "variables", "testentry", "failed") MsgBox(0,"",$initest) Edited December 15, 2021 by ad777 none
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