Use of VBScript burns my eyes and my fingers but I made this as I am dealing with FTP links all the day.
FileZilla is currently my FTP client under Windows and I did not find time to add this feature, in the right-click menu, yet: copy FTP URL from of a file including the stored FTP password (and yes, I know how unsecure this is).
So workaround is this great tool 3CDlipboard.
Code: Select all
Rem Replace value bellow by your *exact* script name:
ScriptName="FTP password manager"
reg = "HKEY_CURRENT_USER\Software\Vince Valenti\3D Clipboard\Actions\"+ScriptName
Set r = New regexp
r.Pattern = "^ftp://([^:@/]+(:[^:@/]+)[email protected])?([^@/]+)(/.*)$"
Set m = r.Execute(Clipboard.Value)
If m.Count = 1 Then
Set ma = m(0)
Set sh = CreateObject("WScript.Shell")
Rem Normaly we should use "Select Case ma.SubMatches.Count"
Rem But VB does not handles properly capture parenthesis and SubMatches will always return 4
U = ma.SubMatches(0)
P = ma.SubMatches(1)
S = ma.SubMatches(2)
R = ma.SubMatches(3)
If U <> "" Then
Rem Remove '@'
U = Left(U, Len(U)-1)
Else
U = InputBox("Username for "& S & ":")
End If
If P <> "" Then
Rem Remove Password from U
U = Left(U, Len(U)-Len(P))
Rem Remove ':'
P = Right(P, Len(P)-1)
End If
ID = U & "@" & S
on error resume Next
If P = "" Then
P = sh.RegRead (reg & "\" & ID)
If Err.Number <> 0 Then
Err.Clear
P = InputBox("Password for "& ID & ":")
If P <> "" Then
sh.RegWrite reg & "\" & ID, P, "REG_SZ"
End If
End If
Else
Q = sh.RegRead (reg & "\" & ID)
If Err.Number <> 0 Then
Err.Clear
MsgBox "Password for" & ID & "stored!"
sh.RegWrite reg & "\" & ID, P, "REG_SZ"
ElseIf P <> Q Then
If MsgBox ("Password for " & ID & " seems to have changed." & chr(13) & "Do you want to update the stored password?", vbYesNo + vbQuestion, "Password update") = vbYes Then
sh.RegWrite reg & "\" & ID, P, "REG_SZ"
End If
End If
End If
If U <> "" and P <> "" Then
Clipboard.Value = "ftp://" & U & ":" & P & "@" & S & R
ElseIf U <> "" Then
Clipboard.Value = "ftp://" & U & "@" & S & R
End If
End If
Download file:
Cheers,
Julien