DagSa Posted January 17, 2017 Share Posted January 17, 2017 I have some problem to make my ini-file work properly. Purpose is to install program at windows 7 - 10 but think it work at XP also. I have included a fragment of code, but all my errors are there. It should be run by user privilege. The test code point out what is not working: Code is create a directory in %appdata%, and create a ini-file if not there. (This write of file work!) When change the settings only one of the two parameters are changed. One value should be changed (don't work), and the other should be added (work!). Editing manually by notepad does not allow to save it. I want the code to be able to change everything in ini-file. 1. First of all, the ini-file is not writeable by user when look at file properties and also directory properties. Any way to change this? 2. Is %appdata% wrong directory? I want all user to have access to the settings but its enough if only by control of the program. It make me crazy its writeable sometimes, and sometimes not. Any ideas? /Dag AppData_INI-test.au3 Link to comment Share on other sites More sharing options...
JohnOne Posted January 17, 2017 Share Posted January 17, 2017 Try use @AppDataCommonDir AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 I Think JohnOne means @AppDataDir (User Folder), @AppDataCommonDir is a System folder. JohnOne 1 Link to comment Share on other sites More sharing options...
JohnOne Posted January 17, 2017 Share Posted January 17, 2017 I did but I think it's the same as %appdata% Should be able to write to it AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 DagSa appears to be using @AppDataCommonDir in his script, so probably confused it as %AppData%. Link to comment Share on other sites More sharing options...
DagSa Posted January 17, 2017 Author Share Posted January 17, 2017 (edited) I use @AppDataCommonDir because its for all users. %programdata% in Windows: XP: C:\Documents and Settings\All Users\Application Data Vista->10: C:\ProgramData @AppDataDir is for current user, but it have same properties for write/change as @AppDataCommonDir. %appdata% in Windows: XP: C:\Documents and Settings\All Users\Application Data Vista->10: C:\Users\ <user name>\AppData\Roaming It behave exactly the same in win7. Possible to write, but not overwrite or change. Its essential to be able to read and write to a INI file in my opinion. Isnt one of this folders the right one? Any way to change the properties/privilege for "my" folder where the INI file is located? Edited January 17, 2017 by DagSa clearyfing Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 As mentioned in @AppDataCommonDir is a System folder, unless you change the folder/file permissions using something like cacls or subinacl, you won't be able to write to a file within that directory unless you're a member of the local Administrators group. Link to comment Share on other sites More sharing options...
jguinch Posted January 17, 2017 Share Posted January 17, 2017 You need rigths. Try to add #RequireAdmin at the top of your code Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
JohnOne Posted January 17, 2017 Share Posted January 17, 2017 Use @DocumentsCommonDir For all users. Subz 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DagSa Posted January 17, 2017 Author Share Posted January 17, 2017 1 minute ago, jguinch said: You need rigths. Try to add #RequireAdmin at the top of your code This program should be used by a simple user, and program have some settings to be done like select a printer and save the setting, save the windows location so it could start at same place next time. You don't need Admin privilege for that. Of course some other settings could be saved at time of installation with Admin rights, but not for the daily use. Possible to give the software privilege to "my" settings? Link to comment Share on other sites More sharing options...
DagSa Posted January 17, 2017 Author Share Posted January 17, 2017 19 minutes ago, JohnOne said: @DocumentsCommonDir Tested, with same result. But progress Folder is hide, so that's good. In win7: C:\Users\Public\Documents\_TEST But the privilege is different for this folder and should not limit to read/write/change in INI file. But the code don't work, so it must be something in code not working. Possible to change and save by notepad. Code don't change the phonenumber in INI file. Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 @DagSa - All folders for %Public% or %AllUsersProfile% are system folders, unless you change the permissions on the folders standard users cannot save to these folders natively. Link to comment Share on other sites More sharing options...
jguinch Posted January 17, 2017 Share Posted January 17, 2017 The proper way is to build a program installer, required admin rights, which gives the good rights to all users to the application folder (using cacls on subinacl, like Subz pointed out) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
DagSa Posted January 17, 2017 Author Share Posted January 17, 2017 I found errors in code, because it was cutted out from other context. It works after some changes I have a installer for the exe so its covered. I test whats work and will be back with more info, thanks for support! /Dag Link to comment Share on other sites More sharing options...
JohnOne Posted January 17, 2017 Share Posted January 17, 2017 I have write options under standard user to @DocumentsCommonDir in windows 7 and 10 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Subz Posted January 17, 2017 Share Posted January 17, 2017 @JohnOne - Apologies, I stand corrected, the Public Documents has Interactive Modify Permissions which allows writing to the folder. 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