Jump to content
Sign in to follow this  
C4sToR

executable + parameters

Recommended Posts

C4sToR

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] )

Share this post


Link to post
Share on other sites
Xenobiologist

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

Share this post


Link to post
Share on other sites
C4sToR

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 :)

Share this post


Link to post
Share on other sites
Zedna

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

Share this post


Link to post
Share on other sites
C4sToR

there are no means to do it such as in dos with the for and the options that skip the lines you want ?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.