Sign in to follow this  
Followers 0
lolp1

Need help with something simple

7 posts in this topic

I'm fairly new to Auto-It and I'm looking for some help on this issue.

Here is what I need to do.

In my script there is a code like this..

Run [FILE LOCATION HERE}

I need to have a user friendly way to be able to change the FILE LOCATION HERE area.

EG: Like a .ini I guess, they have a folder with some thing like

;Here you can change what program to run

[1] {PROGRAM LOCATION JERE}

What ever they fill in there, That's what I would like the source to open.

How can I do this>

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

HI,

you can create a FileOpenDialog and then RUN the file given back with your command.

So long,

Mega

$var = FileOpenDialog("Choose a file", "C:\Windows\", "All (*.*)", 1 + 2 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    MsgBox(4096,"","You chose " & $var)
    RunWait(@ComSpec & ' /c start ' & $var, '', @SW_HIDE)
EndIf
Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thanks for the fast reply, but that makes it so they have to edit the actual sourc correct?

Also, the script is ment to run mutible program.

Here is a little exsample..

Run("C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet")

sleep(18000)

WinMove("Diablo II", "", 1, 1,)

There will be four of those lines.

I need a .ini file like this

; Here, you can choose the paths of your diablo II to be opend..

Location #1= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

Location #2 = C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

Location #3= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

Location #4= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

What ever they fill in here "C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet""

Is what I would like it to open.

I know I know.... I'm a beginer at auto-it:(

Share this post


Link to post
Share on other sites

HI,

sorry I don't get what you want. :">

Maybe you should take a look at http://www.autoitscript.com/forum/index.ph...c=25790&hl=

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thanks for the fast reply, but that makes it so they have to edit the actual sourc correct?

Also, the script is ment to run mutible program.

Here is a little exsample..

Run("C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet")

sleep(18000)

WinMove("Diablo II", "", 1, 1,)

There will be four of those lines.

I need a .ini file like this

; Here, you can choose the paths of your diablo II to be opend..

Location #1= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

Location #2 = C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

Location #3= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

Location #4= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet"

What ever they fill in here "C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet""

Is what I would like it to open.

I know I know.... I'm a beginer at auto-it:(

Check the help file for IniRead() and IniReadSection(). Create an .ini file with a section like this:

[Diablo Locations]
Location_1= C:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet
Location_2 = D:\Program Files\Games\Diablo II\Diablo II.exe -w -skiptobnet
Location_3= C:\Diablo II\Diablo II.exe -w -skiptobnet
Location_4= E:\Program Files\Diablo II\Diablo II.exe -w -skiptobnet

Then you read them out with:

$D2_Ini = "C:\Program Files\Diablo II\DiabloLocations.ini"
$asD2Locs = IniReadSection($D2_Ini, "Diablo Locations")

The 2D array in $$asD2Locs now contains all the options in that section. In this example:

$asD2Locs[0][0] = 4

$asD2Locs[2][0] = "Location_2"

$asD2Locs[2][1] = "D:\Program Files\Games\Diablo II\Diablo II.exe -w -skiptobnet"

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

What do you mean by this section of your post.

CODE: AutoIt

$D2_Ini = "C:\Program Files\Diablo II\DiabloLocations.ini"

$asD2Locs = IniReadSection($D2_Ini, "Diablo Locations")

The 2D array in $$asD2Locs now contains all the options in that section. In this example:

$asD2Locs[0][0] = 4

$asD2Locs[2][0] = "Location_2"

$asD2Locs[2][1] = "D:\Program Files\Games\Diablo II\Diablo II.exe -w -skiptobnet"

Share this post


Link to post
Share on other sites

What do you mean by this section of your post.

$D2_Ini = "C:\Program Files\Diablo II\DiabloLocations.ini"
$asD2Locs = IniReadSection($D2_Ini, "Diablo Locations")

The 2D array in $$asD2Locs now contains all the options in that section. In this example:

$asD2Locs[0][0] = 4

$asD2Locs[2][0] = "Location_2"

$asD2Locs[2][1] = "D:\Program Files\Games\Diablo II\Diablo II.exe -w -skiptobnet"

It was meant to be an example of how you could accomplish what you wanted to do with an .ini file. There is a two line code fragment that sets the variable $D2_Ini to the location of the .ini file, then reads the [Diablo Locations] section of the .ini into a 2-dimensional array variable called $asD2Locs. Once you have read that section into the array, you can use it to make a list of choices for the user on a GUI.

If none of that made sense, you might want to sit down with the AutoIT 123 tutorial. Won't take you long to figure it out.

Or, maybe I missed the point of question? :D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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