Jump to content
Sign in to follow this  

Simple script - save problem

Recommended Posts

The next simple script opens "instserver.ini", writes "testing" and than closes '"instserver.ini".

Normally it should save but I always get this error.:

Posted Image

There is nothing wrong with the rights on this file.

When I do the same thing manually it saves without a problem.

Any ideas?


$FilePath = "r:\1apps\main_persm\instserver\instserver.ini"

$FileHandle = FileOpen($FilePath, 1)

Run("notepad " & $FilePath)




WinWaitActive("Notepad") ;Do you want to save the changes?



Share this post

Link to post
Share on other sites


$FilePath = "c:\temp\instserver.ini"
$FileHandle = FileOpen($FilePath, 1)
FileWriteLine($FileHandle, "testing")

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 by jinxter

> there are 10 types of people in the world, those who understand binary and those who don't.

Share this post

Link to post
Share on other sites

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"

Share this post

Link to post
Share on other sites

@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 by stockboy

Share this post

Link to post
Share on other sites

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.


Edited by smashly

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...