Sign in to follow this  
Followers 0
crystalburner

Bite and chew

38 posts in this topic

Oh Dear, I think I may have promised my boss too much and bitten off more than I can chew.

If I have a list of ftp sites in a table and an array (they get written to a text file like this)

ftp://site1

ftp://site2

ftp://site3

ftp://site4

How can I specify username/passwords in another table/array that correspond to one or all of the ftp sites in the other list?

So that i could select an item from the original list, press launch and if it has an associated username and password in another list i can run the command

ftp://username:password@ftp.hotmail.com

otherwise just run

ftp://hotmail.com

I can sort out the dialogs and for next loops just i dont have a clue how to set up the other arrays and somehow get the input matching with the list.

the usernames need to go in one table

the passwords in another

so that 3 text files can be written

1st (already sorted) list of sites

2nd (need help) usernames

3rd (need help) passwords

then i use another program to read text files and launch ftp

:o

this isn't going to be easy is it..

Share this post


Link to post
Share on other sites



why not using inis?

[font="Verdana"]In work:[list=1][*]InstallIt[*]New version of SpaceWar[/list] [/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Dim $Websites[5]
$Websites[0] = "ftp://website1.com"
$Websites[1] = "ftp://website2.com"
$Websites[2] = "ftp://website3.com"
$Websites[3] = "ftp://website4.com"
$Websites[4] = "ftp://website5.com"

dIM $Usernames[5]
$Usernames[0] = "user1"
$Usernames[1] = "user2"
$Usernames[2] = "user3"
$Usernames[3] = "user4"
$Usernames[4] = "user5"

Dim $Passwords[5]
$Passwords[0] = "password1"
$Passwords[1] = "password2"
$Passwords[2] = "password3"
$Passwords[3] = "password4"
$Passwords[4] = "password5"
$File1 = FileOpen("websites.txt", 1)
$File2 = FileOpen("usernames.txt", 1)
$File3 = FileOpen("passwords.txt", 1)
For $i = 0 to 5
FileWriteLine($File1, $Websites[$i])
FileWriteLine($File2, $Usernames[$i])
FileWriteLine($File3, $Passwords[$i])
Next
FileClose($File1)
FileClose($File2)
FileClose($File3)

is this what ur looking for?

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

Dim $Websites[5]
$Websites[0] = "ftp://website1.com"
$Websites[1] = "ftp://website2.com"
$Websites[2] = "ftp://website3.com"
$Websites[3] = "ftp://website4.com"
$Websites[4] = "ftp://website5.com"

dIM $Usernames[5]
$Usernames[0] = "user1"
$Usernames[1] = "user2"
$Usernames[2] = "user3"
$Usernames[3] = "user4"
$Usernames[4] = "user5"

Dim $Passwords[5]
$Passwords[0] = "password1"
$Passwords[1] = "password2"
$Passwords[2] = "password3"
$Passwords[3] = "password4"
$Passwords[4] = "password5"
$File1 = FileOpen("websites.txt", 1)
$File2 = FileOpen("usernames.txt", 1)
$File3 = FileOpen("passwords.txt", 1)
For $i = 0 to 5
FileWriteLine($File1, $Websites[$i])
FileWriteLine($File2, $Usernames[$i])
FileWriteLine($File3, $Passwords[$i])
Next
FileClose($File1)
FileClose($File2)
FileClose($File3)

is this what ur looking for?

well this bit i understand but it's the actual input bit, i.e. i have 1 list on the screen, how on earth do i take input?

im thinking the best option would be to launch a child window with the list of array 1 in it

and then somehow make two other lists along side it that allow input

um... am i explaining myself properly!?

Share this post


Link to post
Share on other sites

um... nto really, i have no idea what ur trying to say? any screenshots would be helpful: (windows key + printscreen - then paste it in notepad)

Share this post


Link to post
Share on other sites

sorry its been a long weekend

i have a screen with a list

and add / remove / clear all buttons

you can add shares from the network neighbourhood they appear in a list and in an array

the array gets written to disk

on the screen you see this

\\computer1\share

\\computer2\share

i would like to put an autenticate button that launches a child window like the attached

in here you can specify usernames / passwords for any or all of the shares.

i have no idea how to go about it and make them link to the right ones

so if you left \\computer1 blank and just specified a username / password for computer 2 somehow this needs to be written to 3 files like this

file1

\\computer1\share

\\computer2\share

file2

[none]

crystal

file3

[none]

password1

share.bmp

Share this post


Link to post
Share on other sites

oh. I see, you want them to be able to add usernames and passwords to a certain site, so when they click the ADD button, it will append to the file with the site, username and password?

Share this post


Link to post
Share on other sites

oh. I see, you want them to be able to add usernames and passwords to a certain site, so when they click the ADD button, it will append to the file with the site, username and password?

well they will be read by another program from the 3 text files

in short,

i want to read a text file

\\line1\test

\\line2\test

into the screen and an array

and allow to add username / password to each line or just some and then save 3 text files

is this possible?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

well they will be read by another program from the 3 text files

in short,

i want to read a text file

\\line1\test

\\line2\test

into the screen and an array

and allow to add username / password to each line or just some and then save 3 text files

is this possible?

It would help if you posted and example of the three text files, just two or three lines each, and enclose each in "Code" boxes. Also, if you have any code written yet at all, such as creating the GUI, buttons, and input boxes you want to use, post that. All of this minus any REAL usernames or passwords, of course.

I haven't been using AutoIT long myself, but I have learned that the very helpfull people on this forum want to help you with your code, not write it from scratch for you. Code what you can, even if it doesn't work, and post it. They will help you fix it.

:-)

