Jump to content

Problems with IniRead


Recommended Posts

So basically i'm trying to make a Message of the Day program pop up for when the program is started.

It's not reading the MOTD value at all. Any ideas? Or will it not work when reading from an online source?

Local $MOTD = IniRead("http://www.freewebs.com/smurf-job/motd.ini", "News", "MOTD","Server Down")
MsgBox(4096, "Welcome", $MOTD)

the ini file contains this

[News]
MOTD="Welcome! 1-06-12"

Any ideas? I always just get Server Down. :)

Edited by Shifthappens
Link to comment
Share on other sites

  • Developers

You should use InetGet() to retrieve the file and save it on your harddisk after which you can use IniRead() to get the information.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Are you sure that the ini file contains that text as you've written it? When I open it in a browser window, I get the text all on one line. Iniread will not see the information from the ini correctly unless it's formatted correctly.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You should use InetGet() to retrieve the file and save it on your harddisk after which you can use IniRead() to get the information.

Hmm, is there any other way? I also wanted to make a popup box after that for entering usernames/passwords for different accounts, and i'm afraid that if it downloads the file that people will sabotage other's accounts.

Also, thanks for the quick reply that's extremely impressive. :)

Are you sure that the ini file contains that text as you've written it? When I open it in a browser window, I get the text all on one line. Iniread will not see the information from the ini correctly unless it's formatted correctly.

I'm not sure why, but when I open it, it shows up as I typed it on here. Not sure why it'd be showing up as one line for you.

Edit: If it's required that I use the InetGet, what should I use to go about making a scrambler for all of the accounts/passwords? So that way when the .ini file is opened, nobody can steal other's accounts? Is there an easy way to go through a string and set all 1s to 3s ot all a's to #'s, etc. etc.?

Edited by Shifthappens
Link to comment
Share on other sites

You can download the .ini, read the information, then delete it within milliseconds. If they don't know where you are downloading the file to then they can't see any of the information. You can also use a Random() string to make it download to a random folder then delete the random folder. Of course save the Random() as a variable to reuse.

Link to comment
Share on other sites

If you're going to be storing information of other people's account information, you don't want to put it in plain text in an ini file that is accessible from the internet with no security precautions on it. At the very least you should encrypt the file, or use a sql database with encrypted information in it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You can download the .ini, read the information, then delete it within milliseconds. If they don't know where you are downloading the file to then they can't see any of the information. You can also use a Random() string to make it download to a random folder then delete the random folder. Of course save the Random() as a variable to reuse.

Thank you all for your help, but I just realized how to use the EncryptData and DecryptData functions. You all are awesome as always thanks again! :)

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

×
×
  • Create New...