DirtyMonkeyXXX Posted May 18, 2010 Share Posted May 18, 2010 Hi, Where I work, we use a boatload of AutoIt scripts to do prerequisite installs, so if an app needs a special driver or add on software, we have an AutoIt script to install said driver/app. Since we've started receiving some Win7 PCs, I've been working to update our scripts to be a little more robust (they were mostly hard coded for Windows XP systems). Most of them have converted fine, but I've run into a slight issue. We have a package that installs an Oracle 10g client on the users machine. This package works fine and installs the client flawlessly. We have a few other packages that go through and update the TNSnames.ora file in the Oracle client's repository. Here's a snippet of the code: $file = FileOpen($oraHome & "\NETWORK\ADMIN\TNSNAMES.ORA", 1) FileWriteLine($file, "#BEGIN Added by Package") FileWriteLine($file, $DB_Name & " = ") ;...(more FileWriteLines) FileWriteLine($file, "#END Added by Package") FileClose($file) The issue I'm running into is that AutoIt can't open the file for writing. As a matter of fact, neither can I. If I double click the file and open it normally in Notepad, I can't save changes. From what I've read and tried, Notepad needs to be running as Administrator to change the file because of the way its set up. I've added "#RequireAdmin" to the script, and when running it does prompt me for administrative privileges (I'm running as a local administrator, btw). But it is still unable to open the file successfully. I've tried AutoIt 3.3.4.0 and just updated to 3.3.6.1, which didn't help. So any suggestions on modifying the file? Perhaps changing the security on the file? I saw a post about using @ComSpec to echo one file into another, but I don't know how well that works when appending to an existing file. Let me know if you need more info. Thanks in advance! Chris Link to comment Share on other sites More sharing options...
zorphnog Posted May 18, 2010 Share Posted May 18, 2010 If it is a compiled script, you can try adding the requestedExecutionLevel directive: #AutoIt3Wrapper_res_requestedExecutionLevel=requireAdministrator Link to comment Share on other sites More sharing options...
DirtyMonkeyXXX Posted May 18, 2010 Author Share Posted May 18, 2010 I apologize profusely. My path variable to the file was garbage and I didn't verify it was correct before posting. Fixing the path fixed the problem, so no more issue. 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