Jump to content

Help @ Saving/Loading settings


 Share

Recommended Posts

Hey :whistle:

ive got an autoit-script which is actually working as intended, but now i wanted to make it to be able to work with different resolutions and other settings.

I thought i could just make it like most modern games do it too:

When the scripts starts, a gui pops up where you can define the resolution and other options. Then those settings should be saved in a file (.txt?) and when the script is beeing started the next time, it simply reads those settings saved in the local file, so that you dont have do define those settings every time you run the script. The gui shouldnt pop up this time tho :D

Unfortunately i have no idea how im supposed to do that.

// EDIT:

well ... ive read a bit through the autoit-helpfile and now i think ive found a way how to do it (im not sure tho, whether its the best way do to it - so please feel free to post any superior ways xD)

First, the script should check whether a specific file already exists in the same directory as the script itself (which would be the "settings-file")

If it does exist, it should open it and read the already stored settings into some variables and the actually execute the rest of the script.

If it does not exist, the gui should pop up and after defining the settings, it should create a new file (maybe named myscriptsettings.txt) write the earlier defined settings into the file, then save it and execute the rest of the script.

This should work i guess :lmao:

But i dont know how to create a new txt.file (or any other file). All i found was FileSaveDialog, but that doesnt help me at all, since this only works for already opened files :P

Link to comment
Share on other sites

instead of reading/writing lines to a text file

use an INI File.. and look at the INIRead() and INIWrite() functions.

As for the desktop res, if it is to run full screen, there are the macros for it:

@DesktopHeight - Height of the desktop screen in pixels. (vertical resolution)

@DesktopWidth - Width of the desktop screen in pixels. (horizontal resolution)

@DesktopDepth - Depth of the desktop screen in bits per pixel.

@DesktopRefresh - Refresh rate of the desktop screen in hertz.

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...