Jump to content

Editor


Recommended Posts

How can i make a script to edit an ini file, i know how to read from ini files... but:

I need the program to Read from the ini files and put what they have as the value on the screen they need to be able to change it and then after changing it click "Save" and it changes the ini file....

I also need to make "Tabs"

Also how do i make an updator, i need it to check the files and see if there the same as some on my webserver... duno if it can be done using an xml file... or something... Please help :D

Edited by XxXGoD
Link to comment
Share on other sites

Yes, you can read from and write to an ini with AutoIt.

Yes, you can create tabs with AutoIt.

Yes, you can compare files and update upon preset condition or just overwrite them, and yes, you can parse and edit xml.

Good luck with your project.

Link to comment
Share on other sites

How can i make a script to edit an ini file, i know how to read from ini files... but:

I need the program to Read from the ini files and put what they have as the value on the screen they need to be able to change it and then after changing it click "Save" and it changes the ini file....

It's pretty easy to read something like that and save changes.

#include <guiconstants.au3>
#include <file.au3>

$file = @DesktopDir&"\2cini.ini"

$form = GUICreate("Test", 800, 800)
$edit = GUICtrlCreateEdit("", 0, 0, 800, 750)
$button = GUICtrlCreateButton("Submit Changes", 0, 755, 120, 25)
GUISetState()

_ReadFile()

While 1 
    $msg = GUIGetMsg()
     Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button
            FileOpen($file, 2)
            FileClose($file)
            FileWrite($file, GUICtrlRead($edit))
            Call("_ReadFile")
    EndSwitch
WEnd

Func _ReadFile()
GUICtrlSetData($edit, "")
$info = FileRead($file)
GUICtrlSetData($edit, $info)
EndFunc

Note, the name of the file can be whatever you want, and for cosmetic reasons there's some changes there too. For example, there's really no reason to clear $edit before actually populating it with data, but sometimes users like to see a 'flicker' to say it's done instead of a message.

The reason while it opens the $file w/ 2 is because it erases the file first; and then it closes the $file, and then it writes the $file as needed. Short, simple and sweet.

Tabs are cake too, the helpfile is full of examples for those.

As to the updater; well you can simply pull the file with INETGET() and compare them, if they are the same, do nothing, and if they are different, either PUSH or PULL (send local to remote, or send remote to local) based on what you want to do. The local to remote is a bit complex, but dooable if you setup ftp.

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Thank you ever so much, helped me LOADS

EDIT: One thing with the reading of ini files how do i make it look for the

[section A]

Login Enabled = True

Protect = True

EDIT2: How do i make it download more than 1 file and make it put each file into a selected area according to a file on the website, should be a .txt one... and how do i make it download a list off files what comes from the website?

InetGet("http://www.website.com/File1.exe", "File1.exe", 1, 1)

While @InetGetActive
  TrayTip("Downloading", "Bytes = " & @InetGetBytesRead, 10, 16)
  Sleep(250)
Wend

MsgBox(0, "Bytes read", @InetGetBytesRead)
Edited by XxXGoD
Link to comment
Share on other sites

Thank you ever so much, helped me LOADS

EDIT: One thing with the reading of ini files how do i make it look for the

[section A]

Login Enabled = True

Protect = True

You mean, how do you pull values from section A? INIREAD($file, "Section A", "Login Enabled", "False") and then INIREAD($file, "Section A", "Protect", "True")

You specify the SECTION first, and then the keys that you want to read; the last option is for a default value, which most people should specify.

EDIT2: How do i make it download more than 1 file

Use a for next loop to dowload successive files, and then after the for next loop is completed use While @INETGETACTIVE wend to wait for the processes to commplete.

and make it put each file into a selected area according to a file on the website, should be a .txt one...

Well, you could theoretically go out to the directory location, if you have directory read rights to it, and parse the html page that is displayed for the location of files. Or, you could do a ftp command to pull the directory structure, or you can impliment an INI with the location of each file in it. The choices on how you do this, are entirely up to you.

and how do i make it download a list off files what comes from the website?

See above; but pay attention to the read HTML part. If it provides a list of files on the site, just parse the HTML for the links to those files and do a for/next loop with INETGET and download them. use While @INETGETACTIVE after the for/next group.

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...