Sign in to follow this  
Followers 0
Xonos

External Configuration File

8 posts in this topic

#1 ·  Posted (edited)

Ok! I would like to know if anyone has any advice for my situation. I want to write a script that calls variables from an external editable file. For example let's say I have a script that does the following.

sleep("$RebootTimer1"); 23 Hours, 30 Minutes - RebootTimer1

; Here is where I will insert script that will connect to telnet and do some commands.

sleep("$RebootTimer2"); 30 Minutes - RebootTimer2

processclose("world.exe")
sleep("2000")
run("world.exe")

Ok so in short... RebootTimer (The 84600000 sleep timer) I need that to be changeable via an external ini or txt file.. With variables or something. Like this...

rebootconfig.ini

[Config]
$RebootTimer1=84600000
//RebootTimer1 is the total time until it logs into telnet
$RebootTimer2=1800000
//RebootTimer2 is the grace period after reboottimer2.

I'll pay money for information on how to do this. :)

Edited by Richardo

[center][/center][center]Xonos Development[font=trebuchet ms,helvetica,sans-serif]- Resources -[/font] AutoIT Documentation | Active Directory UDF | Windows Services UDF | Koda GUI Designer[/center]

Share this post


Link to post
Share on other sites



I don't know what you meant (headache right now) but can't you use iniread and iniwrite?

Share this post


Link to post
Share on other sites

He said you posted the thread in wrong section, and he moved it to the correct one.

"I'll pay money for information on how to do this."

This is a general help and support section. You don't have to pay to get help..

Yes, why don't you try ini commands?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

this sleep("$RebootTimer1") and sleep("$RebootTimer2") won't work. It needs to be a Number not a Literal string.

maybe: sleep($RebootTimer1) and sleep($RebootTimer2) ? (don't know how you set the values)

same for sleep("2000") which should be sleep(2000)

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You don't have to put quotes ("") when you use variables. If you want to have an ini file so anyone can change the delay, you'll only need IniRead.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Just an update for future reference... I figured it out! Here is a reference script if anyone else needs help.

Variables do work in the sleep function.

$var = IniRead("test.ini", "section", "test", "NotFound")
sleep($var);10 seconds set for this variable 10000 miliseconds
MsgBox(4096, "Timer", $var);messages you with a msg box in 10 seconds

Ini File

[section]
test=10000
Edited by Richardo

[center][/center][center]Xonos Development[font=trebuchet ms,helvetica,sans-serif]- Resources -[/font] AutoIT Documentation | Active Directory UDF | Windows Services UDF | Koda GUI Designer[/center]

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