Sign in to follow this  
Followers 0
kcd-clan

Reading Ini And Errors

7 posts in this topic

I dont know i would think it would work

$automsg1=IniRead(@ScriptDir&"/setup.ini","Main","automsg1","n")
$automsg2=IniRead(@ScriptDir&"/setup.ini","Main","automsg2","n")
$automsg3=IniRead(@ScriptDir&"/setup.ini","Main","automsg3","n")
$automsg4=IniRead(@ScriptDir&"/setup.ini","Main","automsg4","n")
$automsg5=IniRead(@ScriptDir&"/setup.ini","Main","automsg5","n")
$automsg6=IniRead(@ScriptDir&"/setup.ini","Main","automsg6","n")
$automsg7=IniRead(@ScriptDir&"/setup.ini","Main","automsg7","n")
$automsg8=IniRead(@ScriptDir&"/setup.ini","Main","automsg8","n")
$automsg9=IniRead(@ScriptDir&"/setup.ini","Main","automsg9","n")
Dim $i

HotKeySet("{NUMPAD1}","automsg1")
HotKeySet("{NUMPAD2}","automsg2")
HotKeySet("{NUMPAD3}","automsg3")
HotKeySet("{NUMPAD4}","automsg4")
HotKeySet("{NUMPAD5}","automsg5")
HotKeySet("{NUMPAD6}","automsg6")
HotKeySet("{NUMPAD7}","automsg7")
HotKeySet("{NUMPAD8}","automsg8")
HotKeySet("{NUMPAD9}","automsg9")

Func automsg1()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg1,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg2()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg2,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg3()
        Send("{ENTER}")
        Sleep(700)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg3,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg4()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg4,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg5()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg5,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg6()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg6,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg7()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg7,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg8()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg8,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Func automsg9()
        Send("{ENTER}")
        Sleep(500)
        $msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg9,"n")
        Send($msg)
        Sleep(500)
    Send("{ENTER}")
EndFunc

Do
Until $i=1

Visit mEMy programs made.Iul - IulG-V Console - G-V Console_RandomLetter - _RandomLetter()Saftey Kill - Saftey Killcolorzone() = colorzone()

Share this post


Link to post
Share on other sites



Not sure exactly what your intensions are with the script to assume of it's success, but you may need to add a Sleep(100) into your loop to save some CPU cycles.

Share this post


Link to post
Share on other sites

$msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg9,"n")

to

$msg=IniRead(@ScriptDir&"/setup.ini","Main", "automsg9","n")

Share this post


Link to post
Share on other sites

Have You ever heard of loops? :mellow:

Use IniReadSection ( "filename", "section" ) instead of first 9 lines of Your code.

Next:

for $i = 1 To 9

HotKeySet("{NUMPAD" &$i& "}","automsg" &$i& ")

next

I don`t know if functions can be decalred inside loop with variables used in their names, but you can try it :)

Share this post


Link to post
Share on other sites

Actually I might suggest changing:

$msg=IniRead(@ScriptDir&"/setup.ini","Main",$automsg9,"n")

To

$msg=IniRead(@ScriptDir&"\setup.ini","Main",$automsg9,"n")

in all of the script above, they are all like that.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Isn't it supposed to write in stead of read something and then return that ones value in that case you should use:

IniWrite(blablabla)

HotkeySet you know

Func you know
     Iniread etc.
EndFunc

Sorry i'm lazy

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