P.S. As a start, there are AutoIT commands that will read a file to an array, or write an array to a file, with single line of code each.

Edited by PsaltyDS

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

It would help if you posted and example of the three text files, just two or three lines each, and enclose each in "Code" boxes. Also, if you have any code written yet at all, such as creating the GUI, buttons, and input boxes you want to use, post that. All of this minus any REAL usernames or passwords, of course.

I haven't been using AutoIT long myself, but I have learned that the very helpfull people on this forum want to help you with your code, not write it from scratch for you. Code what you can, even if it doesn't work, and post it. They will help you fix it.

:-)

P.S. As a start, there are AutoIT commands that will read a file to an array, or write an array to a file, with single line of code each.

This should explain it!

I've got this far, you can select shared folders ONLY from Network Places,

But the authentication button needs to show you or somehow allow you to store usernames and passwords

in another text file

if you play with this you'll see the first text file ~netfldrs.tmp

inside here is your selections

we need 2 other txt files

or one other txt file like so

username\password

something like this

then in the batch files that do the backup i will use a for .. next loop to read the text files with the usernames and passwords

really all I need is something that will read the ~netfldrs.tmp file into an array and allow you to add username / password for one or all entries

Copy_of_screen2.au3

Share this post


Link to post
Share on other sites

I think you need someway of numbering these machines to refference them with the password.

What you could do, instead of just writing them a line at a time is write them like an ini file.

The SectionTitle could be the share name. [\\computername\folder] then you could set 2 lines under it for username= and password=, then if an item was selected in the left you can work out the section name because it is the displayed name and add or lookup the password.

That or you need to have each share numbered 1=\\mycomputer\folder and the second file using the same number with the username and password separated with a character 1=username|password

Either way in your Gui you need some common number or name to match the share with a username and password

Share this post


Link to post
Share on other sites

I think you need someway of numbering these machines to refference them with the password.

What you could do, instead of just writing them a line at a time is write them like an ini file.

The SectionTitle could be the share name. [\\computername\folder] then you could set 2 lines under it for username= and password=, then if an item was selected in the left you can work out the section name because it is the displayed name and add or lookup the password.

That or you need to have each share numbered 1=\\mycomputer\folder and the second file using the same number with the username and password separated with a character 1=username|password

Either way in your Gui you need some common number or name to match the share with a username and password

ahhh bugger!

what about using a delimiter like

having all 3 bits of data on one line with tab as the delim

\\computer1\share @TAB nick @TAB password

