Sign in to follow this  
Followers 0
cohaholic

Detecting if a DLL Exists

7 posts in this topic

Okay, Im making a program that will press the 5 #s that i type into the 5 input boxes over and over again until i stop the script. here is what i have so far :

#SingleInstance
Global $Paused
HotKeySet ("{PAUSE}", "TogglePause")

    TrayTip("Auto Powers", "Please turn off ANY auto power that you have (Hasten, AM, etc..)", 5, 1)
    Sleep (10000)

If FileExists ( @WORKINGDIR & 'Auto Fire.ini' ) Then
    $varkeyname1 = IniRead ( "Auto Fire.ini" "keys" "key1" "" )
    $varkeyname2 = IniRead ( "Auto Fire.ini" "keys" "key2" "" )
    $varkeyname3 = IniRead ( "Auto Fire.ini" "keys" "key3" "" )
    $varkeyname4 = IniRead ( "Auto Fire.ini" "keys" "key4" "" )
    $varkeyname5 = IniRead ( "Auto Fire.ini" "keys" "key5" "" )
ElseIf Not FileExists ( @WORKINGDIR & 'Auto Fire.ini' ) Then
    TrayTip("Note About Entering Powers", "Please use the CORRECT key or else it will not work!", 5, 1)
    Sleep (10000)
    $varkeyname1 = InputBox ( "Auto Power 1", "Input key # for auto power #1." )
    $varkeyname2 = InputBox ( "Auto Power 2", "Input key # for auto power #2." )
    $varkeyname3 = InputBox ( "Auto Power 3", "Input key # for auto power #3." )
    $varkeyname4 = InputBox ( "Auto Power 4", "Input key # for auto power #4." )
    $varkeyname5 = InputBox ( "Auto Power 5", "Input key # for auto power #5." )
    IniWrite("Auto Fire.ini", "keys", "key1", "" & $varkeyname1)
    IniWrite("Auto Fire.ini", "keys", "key2", "" & $varkeyname2)
    IniWrite("Auto Fire.ini", "keys", "key3", "" & $varkeyname3)
    IniWrite("Auto Fire.ini", "keys", "key4", "" & $varkeyname4)
    IniWrite("Auto Fire.ini", "keys", "key5", "" & $varkeyname5)
EndIf

TrayTip("Pausing Auto Fire", "Use the Pause / Break button located over the page up button to pause this script.  Then use the Windows Task Manager to close the process AutoIt3.exe", 5, 1)
    Sleep(10000)

ProgressOn("Loading", "Auto Fire is now loading...")
For $m = 10 to 0 step -1
For $i = 100 to 0 step -100
ProgressSet($i, $m & " seconds until loading is complete." & @LF & @LF & "Please be patient.")
sleep(592);close to making 100 to 0 = 60 seconds when counting down.
Next
Next
ProgressSet(0 , "You Have 10 seconds to get back in CoH!", "WARNING!")
sleep(2000)
ProgressOff()
sleep(10000)

$1 = 1

While $1 = 1
    Do
        Send ("" & $varkeyname1)
        Sleep (1000)
        Send ("" & $varkeyname2)
        Sleep (1000)
        Send ("" & $varkeyname3)
        Sleep (1000)
        Send ("" & $varkeyname4)
        Sleep (1000)
        Send ("" & $varkeyname5)
        Sleep (1000)
    Until $1 = 10
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Only problem is that when I compile and run it, it ignores the If FileExists part, and does BOTH things, not just the one that i want it to do if there is an INI. All it needs to do, is recognize if there is an ini file, if not ask the 5 questions, then save them to an ini, and next time it's run, the ini is there so that you do not have to create it again. PLEASE HELP ME, im pulling out my hair in frustration... :whistle::dance::dance:

Thanks,

cohaholic

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

change

@WORKINGDIR & 'Auto Fire.ini'

to

@WORKINGDIR & '\Auto Fire.ini'

and start from there.

Do you know what DLL means? "Dynamic Link Library" surely not ini

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Yeah, I knew what DLL meant. Just not paying attention to what i was typing... sorry. well, new code is changed from the old code and it still makes an ini and asks me to enter the numbers... :

