Sign in to follow this  
Followers 0
xxd2godxx

How do I open an .ini script so I can edit it.

7 posts in this topic

I am trying to make a script that will open a .ini script, then it will wait untill i close it. Then the script will open a different script that i need to edit and it will wait untill the script is closed. Then it will install a file to a directory.

I KNOW HOW TO DO EVERYTHING EXCEPT OPEN A .INI FOR EDITING!!! It can not be the run function because i have to use @ScriptDir which won't work with Run.

-matt


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

umm... an INI file is not a script, but if u want to edit one right click > open with > notepad...lookup

IniRead()

IniReadSection()

IniWrite()

in the helpfile

or to open one with autoit use

$file = @ScriptDir & "\settings.ini"
$file = FileGetShortName($file)
Run(@comspec & " /c start " & $file, '', @SW_HIDE)

--hope this helps

~cdkid

Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

here's the answer to part of your question

#include <GuiConstants.au3>
;Opt("TrayIconDebug", 1)
;************ NOTES START ************

;************ NOTES END **************
$INIPATH = @ScriptDir & "\test.ini"

GUICreate("", 200, 230, -1, -1, $WS_DLGFRAME, $WS_EX_TOPMOST)
GUISetBkColor(0xffff00)
GUISetFont(11, 690)
$OPEN = GUICtrlCreateButton("Open ini", 10, 160, 80, 25)
$CANC = GUICtrlCreateButton("Exit", 110, 160, 80, 25)

GUISetState()
While 1
    $MSG = GUIGetMsg()
    Select
        Case $MSG = $CANC
            Exit
        Case $MSG = $OPEN
            GUIDelete()
                Run("C:\Windows\Notepad.exe" & " " & $INIPATH)
                If Not WinWaitActive("test.ini - Notepad", "", 5) Then Exit
                Sleep(500)
                If Not WinWaitClose("test.ini - Notepad", "", 300) Then Exit
                If @Compiled = 1 Then
                    Run( FileGetShortName(@ScriptFullPath))
                Else
                    Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
                EndIf
                Exit
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

One more question, how do i make the script sleep untill the .ini is closed, then it will open a new file?


Share this post


Link to post
Share on other sites

what about making a do until loop with checking if it was closed?

dont forget to make sth like sleep(10) else it would blow your CPU!


[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

use RunWait... instead of Run

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

like Valuater said use runwait, but if you'll look at this line

If Not WinWaitClose("test.ini - Notepad", "", 300) Then Exit

it is waiting for test.ini to close (300=5 min) you don't need the timeout option.

WinWaitClose("test.ini - Notepad")

will wait foreever

have you tried the script i provided to see how it works ?

make up a test ini

phil

Edited by pecloe

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  
Followers 0