just I dont know how to create the gui part where you can add the p/wds

you know?

it needs to look liek the gif i sent

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

ahhh bugger!

what about using a delimiter like

having all 3 bits of data on one line with tab as the delim

\\computer1\share @TAB nick @TAB password

just I dont know how to create the gui part where you can add the p/wds

you know?

it needs to look liek the gif i sent

Yeah that would work, but your complication is going to be working out which item on the left you have selected and which line to modify and if someone deletes an enty, you could do it I just thought that having it in ini format would make that process easier

Edited by ChrisL

Share this post


Link to post
Share on other sites

If you change the following bits this will start you on the way to changing it to the ini format

If FileExists("~netfldr.tmp") Then
    $Folders = IniReadSectionNames("~netfldr.tmp")
;_FileReadToArray("~netfldr.tmp",$folders)
;Else
;$file = FileOpen("~netfldr.tmp", 1)
;_FileReadToArray("~netfldr.tmp",$folders)
;_ArrayDelete($folders,0)
EndIf

and

for $i = 1 to Ubound ($Folders) -1
$sArrayString = _ArrayToString($folders,@TAB, $i,$i )
GUICtrlSetData($mylist, $sArrayString)
next

and the inifile would look like

[\\Bay1server\c$]

user=

password=

[\\Bay6server\checker]

user=

password=

But you'll have to change the way that you save but you wouldn't need to delete the whole file and rewrite it because you could just write to the section names

Share this post


Link to post
Share on other sites

If you change the following bits this will start you on the way to changing it to the ini format

If FileExists("~netfldr.tmp") Then
    $Folders = IniReadSectionNames("~netfldr.tmp")
;_FileReadToArray("~netfldr.tmp",$folders)
;Else
;$file = FileOpen("~netfldr.tmp", 1)
;_FileReadToArray("~netfldr.tmp",$folders)
;_ArrayDelete($folders,0)
EndIf

and

for $i = 1 to Ubound ($Folders) -1
$sArrayString = _ArrayToString($folders,@TAB, $i,$i )
GUICtrlSetData($mylist, $sArrayString)
next

and the inifile would look like

[\\Bay1server\c$]

user=

password=

[\\Bay6server\checker]

user=

password=

But you'll have to change the way that you save but you wouldn't need to delete the whole file and rewrite it because you could just write to the section names

this isn't going to be easy i can see that.

so im still stuck as to how to ask for the input, did you look at the gif

thats the idea i had, display allthe selected shares with input boxes next to them

no sure how to design that :o

Share this post


Link to post
Share on other sites

Also instead of your very long if this folder is a mapped network drive you could use this

