#129256 - 2004-11-10 08:16 PM
Please examine script
|
Fugazi
Starting to like KiXtart
Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
|
I wrote these scripts to replace a system called Xcellenet that the company has decided not to renew. We use this system to keep all of our Personal Oracle laptops in sync, perform system maintenance, retrieve daily information from them and for disater recovery.
This has turned into a monster script. It still has some bugs that I am trying to work out such as when you do a search on the Jobs tab it shutdowns the Admin Form and when I edit a user's profile it is deleting all of the users in the VUIA.DAT file. Also is there a way that I can force a loop to terminate. The I am having a difficult time breaking out Runscripts(). If the stop button is pushed it is only acting as a pause. The loop continues if another button is selected.
Please let me know what you think and if you see a better way of doing something in the script please let me know but also explain why it is an improvement because I am completely self taught in scripting and I want to vastly improve my programing knowledge.
I would also like to thank Howard Bullock for the initial loop that set this script into motion.
reg.kix
Code:
Run "regsvr32 c:\winnt\system32\kixforms.dll"
WriteValue ("HKEY_Local_Machine\Software\AMSUtil","Server","\\server\share\","REG_SZ")
WriteValue ("HKEY_Local_Machine\Software\AMSUtil","WorkDir","c:\mtglaptop\","REG_SZ")
WriteValue ("HKEY_Local_Machine\Software\AMSUtil","NetPath","mtglaptop\","REG_SZ")
WriteValue ("HKEY_Local_Machine\Software\AMSUtil","Logs","kixlogs\mtglaptop\","REG_SZ")
WriteValue ("HKEY_Local_Machine\Software\AMSUtil","CFGFile","settings.ini","REG_SZ")
amssync.kix
Code:
;===============================================================================================
;**** Last Modified on 11/10/2004 at 8:43:04 AM by dkrogol****
;===============================================================================================
;This script will keep kixtart scripts and system files up to date
;and initialize the program.
Break on
SetConsole ("hide")
Global $localscripts,$netscripts,$workdir,$oralogon,$logpath,$netpath,$locallog,
$errmsg,$runerr,$clients,$logfile,$netlogs,$inifile,$netini,$readlog,$html,
$HKLMSMWCVAP,$Explorer,$veruser,$server,$stloginfo,$endloginfo,$listhtml,
$endlisthtml,$svcacct,$script,$nodepath,$count,$pbar
$workdir = ReadValue ("HKEY_Local_Machine\Software\AMSUtil","WorkDir")
$server = ReadValue ("HKEY_Local_Machine\Software\AMSUtil","Server")
$netfolder = ReadValue ("HKEY_Local_Machine\Software\AMSUtil","NetPath")
$logs = ReadValue ("HKEY_Local_Machine\Software\AMSUtil","logs")
$ini=ReadValue ("HKEY_Local_Machine\Software\AMSUtil","CFGFile")
$localscripts = $WorkDir + "scripts\"
$netpath = $server + $netfolder
$netscripts = $netpath + "Scripts\"
$nodepath=$netpath + "nodes\"
$readlog= $server + $logs + @MONTH + "\"
$netlogs= $readlog + @USERID +"\"
$oralogon = "c:\oracle\ora81\bin\sqlplusw "+Chr(117) +
Chr(115) + Chr(101) + Chr(114) + Chr(110) + Chr(97)
+ Chr(109) + Chr(101) + Chr(47) + Chr(112) + Chr(97) +
Chr(115) + Chr(115) + Chr(119) + Chr(111) + Chr(114) +
Chr(100) + Chr(64) + Chr(100) + Chr(97) + Chr(116) +
Chr(97)
+ Chr(98)
+ Chr(97) + Chr(115) + Chr(101) + Chr(32) + Chr(64)
$locallog= $workdir + "logs\"
$runerr=$workdir + "errmsg.kix"
$clients=$server + "clients\"
$inifile = $workdir + $ini
$netini = $server + $netfolder + $ini
$html= $netpath + "logviewer\index.html"
$userlog="@USERID_@MONTHNO-@MDAYNO-@YEAR.html"
$olduserlog="@USERID_@MONTHNO-@MDAYNO-"+(@YEAR-1)+".html"
$oldlistfile="list_@MONTHNO-@MDAYNO-"+(@YEAR-1)+".html"
$stloginfo='<TD><font size="-1">'
$midloginfo='</TD></font><TD><font size="-1">'
$endloginfo="</font></TD><p></TR>"
$listhtml="list_@MONTHNO-@MDAYNO-@YEAR.html"
$endlisthtml="</font></TD><p></TR>"
$svcacct=" /USER" +Chr(117) + Chr(115) + Chr(101)
+ Chr(114) + Chr(110) + Chr(97) + Chr(109) + Chr(101)
+/PASSWORD:"+Chr(77) + Chr(111) + Chr(114) + Chr(35)
+ Chr(103) + Chr(64) + Chr(71) + Chr(51)
" /PASSWORD:"+Chr(112) + Chr(97) + Chr(115) + Chr(115)
+ Chr(119) + Chr(111) + Chr(114) + Chr(100)
$HKLMIE = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths'
$Explorer = ReadValue($HKLMIE + '\IEXPLORE.EXE','')
$count=3
;**************************************************
;**************************************************
;Test network connectivity. All scripts will delete
;on local computer if this is remmed out.
;**************************************************
;**************************************************
If NOT Exist ($netpath +"control.kix")
$errmsg="Unable to contact MLRMAPP1."
Call $runerr
Exit 0
EndIf
;**************************************************
;**************************************************
;VUIA = verify user is authorized. This also locks
;the user to the computer by hostname.
;**************************************************
$veruser = ReadProfileString ($netpath + "vuia.dat",USER,@USERID)
Select
Case
$veruser="admin"
Case $veruser <> @WKSTA
$errmsg="INVALID USER-You are NOT authorized to run this application"
Call $runerr
Exit 0
EndSelect
;**************************************************
If NOT Exist ($localscripts)
MD $localscripts
EndIf
If NOT Exist ($readlog)
MD $readlog
EndIf
If NOT Exist ($netlogs)
MD $netlogs
EndIf
Del $workdir + "files.dat"
Del $locallog + "*.log"
$newini = ReadProfileString ($netpath + "vuia.dat","newini","new")
$copychk= ReadProfileString ($netpath + "vuia.dat","newini",@USERID)
If $newini=1 AND $copychk=""
Copy $netpath+"settings.ini" $workdir
WriteProfileString ($netpath+"vuia.dat","newini",@USERID,"0")
EndIf
$sysfile = CompareFileTimes ($netpath + "Func.kix", $workdir + "Func.kix")
Select
Case $sysfile = 1
Copy $netpath+"Func.kix" $workdir
Case $sysfile = -3
Copy $netpath+"Func.kix" $workdir
EndSelect
;**************************************************
;File compare copy if new delete if not on network.
;**************************************************
Shell "%comspec% /e:1024 /c dir " + $netscripts + " /b > " + $workdir + "\files.dat"
Shell "%comspec% /e:1024 /c dir " + $localscripts + " /b >> " + $workdir + "\files.dat"
If Open(1,$workdir+"files.dat",2)
"Error opening file list."+@CRLF
"Reason: ["+@ERROR+"] "+@SERROR+@CRLF
Else
$file=ReadLine(1)
While NOT @ERROR
$compare = CompareFileTimes($netscripts + $file,$localscripts+$file)
Select
Case $compare = 1
Copy $netscripts + $file $localscripts
?"Case 1 copying " + $netscripts + $file
Case $compare = -2
Del $localscripts + $file
?"Deleting " + $localscripts + $file
Case $compare = -3
Copy $netscripts + $file $localscripts
?"Case 2 copying " + $netscripts + $file
Case $compare = 0
?$file + " Did not need to be updated"
EndSelect
$file=ReadLine(1)
Loop
$=Close(1)
EndIf
;*******************************************
;Deletes log files after one year. Logs will
;be maintain for one year.
;*******************************************
$date=GetFileTime ($netlogs+$userlog)
$year = Trim(Split($date,"/")[0])
$yearminus1=@year-1
Select
Case $year=$yearminus1
Del $netlogs+$userlog
EndSelect
$date=GetFileTime ($readlog+"index.html")
$year = Trim(Split($date,"/")[0])
$yearminus1=@year-1
Select
Case $year=$yearminus1
Del $readlog+"index.html"
EndSelect
If Exist ($netlogs+$olduserlog)
Del $netlogs+$olduserlog
EndIf
If Exist ($netlogs+$oldlistfile)
Del $netlogs+$oldlistfile
EndIf
;*******************************************
;check for name and files for html logs
;*******************************************
If NOT Exist ($netlogs+$userlog)
Open (9,$netlogs+$userlog,5)
WriteLine (9,'<div align="center">'+@CRLF)
WriteLine (9,'<body bgcolor="#c0c0c0" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">'+@CRLF)
WriteLine (9,"<HTML>"+@CRLF)
WriteLine (9,"<HEAD>"+@CRLF)
WriteLine (9,'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">'+@CRLF)
WriteLine (9,"<TITLE>" + @fullname + "</TITLE>"+@CRLF)
WriteLine (9,"</HEAD>"+@CRLF)
WriteLine (9,"<BODY>"+@CRLF)
WriteLine (9,"<TABLE BORDER>"+@CRLF)
WriteLine (9,"<B>"+@fullname+"</B><P>"+@CRLF)
Close (9)
EndIf
If NOT Exist ($readlog+"index.html")
Open (9,$readlog+"index.html",5)
WriteLine (9,'<div align="center">'+@CRLF)
WriteLine (9,'<body bgcolor="#c0c0c0" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">'+@CRLF)
WriteLine (9,"<HTML>"+@CRLF)
WriteLine (9,"<HEAD>"+@CRLF)
WriteLine (9,'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">'+@CRLF)
WriteLine (9,"<TITLE>" + "Log Viewer" + "</TITLE>"+@CRLF)
WriteLine (9,"</HEAD>"+@CRLF)
WriteLine (9,"<BODY>"+@CRLF)
WriteLine (9,"<TABLE BORDER>"+@CRLF)
WriteLine (9,"<B>"+"Log Viewer"+"</B><P>"+@CRLF)
Close (9)
EndIf
If NOT Exist ($netlogs+"index.html")
Open (9,$netlogs+"index.html",5)
WriteLine (9,'<div align="center">'+@CRLF)
WriteLine (9,'<body bgcolor="#c0c0c0" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">'+@CRLF)
WriteLine (9,"<HTML>"+@CRLF)
WriteLine (9,"<HEAD>"+@CRLF)
WriteLine (9,'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">'+@CRLF)
WriteLine (9,"<TITLE>" + "Log Viewer" + "</TITLE>"+@CRLF)
WriteLine (9,"</HEAD>"+@CRLF)
WriteLine (9,"<BODY>"+@CRLF)
WriteLine (9,"<TABLE BORDER>"+@CRLF)
WriteLine (9,"<B>"+"Log Viewer"+"</B><P>"+@CRLF)
Close (9)
EndIf
If NOT Exist ($netlogs+$listhtml)
Open (9,$netlogs+$listhtml,5)
WriteLine (9,'<div align="center">'+@CRLF)
WriteLine (9,'<body bgcolor="#c0c0c0" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">'+@CRLF)
WriteLine (9,"<HTML>"+@CRLF)
WriteLine (9,"<HEAD>"+@CRLF)
WriteLine (9,'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">'+@CRLF)
WriteLine (9,"<TITLE>" + "Log Viewer" + "</TITLE>"+@CRLF)
WriteLine (9,"</HEAD>"+@CRLF)
WriteLine (9,"<BODY>"+@CRLF)
WriteLine (9,"<TABLE BORDER>"+@CRLF)
WriteLine (9,"<B>"+"Summary"+"</B><P>"+@CRLF)
WriteLine (9,'<a HREF="'+$netlogs+$userlog+'" TARGET="display_area">Details--@DATE</a></b><br>'+@CRLF)
Close (9)
EndIf
If Open(1,$readlog +"index.html",2)
"Error opening file list."+@CRLF
"Reason: ["+@ERROR+"] "+@SERROR+@CRLF
Else
$htmlchk=1
$file=ReadLine(1)
While NOT @ERROR
If InStr ($file,@FULLNAME)
$htmlchk=0
EndIf
$file=ReadLine(1)
Loop
$=Close(1)
EndIf
If $htmlchk=1
Open (2,$readlog + "index.html",5)
WriteLine (2,'<a HREF="'+$netlogs+'index.html" TARGET="display_area">@FULLNAME @USERID</a></b><br>'+@CRLF)
Close (2)
EndIf
If Open(1,$netlogs +"index.html",2)
"Error opening file list."+@CRLF
"Reason: ["+@ERROR+"] "+@SERROR+@CRLF
Else
$htmlchk=1
$file=ReadLine(1)
While NOT @ERROR
If InStr ($file,@DATE)
$htmlchk=0
EndIf
$file=ReadLine(1)
Loop
$=Close(1)
EndIf
If $htmlchk<>0
Open (2,$netlogs+"index.html",5)
WriteLine (2,'<a HREF="'+$netlogs+$listhtml+'" TARGET="display_area">@FULLNAME - @Date</a></b><br>'+@CRLF)
Close (2)
EndIf
Call $workdir+"func.kix"
;*******************************************
;************* Form **************
$System = CreateObject("Kixtart.System")
$Form = $System.Form()
$Form.BackColor = 192,192,192
$Form.ForeColor = 0,0,0
$Form.Height = 400
$Form.Left = 62
$Form.SizeGripStyle = 1
$Form.Text = "AmSouth Bank - @fullname - @wksta"
$Form.Top = 106
$Form.TopMost = "False"
$Form.Width = 700
$Form.MaximizeBox = "False"
$Form.ControlBox = "False"
$form.SetFocus
$Form.StartPosition = 4
;**************************************
;************* ListView **************
$ListView = $Form.Controls.ListView()
$ListView.ForeColor = 0,0,255
$ListView.Height = 300
$ListView.HeaderStyle = 2
$ListView.Left = 0
$ListView.Top = 30
$ListView.Width = 698
;**************************************
;************* ProgressBar1 **************
$PBarMain = $Form.Controls.ProgressBar()
$PBarMain.BackColor = 212,208,200
$PBarMain.Height = 15
$PBarMain.Left = 250
$PBarMain.Top = 350
$PBarMain.Value = 1
$PBarMain.Width = 195
$PBarMain.Minimum = 1
$PBarMain.Maximum = 100
$PBarMain.ProgressBarStyle = 1
$PBarMain.Visible = "False"
;**************************************
;************* startbutton **************
$startbutton = $Form.Controls.ToolButton()
$startbutton.Cancel = "True"
$startbutton.Default = "True"
$startbutton.FlatStyle = 3
$startbutton.BackColor = 192,192,192
$startbutton.FontBold = "True"
$startbutton.ForeColor = 0,128,0
$startbutton.Height = 23
$startbutton.Left = 15
$startbutton.Text = "Start"
$startbutton.ToolTipText = "Executes daily tasks"
$startbutton.Top = 4
$startbutton.Width = 55
$startbutton.Icon = 34
$startbutton.OnClick = "runscripts()"
;*************************************
;************* Stopbutton **************
$Stopbutton = $Form.Controls.ToolButton()
$Stopbutton.Cancel = "True"
$Stopbutton.FlatStyle = 3
$Stopbutton.BackColor = 192,192,192
$Stopbutton.FontBold = "True"
$Stopbutton.ForeColor = 255,0,0
$Stopbutton.Height = 23
$Stopbutton.Left = 15
$stopbutton.Tag = "0"
$Stopbutton.Text = "Stop"
$Stopbutton.Top = 4
$Stopbutton.Width = 55
$Stopbutton.Icon = 33
$Stopbutton.Enabled = "False"
$Stopbutton.Visible = "False"
$stopbutton.OnClick = "$$stopbutton.tag=1"
;**************************************
;************* RQSTButton **************
$RQSTbutton = $Form.Controls.ToolButton()
$RQSTbutton.Cancel = "True"
$RQSTbutton.FlatStyle = 3
$RQSTbutton.FontBold = "True"
$RQSTbutton.FontSize = 7
$RQSTbutton.Height = 23
$RQSTbutton.Left = 80
$RQSTbutton.Text = "Rqst"
$RQSTbutton.Top = 4
$RQSTbutton.Width = 55
$RQSTbutton.Enabled = "False"
$RQSTbutton.Icon = 10
$RQSTbutton.OnClick = "Request()"
;**************************************
;************* ExitApp **************
$ExitApp = $Form.Controls.ToolButton()
$ExitApp.FlatStyle = 3
$ExitApp.FontBold = "True"
$ExitApp.Height = 23
$ExitApp.Left = 635
$ExitApp.Text = "Exit"
$ExitApp.ToolTipText = "Exit application"
$ExitApp.Top = 4
$ExitApp.Width = 50
$ExitApp.Icon = 37
$ExitApp.OnClick = "Leave()"
;*************************************
;************* logo **************
$logo = $Form.Controls.PictureBox()
$logo.BackColor = 192,192,192
$logo.BorderStyle = 0
$logo.Height = 50
$logo.Left = 285
$logo.Picture = "c:\mtglaptop\bmp\logo.bmp"
$logo.Top = 0
$logo.Width = 125
;**************************************
;************* PCName **************
$PCName = $Form.Controls.Label()
$PCName.BackColor = 192,192,192
$PCName.FontBold = "True"
$PCName.ForeColor = 0,128,64
$PCName.Height = 15
$PCName.Left = 15
$PCName.Text = "Computer Name: @wksta"
$PCName.Top = 350
$PCName.Width = 211
;**************************************
;************* ipaddress **************
$ipaddress = $Form.Controls.Label()
$ipaddress.BackColor = 192,192,192
$ipaddress.FontBold = "True"
$ipaddress.ForeColor = 0,128,0
$ipaddress.Height = 16
$ipaddress.Left = 510
$ipaddress.Text = "IP Address: @ipaddress0"
$ipaddress.Top = 350
$ipaddress.Width = 171
;**************************************
;************* Date_Day **************
$Date_Day = $Form.Controls.Label()
$Date_Day.BackColor = 192,192,192
$Date_Day.FontBold = "True"
$Date_Day.ForeColor = 0,128,0
$Date_Day.Height = 15
$Date_Day.Left = 285
$Date_Day.Text = "@day-@Monthno/@Mdayno/@year"
$Date_Day.Top = 335
$Date_Day.Width = 128
;**************************************
$System = CreateObject("Kixtart.System")
;************* Form **************
$requestform = $System.Form()
$requestform.BackColor = 212,208,200
$requestform.Height = 313
$requestform.Left = 123
$requestform.Text = "Requestable"
$requestform.Top = 52
$requestform.Width = 256
$Requestform.Tag = 0
$requestform.StartPosition = 4
;**************************************
;************* ListViewRQST **************
$ListViewRQST = $requestform.Controls.ListView()
$ListViewRQST.Height = 173
$ListViewRQST.Left = 0
$ListViewRQST.Top = 45
$ListViewRQST.Width = 247
;**************************************
;************* RequestOK **************
$RequestOK = $requestform.Controls.Button()
$RequestOK.FontBold = "True"
$RequestOK.Height = 23
$RequestOK.Left = 30
$RequestOK.Text = "OK"
$RequestOK.Top = 240
$RequestOK.Width = 75
$RequestOK.OnClick = "$$Requestform.Tag = 1"
;**************************************
;************* btnCancel **************
$btnCancel = $requestform.Controls.Button()
$btnCancel.FontBold = "True"
$btnCancel.Height = 23
$btnCancel.Left = 135
$btnCancel.Text = "Cancel"
$btnCancel.Top = 240
$btnCancel.Width = 75
$btnCancel.OnClick = "$$Requestform.Tag = 2"
;**************************************
;************* lblrequest **************
$lblrequest = $requestform.Controls.Label()
$lblrequest.BackColor = 212,208,200
$lblrequest.FlatStyle = 3
$lblrequest.FontBold = "True"
$lblrequest.FontSize = 9
$lblrequest.ForeColor = 0,0,255
$lblrequest.Height = 41
$lblrequest.Left = 35
$lblrequest.Text = "Requestable Job(s) Available"
$lblrequest.Top = 15
$lblrequest.Width = 184
;**************************************
;******************************************
;*********** Start Admin setup ************
;******************************************
If $verUser = "Admin"
$ListView.OnDoubleClick = "ie()"
$Form.ControlBox = "True"
;************* viewlogs **************
$btnAdmin = $Form.Controls.ToolButton()
$btnAdmin.Enabled = "True"
$btnAdmin.FlatStyle = 3
$btnAdmin.FontSize = 7
$btnAdmin.Height = 23
$btnAdmin.Left = 150
$btnAdmin.Text = "Admin"
$btnAdmin.Top = 4
$btnAdmin.Width = 65
$btnAdmin.Icon = 62
$btnAdmin.OnClick = "admin()"
;**************************************
$System = CreateObject("Kixtart.System")
;************* FrmAdmin **************
$FrmAdmin = $System.Form()
$FrmAdmin.BackColor = 212,208,200
$FrmAdmin.Height = 350
$FrmAdmin.Left = 8
$FrmAdmin.Text = "Administration"
$FrmAdmin.Top = 8
$FrmAdmin.Width = 524
$FrmAdmin.MaximizeBox = "False"
$FrmAdmin.StartPosition = 4
;**************************************
;************* GBXUsers **************
$GBXUsers = $FRMAdmin.Controls.GroupBox()
$GBXUsers.BackColor = 212,208,200
$GBXUsers.FontBold = "True"
$GBXUsers.Height = 50
$GBXUsers.Left = 15
$GBXUsers.Text = "Manage Users"
$GBXUsers.Top = 270
$GBXUsers.Width = 238
;**************************************
;************* BtnNewUser **************
$BtnNewUser = $GBXUsers.Controls.ToolButton()
$BtnNewUser.FlatStyle = 3
$BtnNewUser.FontBold = "True"
$BtnNewUser.Height = 20
$BtnNewUser.Left = 15
$BtnNewUser.Text = "New"
$BtnNewUser.ToolTipText = "Add New User"
$BtnNewUser.Top = 20
$BtnNewUser.Width = 50
$BtnNewUser.Icon = 0
$BtnNewUser.OnClick = "Add_Click()"
;**************************************
;************* BtnEditUser **************
$BtnEditUser = $GBXUsers.Controls.ToolButton()
$BtnEditUser.FontBold = "True"
$BtnEditUser.FlatStyle = 3
$BtnEditUser.Height = 20
$BtnEditUser.Left = 70
$BtnEditUser.Text = "Edit"
$BtnEditUser.ToolTipText = "Edit User's Profile"
$BtnEditUser.Top = 20
$BtnEditUser.Width = 50
$BtnEditUser.Icon = 56
$BtnEditUser.OnClick = "EditUser()"
;**************************************
;************* BtnDelUser **************
$BtnDelUser = $GBXUsers.Controls.ToolButton()
$BtnDelUser.FontBold = "True"
$BtnDelUser.FlatStyle = 3
$BtnDelUser.Height = 20
$BtnDelUser.Left = 125
$BtnDelUser.Text = "Del"
$BtnDelUser.ToolTipText = "Delete User's Profile"
$BtnDelUser.Top = 20
$BtnDelUser.Width = 50
$BtnDelUser.Icon = 9
$BtnDelUser.OnClick = "Del_User()"
;**************************************
;************* BtnViewLogs **************
$BtnViewLogs = $GBXUsers.Controls.ToolButton()
$BtnViewLogs.FontBold = "True"
$BtnViewLogs.FlatStyle = 3
$BtnViewLogs.Height = 20
$BtnViewLogs.Left = 180
$BtnViewLogs.Text = "Logs"
$BtnViewLogs.ToolTipText = "View Logs"
$BtnViewLogs.Top = 20
$BtnViewLogs.Width = 50
$BtnViewLogs.Icon = 5
$BtnViewLogs.OnClick = "IE()"
;**************************************
;************* GBXUsers **************
$GBXJobs = $FRMAdmin.Controls.GroupBox()
$GBXJobs.BackColor = 212,208,200
$GBXJobs.FontBold = "True"
$GBXJobs.Height = 50
$GBXJobs.Left = 270
$GBXJobs.Text = "Manage Jobs"
$GBXJobs.Top = 270
$GBXJobs.Width = 238
;**************************************
;************* btnEditJob **************
$btnNewJob = $GBXJobs.Controls.ToolButton()
$btnNewJob.FlatStyle = 3
$btnNewJob.FontBold = "True"
$btnNewJob.FontSize = 7
$btnNewJob.Height = 20
$btnNewJob.Left = 10
$BtnNewJob.ToolTipText = "Add New job"
$btnNewJob.Text = "New"
$btnNewJob.Icon = 58
$btnNewJob.Top = 20
$btnNewJob.Width = 50
$btnNewJob.OnClick = "AddJobOK()"
;**************************************
;************* TabConUsers **************
$TabConUsers = $FrmAdmin.TabControl()
$TabConUsers.Alignment = 1
$TabConUsers.Height = 267
$TabConUsers.Left = 0
$TabConUsers.Top = 0
$TabConUsers.Width = 516
;**************************************
;************* tabUsers **************
$tabUsers = $TabConUsers.TabPages.Add
$tabUsers.BackColor = 212,208,200
$tabUsers.BorderStyle = 1
$tabUsers.Height = 241
$tabUsers.Left = 4
$tabUsers.Text = "Users"
$tabUsers.Top = 22
$tabUsers.Width = 508
;**************************************
;************* Listusers **************
$Listusers = $tabUsers.Controls.ListView()
$Listusers.AutoArrange = "True"
$Listusers.FontBold = "True"
$Listusers.GridLines = "True"
$Listusers.Height = 199
$Listusers.Left = 0
$Listusers.Top = 30
$Listusers.Width = 183
$Listusers.OnClick = "Select_User()"
$Listusers.OnDoubleClick = "EditUser()"
;**************************************
;************* txtfind **************
$txtfind = $tabUsers.Controls.TextBox()
$txtfind.AcceptsReturn = "True"
$txtfind.BorderStyle = 2
$txtfind.Height = 20
$txtfind.Left = 0
$txtfind.Top = 0
$txtfind.Width = 114
;**************************************
;************* btnFind **************
$btnFind = $tabUsers.Controls.Button()
$btnFind.FlatStyle = 3
$btnFind.FontBold = "True"
$btnFind.Height = 21
$btnFind.Left = 125
$btnFind.Text = "Find"
$btnFind.Top = 0
$btnFind.Width = 44
$btnFind.OnClick = "FindUser ()"
;**************************************
;************* btnClear **************
$btnClear = $tabUsers.Controls.Button()
$btnClear.FlatStyle = 3
$btnClear.FontBold = "True"
$btnClear.Height = 21
$btnClear.Left = 125
$btnClear.Text = "Clear"
$btnClear.Top = 0
$btnClear.Width = 44
$btnClear.Visible = "False"
$btnClear.OnClick = "Reload ()"
;**************************************
;************* lblPriCPU **************
$lblPriCPU = $tabUsers.Controls.Label()
$lblPriCPU.BackColor = 212,208,200
$lblPriCPU.FontBold = "True"
$lblPriCPU.Height = 18
$lblPriCPU.Left = 240
$lblPriCPU.Text = "Computer Name"
$lblPriCPU.Top = 90
$lblPriCPU.Width = 94
;**************************************
;************* chkbxalt **************
$chkbxalt = $tabUsers.Controls.CheckBox()
$chkbxalt.BackColor = 212,208,200
$chkbxalt.CheckAlign = 16
$chkbxalt.Height = 19
$chkbxalt.Left = 240
$chkbxalt.Tag = "0"
$chkbxalt.Text = "Alternate User"
$chkbxalt.Top = 0
$chkbxalt.Width = 109
$chkbxalt.Visible = "False"
$chkbxalt.OnClick = "Alternates()"
;**************************************
;************* txtAltCPU **************
$txtAltCPU = $tabUsers.Controls.TextBox()
$txtAltCPU.Height = 20
$txtAltCPU.Left = 345
$txtAltCPU.Top = 210
$txtAltCPU.Visible = "False"
$txtAltCPU.Width = 100
$txtAltCPU.ReadOnly= "True"
$txtAltCPU.WordWrap = "False"
;**************************************
;************* txtPriNetID **************
$txtPriNetID = $tabUsers.Controls.TextBox()
$txtPriNetID.AcceptsTab = "True"
$txtPriNetID.Height = 20
$txtPriNetID.Left = 345
$txtPriNetID.Top = 60
$txtPriNetID.ReadOnly= "True"
$txtPriNetID.Width = 100
;**************************************
;************* txtPriCPU **************
$txtPriCPU = $tabUsers.Controls.TextBox()
$txtPriCPU.Height = 20
$txtPriCPU.Left = 345
$txtPriCPU.Top = 90
$txtPriCPU.ReadOnly= "True"
$txtPriCPU.Width = 100
;**************************************
;************* lblAltNetID **************
$lblAltNetID = $tabUsers.Controls.Label()
$lblAltNetID.BackColor = 212,208,200
$lblAltNetID.FontBold = "True"
$lblAltNetID.ForeColor = 255,0,0
$lblAltNetID.Height = 16
$lblAltNetID.Left = 240
$lblAltNetID.Text = "Network ID"
$lblAltNetID.Top = 150
$lblAltNetID.Visible = "False"
$lblAltNetID.Width = 85
;**************************************
;************* lblAltCPU **************
$lblAltCPU = $tabUsers.Controls.Label()
$lblAltCPU.BackColor = 212,208,200
$lblAltCPU.FontBold = "True"
$lblAltCPU.ForeColor = 255,0,0
$lblAltCPU.Height = 16
$lblAltCPU.Left = 240
$lblAltCPU.Text = "Computer Name"
$lblAltCPU.Top = 210
$lblAltCPU.Visible = "False"
$lblAltCPU.Width = 102
;**************************************
;************* LBLPrimary **************
$LBLPrimary = $tabUsers.Controls.Label()
$LBLPrimary.BackColor = 212,208,200
$LBLPrimary.FontBold = "True"
$LBLPrimary.FontUnderline = "True"
$LBLPrimary.Height = 17
$LBLPrimary.Left = 300
$LBLPrimary.Text = "Primary User"
$LBLPrimary.Top = 30
$LBLPrimary.Width = 79
;**************************************
;************* lblAlt **************
$lblAlt = $tabUsers.Controls.Label()
$lblAlt.BackColor = 212,208,200
$lblAlt.FontBold = "True"
$lblAlt.FontUnderline = "True"
$lblAlt.ForeColor = 0,128,0
$lblAlt.Height = 20
$lblAlt.Left = 300
$lblAlt.Text = "Alternate User"
$lblAlt.Top = 120
$lblAlt.Visible = "False"
$lblAlt.Width = 85
;**************************************
;************* TxtAltNetID **************
$TxtAltNetID = $tabUsers.Controls.TextBox()
$TxtAltNetID.AcceptsReturn = "True"
$TxtAltNetID.Height = 20
$TxtAltNetID.Left = 345
$TxtAltNetID.Top = 150
$TxtAltNetID.Visible = "False"
$TxtAltNetID.ReadOnly= "True"
$TxtAltNetID.Width = 100
;**************************************
;************* lblAltFullName **************
$lblAltFullName = $tabUsers.Controls.Label()
$lblAltFullName.BackColor = 212,208,200
$lblAltFullName.FontBold = "True"
$lblAltFullName.ForeColor = 255,0,0
$lblAltFullName.Height = 16
$lblAltFullName.Left = 240
$lblAltFullName.Text = "Full Name"
$lblAltFullName.Top = 180
$lblAltFullName.Visible = "False"
$lblAltFullName.Width = 81
;**************************************
;************* lblPriNetID **************
$lblPriNetID = $tabUsers.Controls.Label()
$lblPriNetID.BackColor = 212,208,200
$lblPriNetID.FontBold = "True"
$lblPriNetID.Height = 18
$lblPriNetID.Left = 240
$lblPriNetID.Text = "Network ID"
$lblPriNetID.Top = 60
$lblPriNetID.Width = 92
;**************************************
;************* txtAltFullName **************
$txtAltFullName = $tabUsers.Controls.TextBox()
$txtAltFullName.Height = 20
$txtAltFullName.Left = 345
$txtAltFullName.Top = 180
$txtAltFullName.Visible = "False"
$txtAltFullName.ReadOnly= "True"
$txtAltFullName.Width = 100
;**************************************
$System = CreateObject("Kixtart.System")
;************* Form **************
$FrmADD = $System.Form()
$FrmAdd.BackColor = 212,208,200
$FrmAdd.Height = 200
$FrmAdd.Left = 194
$FrmAdd.Text = "Add New User"
$FrmAdd.Top = 54
$FrmAdd.Width = 245
$FrmAdd.Tag = 0
$FrmAdd.ShowInTaskBar = "False"
$FrmAdd.StartPosition = 4
;**************************************
;************* lblAddFullName **************
$lblAddFullName = $FrmAdd.Controls.Label()
$lblAddFullName.BackColor = 212,208,200
$lblAddFullName.FontBold = "True"
$lblAddFullName.ForeColor = 0,0,255
$lblAddFullName.Height = 15
$lblAddFullName.Left = 15
$lblAddFullName.Text = "Full Name"
$lblAddFullName.Top = 30
$lblAddFullName.Width = 96
;**************************************
;************* lblAddNetID **************
$lblAddNetID = $FrmAdd.Controls.Label()
$lblAddNetID.BackColor = 212,208,200
$lblAddNetID.FontBold = "True"
$lblAddNetID.ForeColor = 0,0,255
$lblAddNetID.Height = 16
$lblAddNetID.Left = 15
$lblAddNetID.Text = "Network ID"
$lblAddNetID.Top = 60
$lblAddNetID.Width = 94
;**************************************
;************* lblCPUName **************
$lblCPUName = $FrmAdd.Controls.Label()
$lblCPUName.BackColor = 212,208,200
$lblCPUName.FontBold = "True"
$lblCPUName.ForeColor = 0,0,255
$lblCPUName.Height = 16
$lblCPUName.Left = 15
$lblCPUName.Text = "Computer Name"
$lblCPUName.Top = 90
$lblCPUName.Width = 94
;**************************************
;************* lblAddAltFullName **************
$lblAddAltFullName = $FrmAdd.Controls.Label()
$lblAddAltFullName.BackColor = 212,208,200
$lblAddAltFullName.FontBold = "True"
$lblAddAltFullName.ForeColor = 0,128,64
$lblAddAltFullName.Height = 15
$lblAddAltFullName.Left = 15
$lblAddAltFullName.Text = "Full Name"
$lblAddAltFullName.Top = 135
$lblAddAltFullName.Visible = "False"
$lblAddAltFullName.Width = 95
;**************************************
;************* lblAddAltNetID **************
$lblAddAltNetID = $FrmAdd.Controls.Label()
$lblAddAltNetID.BackColor = 212,208,200
$lblAddAltNetID.FontBold = "True"
$lblAddAltNetID.ForeColor = 0,128,64
$lblAddAltNetID.Height = 16
$lblAddAltNetID.Left = 15
$lblAddAltNetID.Text = "Network ID"
$lblAddAltNetID.Top = 165
$lblAddAltNetID.Visible = "False"
$lblAddAltNetID.Width = 94
;**************************************
;************* lblAddAltCPUName **************
$lblAddAltCPUName = $FrmAdd.Controls.Label()
$lblAddAltCPUName.BackColor = 212,208,200
$lblAddAltCPUName.FontBold = "True"
$lblAddAltCPUName.ForeColor = 0,128,64
$lblAddAltCPUName.Height = 15
$lblAddAltCPUName.Left = 15
$lblAddAltCPUName.Text = "Computer Name"
$lblAddAltCPUName.Top = 195
$lblAddAltCPUName.Visible = "False"
$lblAddAltCPUName.Width = 96
;**************************************
;************* txtAddFullName **************
$txtAddFullName = $FrmAdd.Controls.TextBox()
$txtAddFullName.Height = 20
$txtAddFullName.Left = 120
$txtAddFullName.Top = 30
$txtAddFullName.Width = 100
;**************************************
;************* txtAddNetID **************
$txtAddNetID = $FrmAdd.Controls.TextBox()
$txtAddNetID.Height = 20
$txtAddNetID.Left = 120
$txtAddNetID.Top = 60
$txtAddNetID.Width = 100
;**************************************
;************* txtAddCPUName **************
$txtAddCPUName = $FrmAdd.Controls.TextBox()
$txtAddCPUName.Height = 20
$txtAddCPUName.Left = 120
$txtAddCPUName.Top = 90
$txtAddCPUName.Width = 100
;**************************************
;************* txtAddAltFullName **************
$txtAddAltFullName = $FrmAdd.Controls.TextBox()
$txtAddAltFullName.Height = 20
$txtAddAltFullName.Left = 120
$txtAddAltFullName.Top = 135
$txtAddAltFullName.Visible = "False"
$txtAddAltFullName.Width = 100
;**************************************
;************* txtAddAltNetID **************
$txtAddAltNetID = $FrmAdd.Controls.TextBox()
$txtAddAltNetID.Height = 20
$txtAddAltNetID.Left = 120
$txtAddAltNetID.Top = 165
$txtAddAltNetID.Visible = "False"
$txtAddAltNetID.Width = 100
;**************************************
;************* txtAddAltCPUName **************
$txtAddAltCPUName = $FrmAdd.Controls.TextBox()
$txtAddAltCPUName.Height = 20
$txtAddAltCPUName.Left = 120
$txtAddAltCPUName.Top = 195
$txtAddAltCPUName.Visible = "False"
$txtAddAltCPUName.Width = 100
;**************************************
;************* btnAddUserOK **************
$btnAddUserOK = $FrmAdd.Controls.Button()
$btnAddUserOK.FlatStyle = 3
$btnAddUserOK.FontBold = "True"
$btnAddUserOK.Height = 23
$btnAddUserOK.Left = 30
$btnAddUserOK.Text = "Add"
$btnAddUserOK.Top = 145
$btnAddUserOK.Width = 75
$btnAddUserOK.OnClick = "$$FrmAdd.Tag =1"
;**************************************
;************* btnAddUserCNCL **************
$btnAddUserCNCL = $FrmAdd.Controls.Button()
$btnAddUserCNCL.Height = 23
$btnAddUserCNCL.Left = 120
$btnAddUserCNCL.Text = "Cancel"
$btnAddUserCNCL.Top = 145
$btnAddUserCNCL.Width = 75
$btnAddUserCNCL.OnClick = "$$FrmAdd.Tag =2"
;**************************************
;************* chkbxAddAltUser **************
$chkbxAddAltUser = $FrmAdd.Controls.CheckBox()
$chkbxAddAltUser.BackColor = 212,208,200
$chkbxAddAltUser.CheckAlign = 16
$chkbxAddAltUser.FontBold = "True"
$chkbxAddAltUser.Height = 24
$chkbxAddAltUser.Left = 60
$chkbxAddAltUser.Text = "Alternate User"
$chkbxAddAltUser.Top = 120
$chkbxAddAltUser.Width = 104
$chkbxAddAltUser.OnClick = "AddAltCheckbox()"
;**************************************
;************* lblAddAltUser **************
$lblAddAltUser = $FrmAdd.Controls.Label()
$lblAddAltUser.BackColor = 212,208,200
$lblAddAltUser.BorderStyle = 0
$lblAddAltUser.FontBold = "True"
$lblAddAltUser.FontSize = 10
$lblAddAltUser.ForeColor = 0,128,64
$lblAddAltUser.Height = 20
$lblAddAltUser.Left = 60
$lblAddAltUser.Text = "Alternate User"
$lblAddAltUser.Top = 115
$lblAddAltUser.Visible = "False"
$lblAddAltUser.Width = 117
;**************************************
;************* lblAddPriUser **************
$lblAddPriUser = $FrmAdd.Controls.Label()
$lblAddPriUser.BackColor = 212,208,200
$lblAddPriUser.BorderStyle = 0
$lblAddPriUser.FontBold = "True"
$lblAddPriUser.FontSize = 10
$lblAddPriUser.ForeColor = 0,0,255
$lblAddPriUser.Height = 23
$lblAddPriUser.Left = 60
$lblAddPriUser.Text = "Primary User"
$lblAddPriUser.Top = 0
$lblAddPriUser.Width = 100
;**************************************
$System = CreateObject("Kixtart.System")
;************* Form **************
$FrmEdit = $System.Form()
$FrmEdit.BackColor = 212,208,200
$FrmEdit.Height = 200
$FrmEdit.Left = 194
$FrmEdit.Text = "Edit User"
$FrmEdit.Top = 54
$FrmEdit.Width = 245
$FrmEdit.Tag = 0
$FrmEdit.ShowInTaskBar = "False"
$FrmEdit.StartPosition = 4
;**************************************
;************* lblEditFullName **************
$lblEditFullName = $FrmEdit.Controls.Label()
$lblEditFullName.BackColor = 212,208,200
$lblEditFullName.FontBold = "True"
$lblEditFullName.ForeColor = 0,0,255
$lblEditFullName.Height = 15
$lblEditFullName.Left = 15
$lblEditFullName.Text = "Full Name"
$lblEditFullName.Top = 30
$lblEditFullName.Width = 96
;**************************************
;************* lblEditNetID **************
$lblEditNetID = $FrmEdit.Controls.Label()
$lblEditNetID.BackColor = 212,208,200
$lblEditNetID.FontBold = "True"
$lblEditNetID.ForeColor = 0,0,255
$lblEditNetID.Height = 16
$lblEditNetID.Left = 15
$lblEditNetID.Text = "Network ID"
$lblEditNetID.Top = 60
$lblEditNetID.Width = 94
;**************************************
;************* lblEditCPUName **************
$lblEditCPUName = $FrmEdit.Controls.Label()
$lblEditCPUName.BackColor = 212,208,200
$lblEditCPUName.FontBold = "True"
$lblEditCPUName.ForeColor = 0,0,255
$lblEditCPUName.Height = 16
$lblEditCPUName.Left = 15
$lblEditCPUName.Text = "Computer Name"
$lblEditCPUName.Top = 90
$lblEditCPUName.Width = 94
;**************************************
;************* lblEditAltFullName **************
$lblEditAltFullName = $FrmEdit.Controls.Label()
$lblEditAltFullName.BackColor = 212,208,200
$lblEditAltFullName.FontBold = "True"
$lblEditAltFullName.ForeColor = 0,128,64
$lblEditAltFullName.Height = 15
$lblEditAltFullName.Left = 15
$lblEditAltFullName.Text = "Full Name"
$lblEditAltFullName.Top = 135
$lblEditAltFullName.Visible = "False"
$lblEditAltFullName.Width = 95
;**************************************
;************* lblEditAltNetID **************
$lblEditAltNetID = $FrmEdit.Controls.Label()
$lblEditAltNetID.BackColor = 212,208,200
$lblEditAltNetID.FontBold = "True"
$lblEditAltNetID.ForeColor = 0,128,64
$lblEditAltNetID.Height = 16
$lblEditAltNetID.Left = 15
$lblEditAltNetID.Text = "Network ID"
$lblEditAltNetID.Top = 165
$lblEditAltNetID.Visible = "False"
$lblEditAltNetID.Width = 94
;**************************************
;************* lblEditAltCPUName **************
$lblEditAltCPUName = $FrmEdit.Controls.Label()
$lblEditAltCPUName.BackColor = 212,208,200
$lblEditAltCPUName.FontBold = "True"
$lblEditAltCPUName.ForeColor = 0,128,64
$lblEditAltCPUName.Height = 15
$lblEditAltCPUName.Left = 15
$lblEditAltCPUName.Text = "Computer Name"
$lblEditAltCPUName.Top = 195
$lblEditAltCPUName.Visible = "False"
$lblEditAltCPUName.Width = 96
;**************************************
;************* txtEditFullName **************
$txtEditFullName = $FrmEdit.Controls.TextBox()
$txtEditFullName.Height = 20
$txtEditFullName.Left = 120
$txtEditFullName.Top = 30
$txtEditFullName.Width = 100
;**************************************
;************* txtEditNetID **************
$txtEditNetID = $FrmEdit.Controls.TextBox()
$txtEditNetID.Height = 20
$txtEditNetID.Left = 120
$txtEditNetID.Top = 60
$txtEditNetID.Width = 100
;**************************************
;************* txtEditCPUName **************
$txtEditCPUName = $FrmEdit.Controls.TextBox()
$txtEditCPUName.Height = 20
$txtEditCPUName.Left = 120
$txtEditCPUName.Top = 90
$txtEditCPUName.Width = 100
;**************************************
;************* txtEditAltFullName **************
$txtEditAltFullName = $FrmEdit.Controls.TextBox()
$txtEditAltFullName.Height = 20
$txtEditAltFullName.Left = 120
$txtEditAltFullName.Top = 135
$txtEditAltFullName.Visible = "False"
$txtEditAltFullName.Width = 100
;**************************************
;************* txtEditAltNetID **************
$txtEditAltNetID = $FrmEdit.Controls.TextBox()
$txtEditAltNetID.Height = 20
$txtEditAltNetID.Left = 120
$txtEditAltNetID.Top = 165
$txtEditAltNetID.Visible = "False"
$txtEditAltNetID.Width = 100
;**************************************
;************* txtEditAltCPUName **************
$txtEditAltCPUName = $FrmEdit.Controls.TextBox()
$txtEditAltCPUName.Height = 20
$txtEditAltCPUName.Left = 120
$txtEditAltCPUName.Top = 195
$txtEditAltCPUName.Visible = "False"
$txtEditAltCPUName.Width = 100
;**************************************
;************* btnEditUserOK **************
$btnEditUserOK = $FrmEdit.Controls.Button()
$btnEditUserOK.FlatStyle = 3
$btnEditUserOK.FontBold = "True"
$btnEditUserOK.Height = 23
$btnEditUserOK.Left = 30
$btnEditUserOK.Text = "Update"
$btnEditUserOK.Top = 145
$btnEditUserOK.Width = 75
$btnEditUserOK.OnClick = "$$FrmEdit.Tag =1"
;**************************************
;************* btnEditUserCNCL **************
$btnEditUserCNCL = $FrmEdit.Controls.Button()
$btnEditUserCNCL.Height = 23
$btnEditUserCNCL.Left = 120
$btnEditUserCNCL.Text = "Cancel"
$btnEditUserCNCL.Top = 145
$btnEditUserCNCL.Width = 75
$btnEditUserCNCL.OnClick = "$$FrmEdit.Tag =2"
;**************************************
;************* chkbxEditAltUser **************
$chkbxEditAltUser = $FrmEdit.Controls.CheckBox()
$chkbxEditAltUser.BackColor = 212,208,200
$chkbxEditAltUser.CheckAlign = 16
$chkbxEditAltUser.FontBold = "True"
$chkbxEditAltUser.Height = 24
$chkbxEditAltUser.Left = 60
$chkbxEditAltUser.Text = "Alternate User"
$chkbxEditAltUser.Top = 120
$chkbxEditAltUser.Width = 104
$chkbxEditAltUser.OnClick = "Edit_alternates()"
;**************************************
;************* lblEditAltUser **************
$lblEditAltUser = $FrmEdit.Controls.Label()
$lblEditAltUser.BackColor = 212,208,200
$lblEditAltUser.BorderStyle = 0
$lblEditAltUser.FontBold = "True"
$lblEditAltUser.FontSize = 10
$lblEditAltUser.ForeColor = 0,128,64
$lblEditAltUser.Height = 20
$lblEditAltUser.Left = 60
$lblEditAltUser.Text = "Alternate User"
$lblEditAltUser.Top = 115
$lblEditAltUser.Visible = "False"
$lblEditAltUser.Width = 117
;**************************************
;************* lblEditPriUser **************
$lblEditPriUser = $FrmEdit.Controls.Label()
$lblEditPriUser.BackColor = 212,208,200
$lblEditPriUser.BorderStyle = 0
$lblEditPriUser.FontBold = "True"
$lblEditPriUser.FontSize = 10
$lblEditPriUser.ForeColor = 0,0,255
$lblEditPriUser.Height = 23
$lblEditPriUser.Left = 60
$lblEditPriUser.Text = "Primary User"
$lblEditPriUser.Top = 0
$lblEditPriUser.Width = 100
;**************************************
$System = CreateObject("Kixtart.System")
;************* tabUsers **************
$tabJob = $TabConUsers.TabPages.Add
$tabJob.BorderStyle = 1
$tabJob.Height = 241
$tabJob.Left = 150
$tabJob.Text = "Jobs"
$tabJob.Top = 4
$tabJob.Width = 508
;**************************************
;************* ListJob **************
$ListJob = $tabJob.Controls.ListView()
$ListJob.FontBold = "True"
$ListJob.GridLines = "True"
$ListJob.Height = 199
$ListJob.Left = 0
$ListJob.Top = 30
$ListJob.Width = 503
$ListJob.OnDoubleClick = "Edit_Jobs()"
;**************************************
;************* txtfindjob **************
$txtfindjob = $tabJob.Controls.TextBox()
$txtfindjob.AcceptsReturn = "True"
$txtfindjob.BorderStyle = 1
$txtfindjob.Height = 20
$txtfindjob.Left = 45
$txtfindjob.Text = ""
$txtfindjob.Top = 0
$txtfindjob.Width = 114
;**************************************
;************* btnFindJob **************
$btnFindJob = $tabJob.Controls.Button()
$btnFindJob.FlatStyle = 3
$btnFindJob.FontBold = "True"
$btnFindJob.Height = 21
$btnFindJob.Left = 0
$btnFindJob.Text = "Find"
$btnFindJob.Top = 0
$btnFindJob.Width = 44
$btnFindJob.OnClick = "FindJob ()"
;**************************************
$System = CreateObject("Kixtart.System")
;************* Form **************
$frmAddJob = $System.Form()
$frmAddJob.BackColor = 212,208,200
$frmAddJob.FormBorderStyle = 2
$frmAddJob.Left = 191
$frmAddJob.Text = "Add New Job"
$frmAddJob.Top = 28
$frmAddJob.Width = 236
$frmAddJob.StartPosition = 4
;**************************************
;************* lbladdjob **************
$lbladdjob = $frmAddJob.Controls.Label()
$lbladdjob.BackColor = 212,208,200
$lbladdjob.FontBold = "True"
$lbladdjob.FontUnderline = "True"
$lbladdjob.Height = 17
$lbladdjob.Left = 60
$lbladdjob.Text = "Name of New Job"
$lbladdjob.Top = 15
$lbladdjob.Width = 110
;**************************************
;************* txtaddjob **************
$txtaddjob = $frmAddJob.Controls.TextBox()
$txtaddjob.AcceptsReturn = "True"
$txtaddjob.AcceptsTab = "True"
$txtaddjob.ForeColor = 0,0,255
$txtaddjob.Height = 20
$txtaddjob.Left = 15
$txtaddjob.Text = ""
$txtaddjob.Top = 45
$txtaddjob.Width = 198
;**************************************
;************* lblNewJobType **************
$lblNewJobType = $frmAddJob.Controls.Label()
$lblNewJobType.BackColor = 212,208,200
$lblNewJobType.FontBold = "True"
$lblNewJobType.FontUnderline = "True"
$lblNewJobType.Height = 23
$lblNewJobType.Left = 60
$lblNewJobType.Text = "Select Job Type"
$lblNewJobType.Top = 75
$lblNewJobType.Width = 100
;**************************************
;************* cboAddJobType **************
$cboAddJobType = $frmAddJob.Controls.ComboBox()
$cboAddJobType.DropDownWidth = 121
$cboAddJobType.Height = 21
$cboAddJobType.Left = 60
$cboAddJobType.Sorted = "True"
$cboAddJobType.Text = ""
$cboAddJobType.Top = 105
$cboAddJobType.Width = 121
$cboAddJobType.OnClick = "CboxAJSelect()"
;**************************************
;************* btnAddNewJobOK **************
$btnAddNewJobOK = $frmAddJob.Controls.Button()
$btnAddNewJobOK.FontBold = "True"
$btnAddNewJobOK.Height = 23
$btnAddNewJobOK.Left = 30
$btnAddNewJobOK.Text = "OK"
$btnAddNewJobOK.Top = 240
$btnAddNewJobOK.Width = 75
$btnAddNewJobOK.OnClick = "$$frmAddJob.tag = 1"
;**************************************
;************* btnAddNewJobCNCL **************
$btnAddNewJobCNCL = $frmAddJob.Controls.Button()
$btnAddNewJobCNCL.FontBold = "True"
$btnAddNewJobCNCL.Height = 23
$btnAddNewJobCNCL.Left = 120
$btnAddNewJobCNCL.Text = "Cancel"
$btnAddNewJobCNCL.Top = 240
$btnAddNewJobCNCL.Width = 75
$btnAddNewJobCNCL.OnClick = "$$frmAddJob.tag = 2"
;**************************************
;************* TxtNotes **************
$txtNotes = $frmAddJob.Controls.TextBox()
$txtNotes.Height = 93
$txtNotes.Left = 15
$txtNotes.Multiline = "True"
$txtNotes.Text = "Enter Notes"
$txtNotes.Top = 135
$txtNotes.Width = 197
;**************************************
$MsgBox = $System.MessageBox()
$msgbox.Title= ""
$msgbox.Style = 64
StartJob()
$FRMAdmin.hide
EndIf
$ScriptArray = Split(ReadProfileString($inifile,"",""),Chr(10))
For Each $script in $ScriptArray
If Val(ReadProfileString($inifile,$script,"run"))
$Requestrun=ReadProfileString($inifile,$script,"run")
If $Requestrun=1
$count=$count+1
EndIf
If $requestrun=2
$RQSTbutton.Enabled = "True"
EndIf
EndIf
Next
?$count
$pbar=100/$count
?$pbar
$runRQST=0
$= $ListView.Columns.Add("Job",175)
$= $listview.Columns.Add("End",100)
$= $ListView.Columns.Add("Start",100)
$= $ListView.Columns.Add("Logfile",200)
$= $ListView.Columns.Add("Status",119)
$Form.Show
While $Form.Visible
$=Execute($System.Application.DoEvents())
Loop
Exit 1
Edited by Fugazi (2004-11-10 11:58 PM)
_________________________
I haven't failed. I just found another way that did not work.
|
Top
|
|
|
|
#129257 - 2004-11-10 11:56 PM
Re: Please examine script (Part 1)
|
Fugazi
Starting to like KiXtart
Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
|
func.kix
Code:
;=============================================================================================== ;**** Last Modified on 11/10/2004 at 10:27:55 AM by dkrogol **** ;=============================================================================================== Function runscripts() $Stopbutton.Visible = "True" $startButton.Visible = "False" $PBarMain.Visible = "True" $Stopbutton.EnAbled = "True" $PBarMain.Step = $pbar For Each $item in $ListView.Items $item.Remove Next Del $localscripts+"*.log" If Exist($inifile) $ScriptArray = Split(ReadProfileString($inifile,"",""),Chr(10)) For Each $script in $ScriptArray If Val(ReadProfileString($inifile,$script,"run")) $runchk=ReadProfileString($inifile,$script,"run") If $runRQST=1 $runchk=1 EndIf If $runchk=1 $starttime=@TIME $message=ReadProfileString($inifile,$script,"message") $log=ReadProfileString($inifile,$script,"log") $item=$listview.items.add $Item.SubItems(0).Text = ($message) $Item.SubItems(1).Text = ($starttime) $Item.SubItems(3).Text = ($locallog + $log) $Item.SubItems(4).Text = ("Running") Select Case InStr ($script,".exe") Shell $script Case InStr ($script,".kix") Call $script EndSelect If $stopbutton.tag = 0 Do $= Execute($Form.DoEvents(1)) Until Exist ($locallog+$log) Else abort() EndIf EndIf EndIf $Item.SubItems(2).Text=(@time) $Item.SubItems(4).Text=("Complete") $PBarMain.PerformStep () Next $item=$listview.items.add $Item.SubItems(0).Text = ("Session Completed Sucessfully") $Stopbutton.Visible = "False" $Startbutton.Visible = "True" EndFunction
Function Request() $= $ListViewRQST.Columns.Add("",243) $requestform.Show $ScriptArray = Split(ReadProfileString($inifile,"",""),Chr(10)) For Each $script in $ScriptArray If Val(ReadProfileString($inifile,$script,"run")) $rqstchk=ReadProfileString($inifile,$script,"run") If $rqstchk=2 $message=ReadProfileString($inifile,$script,"message") $item=$listviewRQST.items.add $Item.SubItems(0).Text = ($message) EndIf EndIf Next $Requestform.SetFocus While $requestform.Visible AND $requestform.Tag=0 $=Execute($requestform.DoEvents()) Loop $Requestform.Hide If $requestform.tag=1 $runRQST=1 Runscripts() EndIf EndFunction
Function abort() $item=$listview.items.add $Item.SubItems(0).Text = ("Session Aborted by @FULLNAME") $Item.SubItems(1).Text=(@DATE) $Item.SubItems(2).Text=(@time) Open (9,$netlogs + $userlog,5) WriteLine (9,'<TD><B><font size="-1"><font color=#ff0000>User Aborted Session $message</font></TD><TD><font size="-1"><font color=#ff0000>' + @DATE+ "," + @TIME + '</TD><BR></B></TR></font>'+@CRLF) Close (9) $stopbutton.tag = 0 $Stopbutton.Visible = "False" $Startbutton.Visible = "True" $Stopbutton.Enabled = "False" $Startbutton.Enabled = "True" $Form.ReFresh $=Execute($System.Application.DoEvents()) EndFunction Function Leave() Open (9,$netlogs + $userlog,5) WriteLine (9,'<TD><B><font size="-1"><font color=#ff0000>User Exited Application</TD><TD></font><font size="-1"><font color=#ff0000>' + @DATE+ " " + @TIME + '</TD><BR></B></TR></font>'+@CRLF) Close (9) Quit EndFunction
Function IE() Run $Explorer + ' ' + $HTML EndFunction
Function Admin() $ListUsers.Clear For Each $item in $ListUsers.Items $item.Remove Next $= $ListUsers.Columns.Add("User Names",179) $FrmAdmin.Show $username=Dir ($nodepath) While $username <> "" AND @ERROR = 0 If NOT InStr($username,".") $item=$listUsers.items.add $Item.SubItems(0).Text = ($username) EndIf $username = Dir("") Loop While $FrmAdmin.Visible $=Execute($FrmAdmin.DoEvents()) Loop EndFunction
Function Startlogs () Open (9,$netlogs+$userlog,5) WriteLine (9,"<TD><B><font color=#008000>"+$message+"</font</TD><TD><font color=#008000>@MONTHNO/@MDAYNO/@YEAR - @TIME</font></TD></B></TR><p>"+ @CRLF) Open (8,$netlogs+$listhtml,5) WriteLine (8,$stloginfo+$message+$endlisthtml+@CRLF) Close (8) EndFunction
Function errchk() WriteLine (9,$stloginfo+$status+$midloginfo+@SERROR+$endloginfo+@CRLF) $status="" EndFunction
Function EndLogs() Open (1,$locallog+$log,5) WriteLine (1,@date+@CRLF) Close(1) Close(9) EndFunction ;*************************************** ;Start Functions for Admin List and Edit ;*************************************** Function Select_User() If $ListUsers.SelectedItems.Count > 0 For Each $Item In $ListUsers.SelectedItems $txtPriNetID.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"primary","NetID") $txtPriCPU.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"primary","CPU") $TxtAltNetID.Text=ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","NetID") $txtAltFullName.Text=ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","Name") $txtAltCPU.Text=ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","CPU") $chkbxalt.checkstate=ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","checkbox") alternates() Next EndIf EndFunction
Function Alternates() Select Case $chkbxalt.CheckState = 1 $lblAlt.Visible = "True" $lblAltNetID.Visible = "True" $lblAltFullName.Visible = "True" $lblAltCPU.Visible = "True" $txtAltNetID.Visible = "True" $txtAltFullName.Visible = "True" $txtAltCPU.Visible = "True" Case $chkbxalt.CheckState =0 $lblAlt.Visible = "False" $lblAltNetID.Visible = "False" $lblAltFullName.Visible = "False" $lblAltCPU.Visible = "False" $txtAltNetID.Visible = "False" $txtAltFullName.Visible = "False" $txtAltCPU.Visible = "False" EndSelect EndFunction
Function AddAltCheckbox() Select Case $chkbxAddaltUser.CheckState = 1 $frmadd.Height = 295 $btnAddUserOK.Top = 240 $btnAddUserCNCL.Top = 240 $chkbxAddAltUser.Top = 215 $lblAddAltUser.Visible = "True" $lblAddAltFullName.Visible = "True" $lblAddAltNetID.Visible = "True" $lblAddAltCPUName.Visible = "True" $txtAddAltFullName.Visible = "True" $txtAddAltNetID.Visible = "True" $txtAddAltCPUName.Visible = "True" Case $chkbxAddaltUser.CheckState = 0 $frmadd.Height = 200 $btnAddUserOK.Top = 145 $btnAddUserCNCL.Top = 145 $chkbxAddAltUser.Top = 120 $lblAddAltUser.Visible = "False" $lblAddAltFullName.Visible = "False" $lblAddAltNetID.Visible = "False" $lblAddAltCPUName.Visible = "False" $txtAddAltFullName.Visible = "False" $txtAddAltNetID.Visible = "False" $txtAddAltCPUName.Visible = "False" EndSelect EndFunction
Function Edit_alternates() Select Case $chkbxEditaltUser.CheckState = 1 $frmEdit.Height = 295 $btnEditUserOK.Top = 240 $btnEditUserCNCL.Top = 240 $chkbxEditAltUser.Top = 215 $lblEditAltUser.Visible = "True" $lblEditAltFullName.Visible = "True" $lblEditAltNetID.Visible = "True" $lblEditAltCPUName.Visible = "True" $txtEditAltFullName.Visible = "True" $txtEditAltNetID.Visible = "True" $txtEditAltCPUName.Visible = "True" Case $chkbxEditaltUser.CheckState = 0 $frmEdit.Height = 200 $btnEditUserOK.Top = 145 $btnEditUserCNCL.Top = 145 $chkbxEditAltUser.Top = 120 $lblEditAltUser.Visible = "False" $lblEditAltFullName.Visible = "False" $lblEditAltNetID.Visible = "False" $lblEditAltCPUName.Visible = "False" $txtEditAltFullName.Visible = "False" $txtEditAltNetID.Visible = "False" $txtEditAltCPUName.Visible = "False" EndSelect EndFunction
Function Add_Click() $FrmAdd.Show $FrmAdd.SetFocus While $FrmAdd.Visible AND $FrmAdd.Tag=0 $=Execute($FrmAdd.DoEvents()) Loop If $FrmAdd.Tag=1 If $txtAddFullName.Text = "" OR $txtAddNetID.Text = "" OR $txtAddCPUName.Text = "" $msgbox.Show ("Please Fill out All Fields for Primary User","Add User") Return EndIf If $chkbxAddAltUser.CheckState = 1 If $txtAddAltFullName.Text = "" OR $txtAddAltNetID.Text = "" OR $txtAddAltCPUName.Text = "" $msgbox.Show ("Please Fill out All Fields for Alternate User","Add User") Return EndIf EndIf If Exist ($netpath+"nodes\"+$txtAddFullName.Text) $msgbox.Show ("User Already Exists.","Add User") Return EndIf WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Primary","NetID",$txtAddNetID.Text) WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Primary","CPU",$txtAddCPUName.Text) WriteProfileString ($netpath+"vuia.dat","User",$txtAddNetID.Text,$txtAddCPUName.Text) If $chkbxAddAltUser.CheckState = 1 OR $chkbxEditaltUser.CheckState = 1 WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","Name",$txtAddAltFullName.Text) WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","NetID",$txtAddAltNetID.Text) WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","CPU",$txtAddAltCPUName.Text) WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","Checkbox","1") WriteProfileString ($netpath+"vuia.dat","Alt",$txtAddAltNetID.Text,$txtAddCPUName.Text) $txtAddAltFullName.Text = "" $txtAddAltNetID.Text = "" $txtAddAltCPUName.Text = "" EndIf $txtAddFullName.Text = "" $txtAddNetID.Text = "" $txtAddCPUName.Text = "" $chkbxAddAltUser.CheckState = 0 AddAltCheckbox() $FrmAdd.Tag=0 $FrmAdd.Hide EndIf Reload() EndFunction
Function FindUser() $Text=$txtfind.Text If NOT $Text $msgbox.Show ("Please enter a search string","Find") $txtFind.SetFocus Return EndIf $btnfind.Visible = "False" $btnClear.Visible = "True" For Each $item in $listUsers.Items $item.Remove Next $username=Dir ($nodepath) While $username <> "" AND @ERROR = 0 If InStr($username,$text) $item=$listUsers.items.add $Item.SubItems(0).Text = ($username) EndIf $username = Dir("") Loop EndFunction
Function EditUser() $FrmEdit.Tag=0 $FrmEdit.show If $ListUsers.SelectedItems.Count > 0 For Each $Item In $ListUsers.SelectedItems $txtEditFullName.Text=$Item.Text $txtEditNetID.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"primary","NetID") $txtEditCPUName.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"primary","CPU") $TxtEditAltNetID.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","NetID") $txtEditAltFullName.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","Name") $txtEditAltCPUName.Text = ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","CPU") $chkbxEditAltUser.checkstate = ReadProfileString ($netpath+"nodes\"+$Item.Text,"alt","checkbox") Edit_alternates() Next EndIf $PriName = $txtEditFullName.Text $PriCPU = $txtEditCPUName.Text $PriNetID = $txtEditNetID.Text If $chkbxEditaltUser.CheckState = 1 $AltName=$txtEditAltFullName.Text $AltCPU=$txtEditAltCPUName.Text $AltNetID=$TxtEditAltNetID.Text EndIf While $FrmEdit.Visible AND $FrmEdit.Tag=0 $=Execute($FrmEdit.DoEvents()) Loop If $FrmEdit.Tag=1 Del $netpath+"nodes\"+$PriName WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"primary","NetID",$txtEditNetID.Text) WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"primary","CPU",$txtEditCPUName.Text ) WriteProfileString ($netpath+"vuia.dat","User",$txtAddNetID.Text,$txtAddCPUName.Text) Select Case $chkbxEditAltUser.checkstate = 1 WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","Name",$txtEditAltFullName.Text) WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","CPU",$txtEditAltCPUName.Text) WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","NetID",$TxtEditAltNetID.Text) WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","checkbox",$chkbxEditAltUser.checkstate) WriteProfileString ($netpath+"vuia.dat","User","NetID",$TxtEditAltNetID.Text) Case $chkbxEditAltUser.checkstate = 0 WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","NetID","") WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","Name","") WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","CPU","") WriteProfileString ($netpath+"nodes\"+$txtEditFullName.Text,"alt","checkbox","") WriteProfileString ($netpath+"vuia.dat","User",$txtAddNetID.Text,"") WriteProfileString ($netpath+"vuia.dat","User",$txtAddAltNetID.Text,"") EndSelect EndIf $FrmEdit.Tag=0 $FrmEdit.Hide EndFunction
Function Del_User() If $ListUsers.SelectedItems.Count > 0 For Each $Item In $ListUsers.SelectedItems $msgbox.Style = 276 If $MsgBox.Show ("Are You sure you want to delete "+$Item.Text,"Delete User")=6 Del $nodepath + $Item.Text WriteProfileString ($netpath+"vuia.dat","User",$txtPriNetID.Text,"") WriteProfileString ($netpath+"vuia.dat","User",$TxtAltNetID.Text,"") EndIf Next EndIf reload() EndFunction ;*************************************** ;Start Functions for Jobs List and Edit ;***************************************
Function StartJob() $btnFindJob.show $btnCLRJob.Hide $ListJob.Clear $ListJob.SetFucus For Each $item in $ListJob.Items $item.Remove Next $FRMAdmin.Hide $FRMJobs.Show $= $ListJob.Columns.Add("Job",200) $= $ListJob.Columns.Add("Status",75) $= $ListJob.Columns.Add("Path",224) $ScriptArray = Split(ReadProfileString($netini,"",""),Chr(10)) For Each $script in $ScriptArray $jobtype=ReadProfileString($netini,$script,"run") $jobname=ReadProfileString($netini,$script,"message") If NOT InStr ($jobname,".kix") $item=$listJob.items.add $Item.SubItems(0).Text = ($jobname) Select Case $jobtype=0 $Item.SubItems(1).Text = ("Disabled") Case $jobtype=1 $Item.SubItems(1).Text = ("Forced") Case $jobtype=2 $Item.SubItems(1).Text = ("Requestable") EndSelect $editjob=Trim(Split($script,"\")[3]) $Item.SubItems(2).Text = ($netscripts + $editjob) EndIf Next While $FRMJobs.Visible $=Execute($FRMJobs.DoEvents()) Loop $FRMJobs.Hide $FrmAdmin.show EndFunction Function edit_jobs() If $ListJob.SelectedItems.Count > 0 For Each $Item In $ListJob.SelectedItems Run "notepad " + $Item.SubItems(2).Text Next EndIf EndFunction
Function FindJob() $btnFindJob.hide $btnCLRJob.show $txtjob=$txtfindjob.Text If NOT $TxtJob $msgbox.Show ("Please enter a search string","Find Job") $txtFind.SetFocus Return EndIf $ListJob.Clear For Each $item in $ListJob.Items $item.Remove Next $FRMAdmin.Hide $FRMJobs.Show $= $ListJob.Columns.Add("Job",200) $= $ListJob.Columns.Add("Status",75) $= $ListJob.Columns.Add("Path",224) $ScriptArray = Split(ReadProfileString($netini,"",""),Chr(10)) For Each $script in $ScriptArray $jobtype=ReadProfileString($netini,$script,"run") $jobname=(ReadProfileString($netini,$script,"message")) If NOT InStr ($jobname,".kix") If InStr ($jobname,$txtjob) $item=$listJob.items.add $Item.SubItems(0).Text = ($jobname) Select Case $jobtype=0 $Item.SubItems(1).Text = ("Disabled") Case $jobtype=1 $Item.SubItems(1).Text = ("Forced") Case $jobtype=2 $Item.SubItems(1).Text = ("Requestable") EndSelect $editjob=Trim(Split($script,"\")[3]) $Item.SubItems(2).Text = ($netscripts + $editjob) EndIf EndIf Next EndFunction Function CBoxAJSelect() Select Case $cboAddJobType.Text = "Disabled" $jobtype = 0 Case $cboAddJobType.Text = "Forced" $Jobtype=1 Case $cboAddJobType.Text = "Requestable" $JobType = 2 EndSelect EndFunction Function AddJobOK() $cboAddJobType.Clear $cboAddJobType.AddItem ("Forced") $cboAddJobType.AddItem ("Requestable") $cboAddJobType.AddItem ("Disabled") $frmAddJob.Show While $frmAddJob.Visible AND $frmAddJob.tag = 0 $=Execute($frmAddJob.DoEvents()) Loop If $frmAddJob.tag = 1 If $txtaddjob.Text = "" OR $cboAddJobType.Text = "" $msgbox.Show ("New Job Must have a Unique Name and Job Type Selected.","Add New Job") $frmAddJob.tag = 0 AddJobOK() Return EndIf If InStr($txtaddjob.Text," ") $a=0 Open (4,$netpath+"test.dat",5) While NOT @ERROR $filename = Trim(Split($txtaddjob.Text," ")[$a]) If $filename > "" WriteLine (4,$filename) EndIf $a=$a+1 Loop Close (4) Open (4,$netpath+"test.dat",2) $file = ReadLine (4) Close (4) Del $netpath+"test.dat" If Exist ($netscripts+$file+".kix") $msgbox.Show ("Job Name must be unique.","Add New Job") $frmAddJob.tag = 0 AddJobOK() Return Else WriteProfileString ($netini,$localscripts+$file+".kix","Run",$Jobtype) WriteProfileString ($netini,$localscripts+$file+".kix","Message",$txtaddjob.Text) WriteProfileString ($netini,$localscripts+$file+".kix","Log","End_"+$File+".log") Open (5,$netscripts+$file+".kix",5) WriteLine (5,";**********************************************"+@CRLF) WriteLine (5,";**********************************************"+@CRLF) WriteLine (5,";******************* Format *******************"+@CRLF) WriteLine (5,";**********************************************"+@CRLF) WriteLine (5,";**********************************************"+@CRLF) WriteLine (5,';Status="Previous Command to be logged'+@CRLF) WriteLine (5,';Example:'+@CRLF) WriteLine (5,';MD "c:\test"'+@CRLF) WriteLine (5,';Status = "MD c:\test"'+@CRLF) WriteLine (5,';Errchk()"'+@CRLF) WriteLine (5,";**********************************************"+@CRLF) WriteLine (5,"StartLogs()"+@CRLF+@CRLF+@CRLF+@CRLF) WriteLine (5,"EndLogs()"+@CRLF) WriteLine (5,"Exit 0"+@CRLF) Close (5) Run "notepad " +$netscripts+$File+".kix" EndIf EndIf EndIf $frmAddJob.tag = 0 $frmAddJob.Hide EndFunction
errmsg.kix
Code:
; Error Message Box Display Section SetConsole ("hide") $DiskSpace = GetDiskSpace("C:\") /1024 $pass_age=@MAXPWAGE-@pwage $DaysLeft=365-@ydayno $rc="" $MyCPU="" $MySpeed=Val(@MHZ) If $MySpeed < 1001 $MySpeed=("$MySpeed Mhz") Else $MySpeed=("$MySpeed Ghz") EndIf If @INWIN=1 ; Windows NT systems $cpu=Trim(@CPU) $MyCPU="CPU : "+$cpu +" "+$MySpeed $IsAdmin="" Select Case InGroup("\\@WKSTA\Administrators") = 1 $IsAdmin="Yes" EndSelect $rc="Administrator : "+$IsAdmin EndIf MessageBox(" ERROR: $errmsg ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support: 123-456-7890 Support Toll Free:800-123-1234 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My User Logon ID : @UserID Full Name : @FULLNAME Password Expiration: $pass_age days Operating System : @PRODUCTTYPE Build @BUILD Service Pack Level : @CSD $MyCPU $rc Current Workstation Time : @TIME Available Drive Space On C: : $DiskSpace MB ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ My Computer Name : @WKSTA Computer DNS Name : @HOSTNAME IP Address : @IPADDRESS0 MAC Address : @address ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @ydayno days have passed this year. $DaysLeft days remaining. " ,"$errmsg",16,0) Exit 0
VUIA.DAT (Verify User Is Authorized)
username=hostname (Standard User) username=admin (Administrative User)
Settings.ini Run=0 (Disabled) Run=1 (Forced) Run=2 (Requestable)
[c:\mtglaptop\scripts\thisisatest.kix] Absolute path to script Run = 1 message= This is a test log=End_thisisatest.log
_________________________
I haven't failed. I just found another way that did not work.
|
Top
|
|
|
|
#129265 - 2004-11-11 04:00 AM
Re: Please examine script
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I see this: Code:
Select Case $veruser="admin" Case $veruser <> @WKSTA $errmsg="INVALID USER-You are NOT authorized to run this application" Call $runerr Exit 0 EndSelect
Are you missing an action for the first case ($veruser="admin")? If not, then something like this may be better.
Code:
If $veruser <> @WKSTA $errmsg="INVALID USER-You are NOT authorized to run this application" Call $runerr Exit 0 EndIf
Also, you have several separate if block to check for and create directories. This would be a good place to have a UDF or at least a loop to condense the script by a few lines. I used some junk values for testing.
Code:
$localscripts = "c:\junk12" $readlog = $localscripts + "\morestuff" $netlogs = $readlog + "\deeperYet"
; make array of directory values $myDirs = $localscripts, $readlog, $netlogs For Each $dir In $myDirs ? $dir If NOT Exist ($dir) MD $dir ;Check the value of @ERROR to see if MD was successful (@ERROR = 0). ;Handle error if one occurs. EndIf Next
|
Top
|
|
|
|
#129267 - 2004-11-11 04:11 AM
Re: Please examine script
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You also perform a lot of file "Open's and numerous WriteLine's without any error checking. It may be easier to a UDF similar to WriteLog2() to handle all the OPEN's with error checking and filehandle management.
|
Top
|
|
|
|
#129275 - 2004-11-12 03:35 PM
Re: Please examine script
|
Fugazi
Starting to like KiXtart
Registered: 2001-04-23
Posts: 142
Loc: Pace, Fl.
|
I have made the following modifations to the scripts.
AMSUTIL.KIX
Added the loop for making folders and corrected the caseselects for deleting old log files to IF statement. Removed all of the additional
Code:
$System= CreateObject("Kixtart.System")
Changed the creation of the startup logs to a UDF shortening the script.
Code:
If NOT Exist ($netlogs+$userlog)
$htmlinfo=@FULLNAME
Open (9,$netlogs+$userlog,5)
StartUpLogs()
Close (9)
EndIf
If NOT Exist ($readlog+"index.html")
$htmlinfo="Log Viewer"
Open (9,$readlog+"index.html",5)
StartUpLogs()
Close (9)
EndIf
If NOT Exist ($netlogs+"index.html")
$htmlinfo="Log Viewer"
Open (9,$netlogs+"index.html",5)
StartUpLogs()
Close (9)
EndIf
If NOT Exist ($netlogs+$listhtml)
$htmlinfo="Log Veiwer"
Open (9,$netlogs+$listhtml,5)
StartUp()
WriteLine (9,'<a HREF="'+$netlogs+$userlog+'" TARGET="display_area">Details--@DATE</a></b><br>'+@CRLF)
Close (9)
FUNC.KIX
Changed the Add_Click() function because the cancel button was not working.
Code:
Function StartUpLogs()
WriteLine (9,'<div align="center">'+@CRLF)
WriteLine (9,'<body bgcolor="#c0c0c0" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">'+@CRLF)
WriteLine (9,"<HTML>"+@CRLF)
WriteLine (9,"<HEAD>"+@CRLF)
WriteLine (9,'<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">'+@CRLF)
WriteLine (9,"<TITLE>" + $HTMLInfo + "</TITLE>"+@CRLF)
WriteLine (9,"</HEAD>"+@CRLF)
WriteLine (9,"<BODY>"+@CRLF)
WriteLine (9,"<TABLE BORDER>"+@CRLF)
WriteLine (9,"<B>"+$HTMLInfo+"</B><P>"+@CRLF)
EndFunction
Function Add_Click()
$FrmAdd.Show
$FrmAdd.SetFocus
While $FrmAdd.Visible AND $FrmAdd.Tag=0
$=Execute($FrmAdd.DoEvents())
Loop
If $FrmAdd.Tag=1
If $txtAddFullName.Text = "" OR $txtAddNetID.Text = "" OR $txtAddCPUName.Text = ""
$msgbox.Show ("Please Fill out All Fields for Primary User","Add User")
Return
EndIf
If $chkbxAddAltUser.CheckState = 1
If $txtAddAltFullName.Text = "" OR $txtAddAltNetID.Text = "" OR $txtAddAltCPUName.Text = ""
$msgbox.Show ("Please Fill out All Fields for Alternate User","Add User")
Return
EndIf
EndIf
If Exist ($netpath+"nodes\"+$txtAddFullName.Text)
$msgbox.Show ("User Already Exists.","Add User")
Return
EndIf
WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Primary","NetID",$txtAddNetID.Text)
WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Primary","CPU",$txtAddCPUName.Text)
WriteProfileString ($netpath+"vuia.dat","User",$txtAddNetID.Text,$txtAddCPUName.Text)
If $chkbxAddAltUser.CheckState = 1 OR $chkbxEditaltUser.CheckState = 1
WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","Name",$txtAddAltFullName.Text)
WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","NetID",$txtAddAltNetID.Text)
WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","CPU",$txtAddAltCPUName.Text)
WriteProfileString ($netpath+"nodes\"+$txtAddFullName.Text,"Alt","Checkbox","1")
WriteProfileString ($netpath+"vuia.dat","Alt",$txtAddAltNetID.Text,$txtAddCPUName.Text)
$txtAddAltFullName.Text = ""
$txtAddAltNetID.Text = ""
$txtAddAltCPUName.Text = ""
EndIf
EndIf
$txtAddFullName.Text = ""
$txtAddNetID.Text = ""
$txtAddCPUName.Text = ""
$chkbxAddAltUser.CheckState = 0
AddAltCheckbox()
$FrmAdd.Tag=0
$FrmAdd.Hide
Reload()
EndFunction
I moved all of the varibles at the end outside the IF statement this allows the cancel button to work properly.
Edited by Fugazi (2004-11-12 04:20 PM)
_________________________
I haven't failed. I just found another way that did not work.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
2023-09-28 [Arend_]
Wow even the shouts are old ;-)
2023-11-17 [Dr_Rick]
I love Kixforms!
2023-11-21 [Dave_Melczer]
Getting DB errors again opening posts...anyone else?
2023-11-24 [Flavien]
DB errors confirmed. This forum is showing its age... UBB 7.2.2 is from 2007
2023-11-27 [Sealeopard]
And there goes the forum :-(
2023-11-30 [NTDOC]
Yes, so old no good easy update path
2023-12-01 [mole]
Posts back. No DB errors. Thanks!
2023-12-29 [BradV]
Happy new year!
2024-02-09 [RSLHA]
No access possible!
2024-02-09 [RSLHA]
Database Error!
2024-02-18 [Dr_Rick]
What happened to Bruno
2024-03-08 [mole]
Thanks for getting the posts back again.
2024-04-18 [MarineV]
will the db errors get fixed????
2024-04-26 [Tonny]
database error, please!
2024-05-09 [NTDOC]
I'm not seeing any errors
2024-05-31 [chojin]
DB is down again
2024-06-04 [selsner]
Still no access, please help!
2024-06-07 [mole]
Looks like DB is back again. Thanks.
2024-06-17 [It_took_my_meds]
We encountered a problem. The reason reported was Database error only visible to forum administrators Please click back to return to the previous page.
2024-07-04 [Armin73]
There is still a database error 🤷♂️
2024-07-09 [0neZero]
There is still a database error 🤷♂️
2024-07-10 [Allen]
DB working a few times in between the messages above. Working again as of 7/10. Thanks Doc
2024-08-31 [NetGnostic]
Bummer, the Database error is back.
2024-09-04 [NTDOC]
Fourms are back up without error for the moment
2024-10-02 [Arend_]
Wll still have database errors ;-)
2024-10-03 [Allen]
Thanks to Doc... it's back.
2024-12-09 [chojin]
could we move kixtart to a new place in order to keep it living ? maybe create a github page and a subreddit?
2024-12-10 [Allen]
do know about moving it, but I know Doc is aware of the DB issue. Should be back online soon.
2024-12-10 [Allen]
don't know...
|
|
0 registered
and 249 anonymous users online.
|
|
|