#SingleInstance
Global $Paused
HotKeySet ("{PAUSE}", "TogglePause")

    TrayTip("Auto Powers", "Please turn off ANY auto power that you have (Hasten, AM, etc..)", 5, 1)
    Sleep (10000)

If FileExists ( @WORKINGDIR & '\Auto Fire.ini' ) Then
    $varkeyname1 = IniRead ( "Auto Fire.ini" "keys" "key1" "" )
    $varkeyname2 = IniRead ( "Auto Fire.ini" "keys" "key2" "" )
    $varkeyname3 = IniRead ( "Auto Fire.ini" "keys" "key3" "" )
    $varkeyname4 = IniRead ( "Auto Fire.ini" "keys" "key4" "" )
    $varkeyname5 = IniRead ( "Auto Fire.ini" "keys" "key5" "" )
ElseIf Not FileExists ( @WORKINGDIR & '\Auto Fire.ini' ) Then
    TrayTip("Note About Entering Powers", "Please use the CORRECT key or else it will not work!", 5, 1)
    Sleep (10000)
    $varkeyname1 = InputBox ( "Auto Power 1", "Input key # for auto power #1." )
    $varkeyname2 = InputBox ( "Auto Power 2", "Input key # for auto power #2." )
    $varkeyname3 = InputBox ( "Auto Power 3", "Input key # for auto power #3." )
    $varkeyname4 = InputBox ( "Auto Power 4", "Input key # for auto power #4." )
    $varkeyname5 = InputBox ( "Auto Power 5", "Input key # for auto power #5." )
    IniWrite("Auto Fire.ini", "keys", "key1", "" & $varkeyname1)
    IniWrite("Auto Fire.ini", "keys", "key2", "" & $varkeyname2)
    IniWrite("Auto Fire.ini", "keys", "key3", "" & $varkeyname3)
    IniWrite("Auto Fire.ini", "keys", "key4", "" & $varkeyname4)
    IniWrite("Auto Fire.ini", "keys", "key5", "" & $varkeyname5)
EndIf


TrayTip("Pausing Auto Fire", "Use the Pause / Break button located over the page up button to pause this script.  Then use the Windows Task Manager to close the process AutoIt3.exe", 5, 1)
    Sleep(10000)

ProgressOn("Loading", "Auto Fire is now loading...")
For $m = 10 to 0 step -1
For $i = 100 to 0 step -100
ProgressSet($i, $m & " seconds until loading is complete." & @LF & @LF & "Please be patient.")
sleep(592);close to making 100 to 0 = 60 seconds when counting down.
Next
Next
ProgressSet(0 , "You Have 10 seconds to get back in CoH!", "WARNING!")
sleep(2000)
ProgressOff()
sleep(10000)

$1 = 1

While $1 = 1
    Do
        Send ("" & $varkeyname1)
        Sleep (1000)
        Send ("" & $varkeyname2)
        Sleep (1000)
        Send ("" & $varkeyname3)
        Sleep (1000)
        Send ("" & $varkeyname4)
        Sleep (1000)
        Send ("" & $varkeyname5)
        Sleep (1000)
    Until $1 = 10
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

any other suggestions...?

thanks,

cohaholic

Share this post


Link to post
Share on other sites

Missing a whole lot of commas

If FileExists ( @WORKINGDIR & '\Auto Fire.ini' ) Then
    $varkeyname1 = IniRead ( "Auto Fire.ini", "keys", "key1", "" )
    $varkeyname2 = IniRead ( "Auto Fire.ini", "keys", "key2", "" )
    $varkeyname3 = IniRead ( "Auto Fire.ini", "keys", "key3", "" )
    $varkeyname4 = IniRead ( "Auto Fire.ini", "keys", "key4", "" )
    $varkeyname5 = IniRead ( "Auto Fire.ini", "keys", "key5", "" )

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Except gafrost's observation about commas (i wonder,no errors from au3chk?) change this line

