Jump to content
Sign in to follow this  
Kyme

Indexing file help

Recommended Posts

Kyme

i have make this script

$message = "Hold down Ctrl or Shift to choose multiple files."
$file = FileOpen(@ScriptDir & "\Index.txt", 1)
$file2 = FileOpen(@ScriptDir & "\Index1.txt", 1)
$var = FileOpenDialog($message, @ScriptDir & "", "Maps (*.bsp)|All (*.*)"  , 1 + 4 )

If @error Then
    MsgBox(4096,"Error","No File(s) chosen")
Else
    $var = StringReplace($var, "|", @CRLF)
    $var = StringReplace($var, @WorkingDir, "Folder="&@WorkingDir&@CRLF)
    
    If FileExists($file) Then
        FileWrite($file2, $var)
            Exit
    Else
        FileWrite($file, $var)
            Exit
    EndIf
EndIf

but i wanna make it when i index one folder and Index.txt exist to make index2.txt if file index2.txt exist to make index3.txt..... index(infinite).txt

how i can make this???

tnx

Edited by Kyme

Share this post


Link to post
Share on other sites
TehWhale

$message = "Hold down Ctrl or Shift to choose multiple files."
$var = FileOpenDialog($message, @ScriptDir & "", "Maps (*.bsp)|All (*.*)", 1 + 4)

If @error Then
    MsgBox(4096, "Error", "No File(s) chosen")
Else
    $i = 0
    $var = StringReplace($var, "|", @CRLF)
    $var = StringReplace($var, @WorkingDir, "Folder=" & @WorkingDir & @CRLF)
    Do
        $i = $i + 1
    Until Not FileExists(@ScriptDir & "\Index" & $i & ".txt")
    FileWrite(@ScriptDir & "\Index" & $i & ".txt", $var)
EndIf

:P

Share this post


Link to post
Share on other sites
Kyme

$message = "Hold down Ctrl or Shift to choose multiple files."
$var = FileOpenDialog($message, @ScriptDir & "", "Maps (*.bsp)|All (*.*)", 1 + 4)

If @error Then
    MsgBox(4096, "Error", "No File(s) chosen")
Else
    $i = 0
    $var = StringReplace($var, "|", @CRLF)
    $var = StringReplace($var, @WorkingDir, "Folder=" & @WorkingDir & @CRLF)
    Do
        $i = $i + 1
    Until Not FileExists(@ScriptDir & "\Index" & $i & ".txt")
    FileWrite(@ScriptDir & "\Index" & $i & ".txt", $var)
EndIf

:P

awesome man....tnx very very much for helping me

Regards

Share this post


Link to post
Share on other sites
TehWhale

awesome man....tnx very very much for helping me

Regards

Hello,

It appears you have found your answer to your question.

Please take the time to edit your thread title with [RESOLVED] so others know that is it resolved.

You can do this by scrolling to the top of your thread, clicking EDIT and then Full Edit and adding: "[RESOLVED]"

to the front of your thread title.

Thanks for your cooperation.

Edited by TehWhale

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  

×