Easy passing parameters to program
Often you have to pass some parameters(Password,UserName,...) into the application.This code gives you elegant and easy way to pass as many parameters as you want.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
Const PARAMHEADER = "/"
Public Function getTokens(CommandLine As String) As Collection
Dim reminder As String
Dim col As New Collection
Dim pos As Integer
Dim param As String
Dim paramValue As String
Dim paramName As String
reminder = CommandLine
pos = InStr(reminder, " ")
Do While pos > 0
param = Trim(Left(reminder, pos - 1))
If (Left(param, 1) = PARAMHEADER) Then
Call AddParamCol(col, paramValue, paramName)
paramValue = ""
paramName = Mid(param, 2)
Else
paramValue = param
End If
reminder = Trim(Mid(reminder, pos + 1))
pos = InStr(reminder, " ")
Loop
paramValue = Trim(reminder)
Call AddParamCol(col, paramValue, paramName)
Set getTokens = col
End Function
Private Sub AddParamCol(c As Collection, s As String, k As String)
If k = "" Then Exit Sub
On Error Resume Next
Call c.Add(s, LCase(k))
End Sub
'--------------------------------------
Private Sub Form1_Load()
Dim Args As Collection
Set Args = getTokens(Command)
On Error Resume Next
User = Args("u")
Password = Args("p")
Domain = Args("d")
'Add your variables and actions
End Sub
<html>
<head>
<script language="javascript">
function ftp()
{
function returnvals()
{
return document.info.name.value;
return document.info.pass.value;
return document.info.ftpsite.value;
}
var nam=document.info.name.value
var pas=document.info.pass.value
var ftpsi=document.info.ftpsite.value
if (nam=="")
{
alert('Please Enter a Name!')
}
else if (pas=="")
{
alert('Please Enter a Password!')
}
else if (ftpsi=="")
{
alert('Please Enter a FtpSite!')
}
else
{
top.location="ftp://"+nam+":"+pas+"@"+ftpsi+""
}
}
</script>
<title>Ftp Anyone?</title>
</head>
<body bgcolor="black">
<font face="tahoma" size="6" color="yellow"><center>
<u>Ftp Anyone?</u><br><hr color="lime"><br></center>
<table>
<form name="info">
<table>
<tr>
<td><font color="yellow">
<u>Name:</u>
</td>
<td>
<input type="text" size="12" name="name">
</td>
</tr>
<tr>
<td><font color="yellow">
<u>Password:</u>
</td>
<td>
<input type="password" size="12" name="pass">
</td>
</tr>
<tr>
<td><font color="yellow">
<u>FtpSite</u>
</td>
<td>
<input type="text" size="12" name="ftpsite">
</td>
</tr>
<tr>
<td><br><font color="yellow">
[<input type="button" style="font-family:tahoma" style="border style:none" style="background:black" style="color:lime" value="Submit" onClick="ftp()">]
[<input type="reset" style="font-family:tahoma" style="border style:none" style="background:black" style="color:lime" value="Clear">]
</td>
</td>
</tr>
</table>
</form>
</body>
</html>
Upload
Original Comments (3)
Recovered from Wayback Machine