Jump to content

executable + parameters


Recommended Posts

hi everybody,

just discovered autoit to do some automatic thing as configuring some applications and other.

i made a script that open a .txt file read the group and create them that work perfect.

just wanna know how i can do it in order the .txt files will not be put in the autoit script but in parameters as for example : creategroupe group.txt

it will permit me to give in parameters all the files i want without changing the .exe

anyone can help me doing this

below, an example of my actual script :

$file = FileOpen("c:\Admintools\Config\fctel.cvs", 0)

; Check if file opened for reading OK
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

; Read in 1 character at a time until the EOF is reached
While 1
    $line = FileReadLine($file, 2)
    If @error = -1 Then ExitLoop

$array = StringSplit($line, ';', 1)
    MsgBox (0, "Séparation", $array[1])
    
    
Run("cmd.exe")
Sleep(2000)
Send("C:")
Send("{ENTER}")
Sleep(2000)
Send("cd Admintools")
Send("{ENTER}")
Sleep(2000)
Send("cd config")
Send("{ENTER}")
Sleep(2000)

;lancement de SamACL.exe    
    Send(" SamACL.exe -s -d Account -a  " & $array[1] )
Link to comment
Share on other sites

Hi,

you can create a GUI to input your parameter or just use $cmdline

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

Link to comment
Share on other sites

oki it works well with the $cmdline

my other question is how can i skip the first line of the txt cuz its match with the label : GROUP and i wanna skip this line but can find any function to skip lines on fileopen or filereadlines :)

Link to comment
Share on other sites

my other question is how can i skip the first line of the txt cuz its match with the label : GROUP and i wanna skip this line but can find any function to skip lines on fileopen or filereadlines :)

#include <File.au3>

_FileReadToArray()

Then you may go through the lines by FOR NEXT loop and start from line 2

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...