Jump to content

Having Problem with Inetget, iniread, and msgbox


sumkid
 Share

Recommended Posts

What i want this to do is download the settings.ini file so that it can read what I want the message box to say. so this is what it should do (in order)

1. Download settings.ini

2. if settings.ini reads "enable=1" then it will continue

3. then if settings.ini reads "command1=msg" then it will make a msgbox with the title being whatever i set it as in the settings.ini and same with the msgbox text.

here is my code. when i execute it, it doesnt appear to do anything. any help?

$Getit = InetGet ( "http://mysubdomain.mywebhost.com/settings.ini", "settings.ini" )
$enable = IniRead ( $Getit, "settings", "enable", 1 )
$command1 = IniRead ( $Getit, "settings", "command1", 1 )
$msgtitle = IniRead ( $Getit, "msg", "msgtitle", 1 )
$msgtext = IniRead ( $Getit, "msg", "msgtext", 1 )




While 1
Sleep (10000)
If $enable = 1 Then
    If $command1 = "msg" Then
        MsgBox ( 1, $msgtitle, $msgtext )
    EndIf
EndIf
Sleep (35000)
Exit
WEnd
Edited by sumkid
Link to comment
Share on other sites

  • Developers

Pls refrain from bumping a thread within a day. Just shows impatience and makes me and many other ignore it.

Jos

Edited by Jos

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

What i want this to do is download the settings.ini file so that it can read what I want the message box to say. so this is what it should do (in order)

1. Download settings.ini

2. if settings.ini reads "enable=1" then it will continue

3. then if settings.ini reads "command1=msg" then it will make a msgbox with the title being whatever i set it as in the settings.ini and same with the msgbox text.

here is my code. when i execute it, it doesnt appear to do anything. any help?

$Getit = InetGet ( "http://mysubdomain.mywebhost.com/settings.ini", "settings.ini" )
$enable = IniRead ( $Getit, "settings", "enable", 1 )
$command1 = IniRead ( $Getit, "settings", "command1", 1 )
$msgtitle = IniRead ( $Getit, "msg", "msgtitle", 1 )
$msgtext = IniRead ( $Getit, "msg", "msgtext", 1 )

While 1
Sleep (10000)
If $enable = 1 Then
    If $command1 = "msg" Then
        MsgBox ( 1, $msgtitle, $msgtext )
    EndIf
EndIf
Sleep (35000)
Exit
WEnd

The following code works w/o issue for me:

$INI = @ScriptDir&"\settings.ini"
InetGet("http://mysubdomain.mywebhost.com/settings.ini", "settings.ini", 0, 0)
$enable = IniRead($ini, "settings", "enable", 0)
$command1 = IniRead($ini, "settings", "command1", 1)
$msgtitle = IniRead($ini, "msg", "msgtitle", 1 )
$msgtext = IniRead($ini, "msg", "msgtext", 1 )

if $enable = 1 and $command1 = 1 Then
    MsgBox(0, $msgtitle, $msgtext)
Else
    ConsoleWrite("nope" & @CRLF)
EndIf

Mind you, you need to have your settings.ini written properly:

[settings]
enable=1
command=1

[msg]
msgtitle=This is a test
msgtext=This is the text

Hope that helps :)

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ 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...