;portion of functions.kix
Function graphical400($drive,$share,$server)
if exist("$drive:\")
else
run "regsvr32 \\srv05wts\netlogon\kixforms.dll /s"
$System = CreateObject("Kixtart.System")
$Form = $System.Form()
$Form.Caption = "AS400 Login"
$Form.ScaleHeight = 200
$Form.ScaleWidth = 250
$Form.FontName = "Arial"
$Form.FontSize = 9
$FrameBanner = $Form.PictureBox
$FrameBanner.BackColor = $Form.RGB(255,255,255)
$FrameBanner.Height = 70
$FrameBanner.Left = 0
$FrameBanner.Top = 5
$FrameBanner.Width = 250
$FrameBanner.FontSize = 20
$FrameBanner.FontName = "lucida"
$FrameBanner.ForeColor = 0
$FrameBanner.FontBold = 1
$FrameBanner.PrintXY(70,0,"As400 Login")
$FrameBanner.FontSize = 14
$FrameBanner.ForeColor = $Form.RGB(0,0,0)
$FrameBanner.PrintXY(71,28,@FULLNAME)
$FrameBanner.FontBold = 0
$FrameBanner.FontSize = 8
$FrameBanner.ForeColor = $Form.RGB(0,0,0)
$FrameBanner.PrintXY(71,50,"Type in your AS400 Credentials")
$FrameBanner.FontSize = 8
; Banner Picture
$PictureBanner = $FrameBanner.Image
$PictureBanner.Picture = "%WINDIR%\System32\shell32.dll;18"
$PictureBanner.Height = 60
$PictureBanner.Left = 5
$PictureBanner.Top = 5
$PictureBanner.Width = 60
$TextBoxUsername = $Form.TextBox
$TextBoxUsername.Height = 19
$TextBoxUsername.Left = 50
$TextBoxUsername.Top = 85
$TextBoxUsername.Text = username
$TextBoxUsername.Width = 161
$TextBoxPassword = $Form.TextBox
$TextBoxPassword.Text = "Password"
$TextBoxPassword.Height = 19
$TextBoxPassword.Left = 50
$TextBoxPassword.PasswordChar = "*"
$TextBoxPassword.Top = 110
$TextBoxPassword.Width = 161
$CmdUserLogin = $Form.CommandButton("Login")
$CmdUserLogin.Default = 1 ; True
$CmdUserLogin.FontName = "Arial"
$CmdUserLogin.FontSize = 10
$CmdUserLogin.FontBold = 1
$CmdUserLogin.Left = 50
$CmdUserLogin.Top = 140
$CmdUserLogin.Width = 78
$CmdUserLogin.Height = 19
$CmdUserLogin.OnClick = "CmdUserLogin_Click($drive,$share,$server)"
$CmdExit = $Form.CommandButton("Cancel")
$CmdExit.FontName = "Arial"
$CmdExit.FontSize = 10
$CmdExit.FontBold = 1
$CmdExit.Top = 140
$CmdExit.Width = 80
$CmdExit.Height = 19
$CmdExit.Left = 133
$CmdExit.OnClick = "quit()"
Dim $StringUsername
Dim $StringPassword
$Form.Show
$TextBoxUsername.SetFocus
While $Form.Visible
$ = Execute($System.Application.DoEvents)
Loop
endif
EndFunction
Function CmdUserLogin_Click($drive,$share,$server)
If $TextBoxUsername.Text = ""
$= $Form.MsgBox("You must specify a username before clicking LOGIN.", "Invalid Username")
$TextBoxUsername.Text = $StringUsername
Exit Sub
Else
$StringUsername = $TextBoxUsername.Text
EndIf
If $TextBoxPassword.Text = ""
$= $Form.MsgBox("You must specify a password before clicking LOGIN.", "Invalid Password")
$TextBoxPassword.Text = $StringPassword
Exit Sub
Else
$StringPassword = $TextBoxPassword.Text
EndIf
$Form.Hide
$share="$server$share"
? "mapping $drive to $share"
Use "$drive:" /Delete
if @ERROR <> "2250"
error_check(@ERROR,@SERROR,"failed to remove $drive drive")
endif
Use "$drive:" $share /user:$StringUsername /password:$StringPassword
error_check(@ERROR,@SERROR,"failed to map $drive drive")
;do your work here!
;map400drive($StringUsername,$StringUsername)
;$= $FORM.MsgBox("Your username is: $StringUserName Your Password is: $StringPassword", "TEST Box Return OF VALUES ENTERED")
EndFunction