"ElseIf Not FileExists ( @WORKINGDIR & '\Auto Fire.ini' ) Then "

to

"Else" simply

It's unnecessary code since this statement has only 2 possibilities...

If 1st statement is false then absolutely 2nd statement is true...

This might cause you trouble too....

BTW Are you sure this code works?

$1 = 1

While $1 = 1
    Do
        Send ("" & $varkeyname1)
        Sleep (1000)
        Send ("" & $varkeyname2)
        Sleep (1000)
        Send ("" & $varkeyname3)
        Sleep (1000)
        Send ("" & $varkeyname4)
        Sleep (1000)
        Send ("" & $varkeyname5)
        Sleep (1000)
    Until $1 = 10
WEnd

You tell it to do this loop Until $1=10 but you dont increment $1 in the loop so this is an endless loop. You have to put right before " Until $1=10" this: $1+=1. But then again

if you do that the While statement will be false and exit the While\Wend loop!

Remove the While loop cos it is unnecessary ... It will be either endless or it will be performed just once.... Unless you want to use it as a cpu hogger....Bu tif you want to have an endless loop at will then remove the do...until loop and make the while..wend:

While 1

.......

.......

wend

Edited by hgeras

Share this post


Link to post
Share on other sites

Except gafrost's observation about commas (i wonder,no errors from au3chk?) change this line

"ElseIf Not FileExists ( @WORKINGDIR & '\Auto Fire.ini' ) Then "

to

"Else" simply

It's unnecessary code since this statement has only 2 possibilities...

If 1st statement is false then absolutely 2nd statement is true...

This might cause you trouble too....

BTW Are you sure this code works?

$1 = 1

While $1 = 1
    Do
        Send ("" & $varkeyname1)
        Sleep (1000)
        Send ("" & $varkeyname2)
        Sleep (1000)
        Send ("" & $varkeyname3)
        Sleep (1000)
        Send ("" & $varkeyname4)
        Sleep (1000)
        Send ("" & $varkeyname5)
        Sleep (1000)
    Until $1 = 10
WEnd

You tell it to do this loop Until $1=10 but you dont increment $1 in the loop so this is an endless loop. You have to put right before " Until $1=10" this: $1+=1. But then again 

if you do that the While statement will be false and exit the While\Wend loop!

Remove the While loop cos it is unnecessary ... It will be either endless or it will be performed just once.... Unless you want to use it as a cpu hogger....Bu tif you want to have an endless loop at will then remove the do...until loop and make the while..wend:

While 1

.......

.......

wend

<{POST_SNAPBACK}>

The commas WERE the problem. Thanks a lot guys =)

P.S. = I DID mean to make an endless loop, thats why i have the pause. Its supposed to hit the buttons forever. =) and its :

$1 = 1

While $1 <= 10
    Do
        Send ("" & $varkeyname1)
        Sleep (1000)
        Send ("" & $varkeyname2)
        Sleep (1000)
        Send ("" & $varkeyname3)
        Sleep (1000)
        Send ("" & $varkeyname4)
        Sleep (1000)
        Send ("" & $varkeyname5)
        Sleep (1000)
        $1 = $1 + 1
    Until $1 = 10
WEnd

That would cause it to run through each command 10 times, in order =)

Thanks,

cohaholic

Share this post


Link to post
Share on other sites

I'm not sure that i grasp the idea but if you want an endless loop you dont have to have 2 loops since their condition is the same variable.... If i take the loop you say then the 11th time the loop will exit since $1 = 11 . So the While condition $1<=10 will no longer be true and exit.... That is not an endless loop.... You will either have to put $1=1 inside the While loop but outside the do...Until .Or use this which does EXACTLY the same thing and surely it is endless....

While 1
        Send ("" & $varkeyname1)
        Sleep (1000)
        Send ("" & $varkeyname2)
        Sleep (1000)
        Send ("" & $varkeyname3)
        Sleep (1000)
        Send ("" & $varkeyname4)
        Sleep (1000)
        Send ("" & $varkeyname5)
        Sleep (1000)
Wend

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