stockboy Posted October 23, 2006 Share Posted October 23, 2006 The next simple script opens "instserver.ini", writes "testing" and than closes '"instserver.ini".Normally it should save but I always get this error.:There is nothing wrong with the rights on this file.When I do the same thing manually it saves without a problem.Any ideas?Tnx$FilePath = "r:\1apps\main_persm\instserver\instserver.ini"$FileHandle = FileOpen($FilePath, 1)Run("notepad " & $FilePath)WinWaitActive("instserver.ini")send("testing")WinClose("instserver.ini")WinWaitActive("Notepad") ;Do you want to save the changes?Send("!y")WinClose("Notepad") Link to comment Share on other sites More sharing options...
jinxter Posted October 23, 2006 Share Posted October 23, 2006 (edited) hmm... $FilePath = "c:\temp\instserver.ini" $FileHandle = FileOpen($FilePath, 1) FileWriteLine($FileHandle, "testing") FileClose($FileHandle) The problem might be that you first open a stream to write to, then open notepad and try to save to that stream while it is open. Another way would be to open notepad enter text via send and then save the file, without using FileOpen() Edited October 23, 2006 by jinxter > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
smashly Posted October 23, 2006 Share Posted October 23, 2006 Can't you just write to the ini without all the send and notepad and stuff, or is there a need for it to be done like the way your doing? Or is it a case you don't want what your trying write/save listed under a section and and key in the ini? Sorry for the n00b question , but I was just curious? $IniPath = "r:\1apps\main_persm\instserver\instserver.ini" IniWrite($IniPath,"Section","Key',"Testing") Link to comment Share on other sites More sharing options...
stockboy Posted October 23, 2006 Author Share Posted October 23, 2006 (edited) @smalhly: I need to copy a part of a ini-file and than open another ini-file (instserver.ini), search in it, and than paste Maybe it's easy but you're talking to a beginner here ;o) @jinxter: You're right, it works without the FileOpen Tnx a lot !!! Edited October 23, 2006 by stockboy Link to comment Share on other sites More sharing options...
jinxter Posted October 23, 2006 Share Posted October 23, 2006 welcome, glad to help > there are 10 types of people in the world, those who understand binary and those who don't. Link to comment Share on other sites More sharing options...
smashly Posted October 23, 2006 Share Posted October 23, 2006 (edited) The ini that you need to copy from , is it a section you you need to read? If so you can IniReadSection, which stores the Key and Value to a 2D array , then you can search the array for the key(s) and value(s) then write straight from the array to the instserver.ini without the open, copy, send and save. I'm new to AutoIt as well and I find it challenging just to do what seems to others the most easiest of tasks , but that's what keeps me intrested. Cheers Edited October 23, 2006 by smashly Link to comment Share on other sites More sharing options...
stockboy Posted October 23, 2006 Author Share Posted October 23, 2006 Indeed, it makes the script more easier... thanx a lot !! 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