Hi NTDOC,
I wrote a script that is saving the favorites of the internet explorer and netscape navigator. I want to save the netscape bookmarks twice. once in a directory named after the workstation and on the other hand in the root of the backup directory. In the workstation directory the files should be overwritten - in the root directory the files should continously renamed bookmark1.htm, bookmark2.htm and so on. I got problems with the last task and would appreciate any help:
code:
Break On
Dim $iAttempts
Dim $sServer
Dim $sDrive
Dim $sLogin
Dim $sPassword
$iAttempts=3
$sDrive="X:"
$sServer="\\servername"
While($iAttempts)
"Username + Password... " ? ?; (" "noch " + $iAttempts + " Versuche möglich)" ?
$sLogin=GetString(" Username: ") ?
$sPassword=GetString(" Password: ","*") ?
Use $sDrive $sServer + "\" + $sLogin + "$$" /USER:$sLogin /PASSWORD:$sPassword
If @ERROR
"ERROR: @ERROR @SERROR" ? ?
$iAttempts=$iAttempts-1
Else
$iAttempts=0
EndIf
Loop
SHELL "%COMSPEC% /c XCOPY /d /s /e /q " + "%USERPROFILE%" + "\Favorites\*.* " + $sDrive + "\IE\Favorites\"
$folder=$sDrive + "\Netscape\"+@WKSTA
If Exist ($folder) = 0
MD $folder
If @error <> 0
? "Error "+@error+" "+@serror
Endif
Endif
$search_key = "c:\bookmark.htm"
$Save = $sDrive + "\Netscape\@WKSTA"
$Save2 = $sDrive + "\Netscape\"
If (Exist("%temp%\bookmark.tmp") = 1)
DEL %temp%\bookmark.tmp
Endif
SHELL "%comspec% /e:1024 /c dir " + $search_key + " /a /b /s >%temp%\bookmark.tmp"
SHELL "%comspec% /e:1024 /c echo -Ende der Liste- >>%temp%\bookmark.tmp"
If (Exist ("%temp%\bookmark.tmp") = 1)
If Open(1,"%temp%\bookmark.tmp")
Endif
$found="no"
$count=0
While ($found = "no")
$result=ReadLine(1)
If (@error <> 0) OR (InStr($result,"-End of List-") <> 0)
$found="yes"
Else
$count=$count+1
If Open(2, $result)
Endif
GOSUB Save_Favorites
If Close(2)
Endif
Endif
Loop
If Close(1)
Endif
Endif
DEL %temp%\bookmark.tmp
Exit
:Save_Favorites
If (Substr($Save,Len($Save),1) = "\")
$Save=Substr($Save,1,Len($Save)-1)
Else If (Substr($Save2,Len($Save2),1) = "\")
$Save2=Substr($Save2,1,Len($Save2)-1)
Endif
If ($count > 0) ; If ($count > 1)
$target=$Save + "\bookmark"+$count+".htm"
$target2=$Save2 + "\bookmark"+$count+".htm"
Else
$target=$Save + "\bookmark.htm"
$target2=$Save2 + "\bookmark.htm"
EndIf
COPY $result $target /h
COPY $result $target2 /h
If (@error <> 0)
? "Warning: error @error (@serror)"
Endif
RETURN
Exit 0
Function EnumDir($p)
If not $p Return Endif
Dim $f
$f = DIR($p)
While $f <> "" and @Error = 0
If not ($f = "." OR $f = "..")
Endif
$f = Dir()
Loop
Endfunction
Function GetString($sPrompt,Optional $sPassChar)
Dim $cKey
$sPrompt
While("True")
Get $cKey
Select
Case $cKey=Chr(8)
If $GetString<>""
Chr(8) " " Chr(8)
$GetString=SubStr($GetString,1,Len($GetString)-1)
EndIf
Case $cKey=Chr(13)
If $GetString<>"" Return EndIf
Case Asc($cKey)>=32 AND Asc($cKey)<=127
$GetString=$GetString+$cKey
If $sPassChar<>"" $sPassChar Else $cKey EndIf
Case "True"
EndSelect
Loop
EndFunction
Regards
Mike