For $i = 65 to 90
$checkfldr = StringInStr ( Chr ($i) & ":\", $var2 )
if $checkfldr = 1 Then
$selerr = 1
MsgBox(262208, "Backup", "Your selection includes a drive on your system " & $var2 & " that cannot be added to the backup. Please browse for network shares in My Network Places. Please press the Help! button if you do not understand.") 
EndIf
Next

that would get rid of your A to Z checks of the below

$checkfldr = StringInStr ( "D:\", $var2 )

if $checkfldr = 1 Then

$selerr = 1

MsgBox(262208, "Backup", "Your selection includes a drive on your system " & $var2 & " that cannot be added to the backup. Please browse for network shares in My Network Places. Please press the Help! button if you do not understand.")

EndIf

Share this post


Link to post
Share on other sites

OK based on the ini file idea... You still need to change the overall save method!!

Also I put in my shorter check for mapped drive thing.

#include <GUIConstants.au3>
#include <GuiList.au3>
#include <GuiListView.au3>
#include <Process.au3>
#include<Array.au3>
#include<File.au3>
;#NoTrayIcon

dim $folders
Dim $InArray
Dim $aret
$v = "2.00"

$txtsize = FileGetSize("~netfldr.tmp")
if $txtsize = 0 then 
FileDelete ( "~netfldr.tmp" )
endif
If FileExists("~netfldr.tmp") Then
    $Folders = IniReadSectionNames("~netfldr.tmp")
;_FileReadToArray("~netfldr.tmp",$folders)
;Else
;$file = FileOpen("~netfldr.tmp", 1)
;_FileReadToArray("~netfldr.tmp",$folders)
;_ArrayDelete($folders,0)
EndIf

$CountLines = _FileCountLines("~netfldr.tmp")
if $CountLines > 60 Then
msgbox (262160,"Backup", "Your Backup configuration specifies more than 60 network shares. This is beyond the limit of 60 network shares that Backup is capable of. Please uninstall Backup, delete the CONFIG.QIT file containing your settings and then re-install Backup.")
EndIf

msgbox (262208,"Backup", "Backup is currently set to protect " & $countlines & " network shares on other machines.")

$Main = GUICreate("Backup" & " version " & $v & " Setup and Installation Wizard",640,480)

TrayTip("Backup Step 2/7", "Step 2: This step is completely optional. If you have folders shared on other computers you can add them to the backup as well. Laptops, hand held devices, Apple and IBM compatible desktop computers.", 5, 1)

$filemenu = GuiCtrlCreateMenu ("File")
$exititem = GuiCtrlCreateMenuitem ("Exit",$filemenu)
$helpmenu = GuiCtrlCreateMenu ("Help!")
$webitem = GuiCtrlCreateMenuitem ("Backup Website",$helpmenu)
$guideitem = GuiCtrlCreateMenuitem ("Setup Guide",$helpmenu)
$aboutitem = GuiCtrlCreateMenuitem ("About Backup",$helpmenu)


GuiCtrlCreatePic("qbackup.gif",0,2, 175,35,$WS_EX_TRANSPARENT)
GuiCtrlCreatePic("2.gif",575,2, 60,53,$WS_EX_TRANSPARENT)
GuiCtrlCreateLabel("Setup Wizard", 5, 35)
GuiCtrlCreateLabel("Version " & $v & " © 2006 Qual-IT", 5, 50)
GuiCtrlCreateLabel("Select shared folders on other computers to backup (optional).", 5, 80)
GuiCtrlCreateLabel("Use the Clear button to clear your selections. This section is for specifying up to 60 network shares.", 5,93 )
GuiCtrlCreateLabel("If you are stuck press the Help! button for an explaination of this page, otherwise press Next when done.", 5, 106)
GuiCtrlCreateLabel("You currently have the following network shares selected:", 5, 145)

$mylist = GUICtrlCreateList("", 5, 165, 270, 165, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY))
;GUICtrlSetLimit(-1,200); to limit horizontal scrolling

GuiCtrlCreateLabel("Passwords for network shares:", 320, 145)
GuiCtrlCreateLabel("Some network resources require authentication. If you need to", 320, 165)
GuiCtrlCreateLabel("supply a username and password to access one or more of your", 320, 178)
GuiCtrlCreateLabel("your network resources you wish to backup, please press", 320, 191)
GuiCtrlCreateLabel("the Authentication button below to specify credentials", 320, 204)
GuiCtrlCreateLabel("that may be needed for Backup to access other machines.", 320, 217)

$authbutton = GuiCtrlCreateButton ("Authentication",380,300,70,20)
$advbutton = GuiCtrlCreateButton ("Advanced",450,300,70,20)

$outlook = GUICtrlCreateRadio("Somebody works on this computer and it has Microsoft Outlook or Outlook Express e-Mail.", 5, 365)
$exchange = GUICtrlCreateRadio("This computer is an unattended Server and has Microsoft Exchange Installed.", 5, 383)
$nonms = GUICtrlCreateRadio("This computer is an unattended Server and has a non Microsoft e-Mail system installed.", 5, 401)

$Add = GuiCtrlCreateButton ("Add",5,315,70,20)
$removebutton = GuiCtrlCreateButton ("Remove",80,315,70,20)
$clearbutton = GuiCtrlCreateButton ("Clear",155,315,70,20)

$helpbutton = GuiCtrlCreateButton ("Help!",414,435,70,20)
$quitbutton = GuiCtrlCreateButton ("Quit",489,435,70,20)
$nextbutton = GuiCtrlCreateButton ("Next >>",564,435,70,20)
$backbutton = GuiCtrlCreateButton ("<< Back",5,435,70,20)

GuiSetState()

for $i = 1 to Ubound ($Folders) -1
$sArrayString = _ArrayToString($folders,@TAB, $i,$i )
GUICtrlSetData($mylist, $sArrayString)
next

While 1

$msg = GUIGetMsg()
  Select

Case $msg = $GUI_EVENT_CLOSE
       $answer = MsgBox(262148, "Backup", "You are about to quit without saving your changes. Press Next to complete the next step. Backup will not operate correctly until you complete this Wizard. Are you sure?")
If $answer = 6 Then
exit
EndIf

Case $msg = $quitbutton
       $answer = MsgBox(262148, "Backup", "You are about to quit without saving your changes. Press Next to complete the next step. Backup will not operate correctly until you complete this Wizard. Are you sure?")
If $answer = 6 Then
exit
EndIf

Case $msg = $helpbutton
          MsgBox(262208, "Backup", "I fucking need help not you")

Case $msg = $nextbutton

Call ( Save ( ) )
MsgBox(262208, "Backup", "Settings saved!")


Case $msg = $exititem
ExitLoop

Case $msg = $removebutton
 $ret = _GUICtrlListGetSelItemsText ($mylist)
          If (Not IsArray($ret)) Then
                 MsgBox(262192, "Backup", "Nothing selected to remove!")
             Else
                 ;For $i = 1 To $ret[0]
                   ;MsgBox(262208, "Selected", $ret[$i])

       ;Next            
 EndIf
 $ret = _GUICtrlListSelectedIndex ($mylist)
;MsgBox(4, "Testdata", $ret)
 $aret=( $ret + 1 )
 _GUICtrlListDeleteItem($mylist, $ret)
 
Case $msg = $authbutton
 $ret = _GUICtrlListGetSelItemsText ($mylist)
          If (Not IsArray($ret)) Then
                 MsgBox(262192, "Backup", "No shares selected to specify authentication for. Please select a share in the left hand part of this section.")
             Else
                #region --- GuiBuilder code Start ---

$Sub = GuiCreate($Ret[1], 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$userName = GuiCtrlCreateInput("", 160, 40, 170, 20)
$password = GuiCtrlCreateInput("", 160, 80, 170, 20)
$Label_1 = GuiCtrlCreateLabel("User Name", 50, 40, 90, 20)
$Label_2 = GuiCtrlCreateLabel("Password", 50, 80, 90, 20)
$Submit = GuiCtrlCreateButton("Submit", 130, 130, 110, 30)

GuiSetState()
GuiSetState (@sw_hide, $Main)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $Msg = $Submit
        $User = GuiCtrlRead ($userName)
        $Pass = GuiCtrlRead ($Password)
        iniWrite ("~netfldr.tmp", $Ret[1], "User" ,$User)
        iniWrite ("~netfldr.tmp", $Ret[1], "Password" ,$pass)
        GuiSetState (@sw_show, $Main)
        GuiDelete ($Sub)
        exitloop
    Case Else
    ;;;
    EndSelect
WEnd


                 ;For $i = 1 To $ret[0]
                   ;MsgBox(262208, "Selected", $ret[$i])

       ;Next            
 EndIf
 GUICreate("Backup" & " version " & $v & " Network Authentication",320,200)

$mylist = GUICtrlCreateList("", 5, 165, 270, 165, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY))
 $ret = _GUICtrlListSelectedIndex ($mylist)
;MsgBox(4, "Testdata", $ret)
 $aret=( $ret + 1 )
 _GUICtrlListDeleteItem($mylist, $ret)

Case $msg = $clearbutton
               $answer = MsgBox(262148, "Backup", "This will permanently remove ALL the selected folders from your backup. Are you sure?")
            If $answer = 6 Then
_GUICtrlListClear ($mylist)
for $i = 0 to 100
_ArrayDelete ( $folders,$i )
next
FileClose ( "~netfldr.tmp" )
FileDelete ( "~netfldr.tmp" )
EndIf

Case $msg = $Add
$selerr = 0
For $i = 1 to 1
$var = FileSelectFolder("Choose a folder to backup!", "")
if @error = 1 Then exitloop
$drivetype = DriveGetType( $var )
; for testing the drive type! 
;MsgBox(4096, "Backup", $drivetype)


if $drivetype = "Removable" Then 
MsgBox(262160, "Backup", "Sorry you cannot backup floppy or removable drives!") 
exitloop
EndIf

if $drivetype = "CDROM" Then
MsgBox(262160, "Backup", "Sorry you cannot backup CD-ROM or DVD-ROM Drives!") 
exitloop
EndIf

if $drivetype = "Fixed" Then
MsgBox(262160, "Backup", "Local disks are backed up in the previous part of this Wizard (step 1)!") 
exitloop
EndIf

if $drivetype = "" Then
MsgBox(262160, "Backup", "Sorry you cannot backup this location!") 
exitloop
EndIf
$var2 = $var
$var2 = StringSplit(StringTrimRight($var2,1),"\")
$var2 = "" & $var2[1] & "\" 
;msgbox(4,"var2",$var2)
For $i = 65 to 90
$checkfldr = StringInStr ( Chr ($i) & ":\", $var2 )
if $checkfldr = 1 Then
$selerr = 1
MsgBox(262208, "Backup", "Your selection includes a drive on your system " & $var2 & " that cannot be added to the backup. Please browse for network shares in My Network Places. Please press the Help! button if you do not understand.") 
EndIf
Next


if not $selerr = 1 Then
$var = StringSplit(StringTrimLeft($var,2),"\")
$var = "\\" & $var[1] & "\" & $var[2] 
        
_ArrayAdd ( $folders, $var )
 GUICtrlSetData($mylist, $var)
call ( Save () )
EndIf

Next

Case $msg = $aboutitem

Case $msg = $guideitem
Msgbox(262208,"Guide", "This will display the full setup guide.")

Case $msg = $webitem
_RunDos("start /max http://www.qualit-uk.com/backup")

EndSelect


WEnd

GUIDelete()

Exit

Func Save ( )
$Pos1 = _ArrayToString($folders,@TAB, 1, 1 )
;_ArrayDisplay( $folders, "_ArrayDisplay() Test" )
if $Pos1 = "" THEN exit
If FileExists("~netfldr.tmp") Then
FileDelete ( "~netfldr.tmp" )
CALL ( Folders ( ) )
CALL ( _ArrayRemoveDupes($folders) )
_ArraySort( $folders )
;_ArrayDisplay( $folders, "_ArrayDisplay() Test" )
_FileWriteFromArray("~netfldr.tmp",$folders,1)
$file=FileClose("~netfldr.tmp")
EndIf
$txtsize = FileGetSize("~netfldr.tmp")
if $txtsize = 0 then 
FileDelete ( "~netfldr.tmp" )
endif
If FileExists("~netfldr.tmp") Then
_FileReadToArray("~netfldr.tmp",$folders)
Else
$file = FileOpen("~netfldr.tmp", 1)
_FileReadToArray("~netfldr.tmp",$folders)
_ArrayDelete($folders,0)
EndIf
;_ArrayDisplay( $folders, "_ArrayDisplay() Test" )
If FileExists("~netfldr.tmp") Then
FileDelete ( "~netfldr.tmp" )
CALL ( Folders ( ) )
CALL ( _ArrayRemoveDupes($folders) )
if not $aret = "" THEN
_ArrayDelete ( $folders, $aret )
Endif
_ArraySort( $folders )
;_ArrayDisplay( $folders, "_ArrayDisplay() Test" )
_FileWriteFromArray("~netfldr.tmp",$folders,1)
$file=FileClose("~netfldr.tmp")
EndIf
EndFunc

Func Folders ( )
$folders = _ArrayRemoveDupes($folders)
EndFunc
Func _ArrayRemoveDupes($InArray)
    Dim $TempArray[$InArray[0]+1][2]
    $TempArray[0][0] = $InArray[0]
    For $x = 1 to $InArray[0]
        $TempArray[$x][0] = $InArray[$x]
        $TempArray[$x][1] = $x
    Next
$n = $temparray[0][0]
$h = 1
While $h <= $n/3
    $h = $h * 3 + 1
WEnd

While $h >0
    For $outer = $h To $n
        $temp = $temparray[$outer][0]
        $temp2 = Number(StringStripWS($temparray[$outer][1],1))
        $inner = $outer
        While $inner > ($h - 1) And StringLower($temparray[$inner-$h][0]) >= StringLower($temp)
            $temparray[$inner][0] = $temparray[$inner-$h][0]
            $temparray[$inner][1] = $temparray[$inner-$h][1]
            $inner = $inner - $h
        WEnd
        $temparray[$inner][0] = $temp
        $temparray[$inner][1] = $temp2
    Next
$h = ($h - 1)/3
WEnd    
For $blah = 1 To $temparray[0][0]-1
    If $TempArray[$blah][0] = $temparray[$blah + 1][0] Then
        _ArrayDelete($InArray,$temparray[$blah][1])
        $InArray[0] = $InArray[0]-1
    EndIf
Next
Return($InArray)
EndFunc

Func _FileSearch($szMask,$nOption)
    $szRoot = ""
    $hFile = 0
    $szBuffer = ""
    $szReturn = ""
    $szPathList = "*"
    Dim $aNULL[1]
    If Not StringInStr($szMask,"\") Then
         $szRoot = @SCRIPTDIR & "\"
    Else
         While StringInStr($szMask,"\")
              $szRoot = $szRoot & StringLeft($szMask,StringInStr($szMask,"\"))
              $szMask = StringTrimLeft($szMask,StringInStr($szMask,"\"))
         Wend
    EndIf
    If $nOption = 0 Then
         _FileSearchUtil($szRoot, $szMask, $szReturn)
    Else
         While 1
              $hFile = FileFindFirstFile($szRoot & "*.*")
              If $hFile >= 0 Then
                   $szBuffer = FileFindNextFile($hFile)
                   While Not @ERROR
                        If $szBuffer <> "." And $szBuffer <> ".." And _
                             StringInStr(FileGetAttrib($szRoot & $szBuffer),"D") Then _
                             $szPathList = $szPathList & $szRoot & $szBuffer & "*"
                        $szBuffer = FileFindNextFile($hFile)
                   Wend
                   FileClose($hFile)
              EndIf
              _FileSearchUtil($szRoot, $szMask, $szReturn)
              If $szPathList == "*" Then ExitLoop
              $szPathList = StringTrimLeft($szPathList,1)
              $szRoot = StringLeft($szPathList,StringInStr($szPathList,"*")-1) & "\"
              $szPathList = StringTrimLeft($szPathList,StringInStr($szPathList,"*")-1)

         Wend
    EndIf
    If $szReturn = "" Then
         $aNULL[0] = 0
         Return $aNULL
    Else
         Return StringSplit(StringTrimRight($szReturn,1),"*")
    EndIf
EndFunc

Func _FileSearchUtil(ByRef $ROOT, ByRef $MASK, ByRef $RETURN)
    $hFile = FileFindFirstFile($ROOT & $MASK)
    If $hFile >= 0 Then
         $szBuffer = FileFindNextFile($hFile)
         While Not @ERROR
              If $szBuffer <> "." And $szBuffer <> ".." Then _
                   $RETURN = $RETURN & $ROOT & $szBuffer & "*"
              $szBuffer = FileFindNextFile($hFile)
         Wend
         FileClose($hFile)
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

thats completely screwed it all up!

it just closes when you add anything

my arrays are a bit delicate and when anyone tries to offer help it screws it all up!

i will think about this another way and post something

Share this post


Link to post
Share on other sites

thats completely screwed it all up!

it just closes when you add anything

my arrays are a bit delicate and when anyone tries to offer help it screws it all up!

i will think about this another way and post something

That is because you haven't changed your whole script to use the ini style method, it works up to the point that it saves! And you can add the authentication in too.

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