Jump to content

Recommended Posts

Posted (edited)

Hi. I thought I should share my proggie. It is not much, but it does what I want it to do, so it is fine for me.

If you did not get it from the title, this script will read your config.js and will export in config.txt 2 things: install order number and the name of each item in WPI

Example:

5		Microsoft .Net Framework 2.0
6 Mozilla Firefox 1.5 RC 1
10 Winamp 5.1 Lite
.....

I wrote this because I found it hard to monitor the moment when each program is installed. Now dependencies are easier to track .... and I also discovered I had some entries with the same install order, and that was screwing up my install.

So, feel free to modify it to satisfy your needs and post here any opinions you have.

EDIT: Added command line parameters support.

For now, it supports 3 parameters: /i "input file" /o "output file" /f.

You can use only the name of the input/output file or you can specify the whole path.

Example

config.exe  /i C:\wpi\cooooonfig.js /o bau.js

The default input/output folder is the script's directory. The default input file is config.js.

/f forces the script to rewrite the output file if it already exists.

config.au3

Edited by sadicq

Posted (edited)

Of course not ... you can modify it if you want.

Oh, and any suggestion is appreciated. I started this because of my needs, but it can easily be improved.

Edited by sadicq
Posted

I am working on making the tooltips optional and being able to decide whether or not you want category checkboxes plus a couple of more improvements. Also of course more languages., but don't expect it too soon .

Posted

te salut @sadicq

very usefull for me too this script . thank you very much . . .

but i have so many programs without install order and also with same install order .

so , i modified your script for my needs .

1. now show all entries , including here those who havent (yet) install order number

(this was possible because the original script show the doubled entries)

i modified only the Read() function, with red are the changes

Func Read()

Local $nametemp_bak = ""

$file = FileOpen($folderin & "\" & $input, 0)

; Check if file opened for reading OK

While $file = -1

MsgBox(0, "Error", "Unable to open " & $input & ".")

If MsgBox(4,"Cannot open " & $input & ".","Do you want to open it from another location?")==6 Then

$aux=FileOpenDialog("Please select the import file:","","All (*.*)",1+2,"config.js")

If StringInStr($aux,"\",1,-1) Then

$input=StringTrimLeft($aux,StringInStr($aux,"\",1,-1))

$folderin=StringTrimRight($aux,StringLen($aux)-StringInStr($aux,"\",1,-1)+1)

Else

$input=$aux

EndIf

$file = FileOpen($folderin & "\" & $input, 0)

Else

Exit

EndIf

WEnd

; Read in lines of text until the EOF is reached

While 1

$a=FileReadLine($file)

If @error = -1 Then

Insert("-" ,$nametemp_bak)

ExitLoop

EndIf

;Line read, need to analize it now

If StringInStr($a,"ordr[pn]=[",1,1) And StringInStr($a,"//",1,1)<>1 Then

$temp=StringStripCR($a)

$temp=StringTrimLeft($temp,10)

$temp=StringTrimRight($temp,1)

If Not StringIsAlNum($temp) Then

MsgBox(0, "Error", "Possibly corrupted " & $input & ". Cannot continue.")

Exit

Else

Insert( Int($temp) ,$nametemp)

$nametemp_bak = ""

EndIf

ElseIf StringInStr($a,"prog[pn]=[",1,1) And StringInStr($a,"//",1,1)<>1 Then

$nametemp=StringStripCR($a)

$nametemp=StringTrimLeft($nametemp,11)

$nametemp=StringTrimRight($nametemp,2)

$nametemp = MyTrim ( $nametemp ) ; <<--- you can delete this line if you dont want to trim the colours codes

if $nametemp_bak <> "" then Insert("-" ,$nametemp_bak)

$nametemp_bak = $nametemp

EndIf

Wend

FileClose($file)

EndFunc

2. and i added a new function MyTrim() ,

because i use a lots of colours , i trim this part from the name of program writed in config.txt

; ----------------------------------------------------------------------------
Func MyTrim($sir)
Local $kk , $sirulet , $tampon = "" , $logic = 0
For $kk = 1 To StringLen($sir) Step 1
$sirulet = StringMid ( $sir , $kk , 1 )
if $sirulet = "<" then $logic = 1
if $logic = 0 then $tampon = $tampon & $sirulet
if $sirulet = ">" then $logic = 0
Next
Return $tampon
EndFunc
; ----------------------------------------------------------------------------

Posted

@sadicq gave already his ok , i only add few lines just for my needs .

WPI help us , of couse its ok by me .

who knows , till will appear the new version , like @sadicq said , maybe this script can grow !

anyway is a great ideea and a very helpfull script for bigs config.js .

@sadicq , what is the reason for this lines :

;If $CmdLine[0]<>0 Then
; For $k=1 To $CmdLine[0] Step 1
; If $CmdLine[$k]=="/o" And $k<$CmdLine[0] Then
; If StringInStr($CmdLine[$k+1],"\",1,-1) Then
; $output=StringTrimLeft($CmdLine[$k+1],StringInStr($CmdLine[$k+1],"\",1,-1))
; $folderout=StringTrimRight($CmdLine[$k+1],StringLen($CmdLine[$k+1])-StringInStr($CmdLine[$k+1],"\",1,-1)+1)
; Else
; $output=$CmdLine[$k+1]
; EndIf
; ElseIf $CmdLine[$k]=="/i" And $k<$CmdLine[0] Then
; If StringInStr($CmdLine[$k+1],"\",1,-1) Then
; $input=StringTrimLeft($CmdLine[$k+1],StringInStr($CmdLine[$k+1],"\",1,-1))
; $folderin=StringTrimRight($CmdLine[$k+1],StringLen($CmdLine[$k+1])-StringInStr($CmdLine[$k+1],"\",1,-1)+1)
; Else
; $input=$CmdLine[$k+1]
; EndIf
; ElseIf $CmdLine[$k]=="/f" Then
; $overwrite=1
; EndIf
; Next
;EndIf

used in construction and redundant code now ? here work your script without them .

Posted (edited)

That is the support for command line use... as I said in my first post, you can use config.exe /i "your custom named config.js" /o "you custom named output file" /f. /f tells to be silent and overwrite any already existent output file that is named like "your named config.js". /i, /o I think it's obvious what they are doing.

i don't find it necessary but it can be useful when you have more than one config.js and you can use this script in a batch loop.

Edited by sadicq
Posted

thanks man .

i miss this lesson with command parameters in autoit .

and of course it was more simple to ask you today

instead of search last night .

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
  • Recently Browsing   0 members

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