Sign in to follow this  
Followers 0
Dragon-RD

Noob with out a clue.

6 posts in this topic

#1 ·  Posted (edited)

Hey guys here's the deal. I have never programed in anything before and i thought id start with Autoit3. After doing the tuts included in the helpfile i thought id try and make a program that ran an exe for me using a .ini file. I got a few errors and sorted them out studying the helpfile as i went. After no success i decided it was time to check some sorce code out. So i downloaded a Diablo2 pindle bot sorce and looked into it.

Well it wont run the exe file i want it too , doesnt come up with an error or anything. It just wont load up. Well i looked at the pindlebot somemore and saw he used a "MyIniRead" function. But when i try it out it tells me its an unknown function, so i'm guessing it is as there isnt anything in the helpfile about it. I'm at a loss to whats going on and any help would be great.

Here's my code , i'm pretty sure its 200% trash as ive never coded before but hey we all have to start somewhere.

Run the exe code :

$SRPath = IniRead("silkroad.ini", "GLOBAL", "SRPath", "")
$SRExe = IniRead("silkroad.ini", "GLOBAL", "SRExe", "Silkroad.exe")
$SRWinTitle = IniRead("silkroad.ini", "GLOBAL", "SRWinTitle", "")

Func StartSR()


Run($SRPath  & $SRExe)
WinWaitActive("Silkroad Online")
WinWaitActive("Silkroad Online", "The server is in examination or out of working time. Connect http://www.silkroadonline.co.kr to see more information.")
Sleep(10000)

EndFunc

Ini

[GLOBAL]
SRPath=C:\Program Files\Silkroad
SRExe=Silkroad.exe
SRWinTitle=Silkroad Online
Edited by Dragon-RD

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Run($SRPath & $SRExe , $SRPath)

There was no Directory specified for the exe to run in so it was trying to run local to the script

I think you should have a \ at the end of SRPath=C:\Program Files\Silkroad or add it in to the run command Run($SRPath & "\" & $SRExe , $SRPath)

Is the ini file local tot he script? if not you need to specify the full location to the ini, IniRead("C:\Program Files\Silkroad\silkroad.ini", "GLOBAL", "SRPath", "")

Edited by ChrisL

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

...

Run the exe code :

$SRPath = IniRead("silkroad.ini", "GLOBAL", "SRPath", "")
$SRExe = IniRead("silkroad.ini", "GLOBAL", "SRExe", "Silkroad.exe")
$SRWinTitle = IniRead("silkroad.ini", "GLOBAL", "SRWinTitle", "")

Func StartSR()


Run($SRPath & $SRExe)
WinWaitActive("Silkroad Online")
WinWaitActive("Silkroad Online", "The server is in examination or out of working time. Connect http://www.silkroadonline.co.kr to see more information.")
Sleep(10000)

EndFunc

Ini

[GLOBAL]
SRPath=C:\Program Files\Silkroad
SRExe=Silkroad.exe
SRWinTitle=Silkroad Online
The Func StartSR() statement is defining the function StartSR() for the rest of the program. It is not actually calling the function, so that's why nothing is happening. All you have to do is add a single line, StartSR(), before the function definition, and it will run. By putting that line there, you are calling the function, which tells the program to run whatever is inside the function definition. Another way would be to get rid of the Func StartSR() and EndFunc lines, because you really don't need a function for this short of a program.

Version 1:

$SRPath = IniRead("silkroad.ini", "GLOBAL", "SRPath", "")
$SRExe = IniRead("silkroad.ini", "GLOBAL", "SRExe", "Silkroad.exe")
$SRWinTitle = IniRead("silkroad.ini", "GLOBAL", "SRWinTitle", "")

StartSR();<== this line calls the below function, and the semi-colon means that this is a comment.

Func StartSR()

Run($SRPath & "\" & $SRExe)
WinWaitActive("Silkroad Online")
WinWaitActive("Silkroad  Online", "The server is in examination or out of working time. Connect  http://www.silkroadonline.co.kr to see more information.")
Sleep(10000)

EndFunc

Version 2:

$SRPath = IniRead("silkroad.ini", "GLOBAL", "SRPath", "")
$SRExe = IniRead("silkroad.ini", "GLOBAL", "SRExe", "Silkroad.exe")
$SRWinTitle = IniRead("silkroad.ini", "GLOBAL", "SRWinTitle", "")

Run($SRPath & "\" & $SRExe)
WinWaitActive("Silkroad Online")
WinWaitActive("Silkroad  Online", "The server is in examination or out of working time. Connect  http://www.silkroadonline.co.kr to see more information.")
Sleep(10000)
Edited by greenmachine

Share this post


Link to post
Share on other sites

Thanks ALOT guys for the replys , its working great!.

Share this post


Link to post
Share on other sites

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