KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Windows Task Scheduler Administrator
Goto page 1, 2  Next
 
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive
View previous topic :: View next topic  
Author Message
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Fri Mar 07, 2003 7:49 pm    Post subject: Windows Task Scheduler Administrator Reply with quote

2009/12/01 - Latest version is released!
Version 3.0 has an improved installer, performance enhancements, tweaks to keep up with KF changes, and a new Task Event Import/Export feature. Combined with updates to the underlying tcLib UDF library, you can create a task with the GUI, export the task config, and then quickly load it using Kix and the tcLib library.

New in this release is the tokenizing of the file. .K53W and .K61W files are included to run with WKIX32 versions 4.53 and 4.61 respectively. The full source (tsAdm.src) is also included, which will run with any version.

2007/08/15 - latest code update is released!

tsAdm has been updated to version 2.50a. It works with the latest version of KixForms, and has several new features, including
* Run Now
* Embedded JT library
* Task-Blast - push tasks to many systems

The latest version, including documentation in MS Word format, can be downloaded from here - scroll down to the end of this post! More info is available on our website - browse to Products / Admin ToolChest.

Due to the size, I will no longer post the newest source version here. The original code will remain for review, but the newest version should be downloaded and used.

-- original posting follows --

This is "tsAdm", the GUI companion to the tsControl UDF library posted on the KiXtart.org site. You'll need that UDF file on your machine, and need to edit this program so it references the location of the tsControl UDF on your system. You can also download the entire package - tsControl.udf, tsAdm, test.kix (a tsControl test/demo script, install notes, the entire Microsoft JT.zip, and MS-Word docs for JT, tsControl, and tsAdm - as a zip file at the following location(s)
http://www.wheelerfam.com/Documents/tstools.zip - Thanks to Radimus!
http://www.kixhelp.com/Downloads/tstools.zip - Thanks to NTDOC!





Basically, this tool allows you to connect to a local or remote server by name. It obtains a list of scheduled tasks and allows you to edit, create, delete, or change user credentials for the tasks and triggers.

Note that the tsControl UDF is loaded via the Include() function. The function will attempt to load either tsControl.UDF or tsControl.KXF from three locations - \usr\lib, the %KIXLIBPATH% variable, or the @SCRIPTDIR directory. We use .KXF to represent KiX Functions because .UDF conflicts with another file type on our systems.

Update History
3/10/03
- Adds Delete Trigger, Show Status, Enable/Disable, and Save As functions.
- Now allows Copy/Paste events between systems
- Loads library from alternate locations.

3/16/03
- FIX: Load library from @SCRIPTDIR path failed with "Wrong tsControl Version"
- FIX: Query to systems with one scheduled event reported "No Scheduled Events found"

3/21/03
- CHANGE: altered Query button anchor per Shawn's request
- ENHANCEMENT: - use Include() to load tsControl library

A future release will allow editing of advanced Task parameters.

Enjoy!

Glenn


[code]
; tsadm.kix - task scheduler administrator
; 2/2003 - Glenn Barnas - FRIT-EROC
;
; Version 1.31
;
; Provides a GUI interface to the Windows Task Scheduler on any computer
; Simplified interface - not all options/parameters are supported.
;
; Version History
;
; 2/25/2003 1.0 - Initial release
; 3/07/2003 1.2 - Cleaned up form & frame creation, performance enhancements
; 3/10/2003 1.3 - Modified to load tsControl library from multiple locations
; 3/21/2003 1.31 - Change Query button anchor, improved library load function

Break ON ; Allow user termination

; Load function libraries
Include("tscontrol")

; Requires features present only in tsControl UDF 1.2 or higher
If $tsVer < 1.2
MessageBox("Outdated tsControl library - aborting!", "tsAdm - Init Failure", 16)
Beep
Exit 1
EndIf

; Define some global variables - used mostly for combo boxes and tranlations
$aryTYPES = "Daily", "Weekly", "MonthlyDate", "MonthlyDOW", "Once", "OnIdle", "AtStartup", "AtLogon"
$aryMonths = "NUL", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
$aryDays = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
$aryDY = "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"
$aryDCode = "U", "M", "T", "W", "R", "F", "A"
$aryWeeks = "Nul", "First", "Second", "Third", "Fourth", "Last"

$T2Buffer = 0 ; global Task/Trig copy buffer flag

$X = InitMain() ; init the main form - it calls the sub-form init process

$frmMain.Show ; make it visible

ClrFrm() ; Clear the form

$txtHost.SetFocus ; define the default field

; loop "forever" in the main form, until EXIT is selected
While $frmMain.Visible And $FrmMain.Tag = 1
$ = Execute($frmMain.DoEvents())
$btnEND.Cancel = 1
Loop


Exit 0


; FUNCTIONS FOLLOW...

; Create the forms and related fields, frames, and event triggers.
; Defines the main and secondary (trigger) forms. There are
; two types of sub-frames on the trigger form - "S#" frames are
; shared by multiple trigger types. "M#" frames are type-specific.
; All field references have the format $tttTrigM#name or $tttTrigS#name
; Fields shared by the form use the format $tttTrigname - where "ttt"
; denotes the field type.
;
Function InitMain()

; ========================= Main Form - subframes, CMD buttons, & message field
$frmMain = CreateObject("Kixtart.Form")
$frmMain.Width = 620
$frmMain.Height = 580
$frmMain.Caption = "Windows Task Scheduler Administrator"
$frmMain.Tag = 1
$frmMain.Center

; This is used for general messages, status, errors, etc.
$lblTMsg = $frmMain.Label()
$lblTMsg.Caption = ""
$lblTMsg.Left = 300
$lblTMsg.Top = 60
$lblTMsg.Width = 290
$lblTMsg.Height = 12
$lblTMsg.FontSize = 8
$lblTMsg.FontBold = 1

$iBtnRow = 505
$iBtnCol = 15

; Save Event button
$sTT = "Save the current settings to the target server."
$btnSVE = $frmMain.CommandButton()
$btnSVE.Caption = "Save"
$btnSVE.Left = $iBtnCol
$btnSVE.Top = $iBtnRow
$btnSVE.Width = 75
$btnSVE.Height = 30
$btnSVE.Enabled = 0
$btnSVE.ToolTip = $sTT
$btnSVE.OnClick = "SaveEvent()"
$iBtnCol = $iBtnCol + 85

; Save-As Event button
$sTT = "Save the current settings to the target server with a new task name."
$btnSVA = $frmMain.CommandButton()
$btnSVA.Caption = "Save As"
$btnSVA.Left = $iBtnCol
$btnSVA.Top = $iBtnRow
$btnSVA.Width = 75
$btnSVA.Height = 30
$btnSVA.Enabled = 0
$btnSVA.ToolTip = $sTT
$btnSVA.OnClick = "SaveEvent(1)"
$iBtnCol = $iBtnCol + 85

; Delete Event button
$sTT = "Deletes the task from memory and from the target server"
$btnDLE = $frmMain.CommandButton()
$btnDLE.Caption = "Delete"
$btnDLE.Left = $iBtnCol
$btnDLE.Top = $iBtnRow
$btnDLE.Width = 75
$btnDLE.Height = 30
$btnDLE.Enabled = 0
$btnDLE.ToolTip = $sTT
$btnDLE.OnClick = "DeleteEvent()"
$iBtnCol = $iBtnCol + 85

; Set Event Credentials button
$sTT = "Applies the current security credentials to the event on the target server"
$btnSEC = $frmMain.CommandButton()
$btnSEC.Caption = "Set ID"
$btnSEC.Left = $iBtnCol
$btnSEC.Top = $iBtnRow
$btnSEC.Width = 75
$btnSEC.Height = 30
$btnSEC.Enabled = 0
$btnSEC.ToolTip = $sTT
$btnSEC.OnClick = "SetEventCredentials()"
$iBtnCol = $iBtnCol + 85


; Show Status button
$sTT = "Displays the event status, such as last or next run times."
$btnSTA = $frmMain.CommandButton()
$btnSTA.Caption = "Status"
$btnSTA.Left = $iBtnCol
$btnSTA.Top = $iBtnRow
$btnSTA.Width = 75
$btnSTA.Height = 30
$btnSTA.Enabled = 0
$btnSTA.ToolTip = $sTT
$btnSTA.OnClick = "ShowStatus()"
$iBtnCol = $iBtnCol + 85


; Copy/Clear & Paste buttons
$sTT = "Copies the event data to a holding buffer. Can then be 'pasted' "
$sTT = $sTT + "to a New_Task on a different server."
$btnCPC = $frmMain.CommandButton()
$btnCPC.Caption = "Copy"
$btnCPC.Left = $iBtnCol
$btnCPC.Top = $iBtnRow
$btnCPC.Width = 37
$btnCPC.Height = 30
$btnCPC.Enabled = 0
$btnCPC.ToolTip = $sTT
$btnCPC.OnClick = "CpyClr()"
$iBtnCol = $iBtnCol + 40
$sTT = "Loads a New_Task event from the holding buffer."
$btnPST = $frmMain.CommandButton()
$btnPST.Caption = "Paste"
$btnPST.Left = $iBtnCol
$btnPST.Top = $iBtnRow
$btnPST.Width = 37
$btnPST.Height = 30
$btnPST.Enabled = 0
$btnPST.ToolTip = $sTT
$btnPST.OnClick = "Paste()"
$iBtnCol = $iBtnCol + 45

; Quit button
$btnEND = $frmMain.CommandButton()
$btnEND.Caption = "Exit"
$btnEND.Left = $iBtnCol
$btnEND.Top = $iBtnRow
$btnEND.Width = 75
$btnEND.Height = 30
$btnEND.Enabled = 1
$btnEND.OnClick = "$$frmMain.Tag = 0"


; ========================= Top Frame - Host & Task fields
$fraTop = $frmMain.Frame()
$fraTop.Left = 5
$fraTop.Top = 5
$fraTop.Width = 600
$fraTop.Height = 50
$fraTop.Caption = "Common Settings"

; Server text box & query button
$lblHost = $fraTOP.Label()
$lblHost.Caption = "Server:"
$lblHost.Left = 15
$lblHost.Top = 25
$lblHost.Width = 50
$lblHost.Height = 20

$sTT = "Enter the name of a server to query - then press Enter."
$txtHost = $fraTOP.TextBox()
$txtHost.Left = 70
$txtHost.Top = 20
$txtHost.Width = 100
$txtHost.Height = 20
$txtHost.ToolTip = $sTT
$txtHost.AcceptsReturn = 1
$txtHost.OnGotFocus = "$btnQRY.Default = 1"
$txtHost.OnLostFocus = "$btnQRY.Default = 0"

$sTT = "Click to re-query the server."
$btnQRY = $fraTop.CommandButton()
$btnQRY.Caption = "Query"
$btnQRY.Left = 190
$btnQRY.Top = 20
$btnQRY.Width = 50
$btnQRY.Height = 20
$btnQry.ToolTip = $sTT
$btnQRY.OnClick = "QueryServer()"

; available tasks list
$lblTask = $fraTop.Label()
$lblTask.Caption = "Tasks:"
$lblTask.Left = 275
$lblTask.Top = 25
$lblTask.Width = 50
$lblTask.Height = 20

$sTT = "Select the event to view or modify. Choose New_Task to create a new event."
$cboTask = $fraTop.ComboBox()
$cboTask.Left = 325
$cboTask.Top = 20
$cboTask.Width = 150
$cboTask.Height = 100
$cboTask.Style = 1
$cboTask.ToolTip = $sTT
$cboTask.OnClick = "LoadEvent()"



; ========================= Sec Frame - Security info
$fraSec = $frmMain.Frame()
$fraSec.Left = 5
$fraSec.Top = 75
$fraSec.Width = 600
$fraSec.Height = 50
$fraSec.Caption = "Security Credentials"

; Account Name dialog box
$lblUser = $fraSec.Label()
$lblUser.Caption = "User ID:"
$lblUser.Left = 15
$lblUser.Top = 25
$lblUser.Width = 50
$lblUser.Height = 20
$txtUser = $fraSec.TextBox()
$txtUser.Caption = ""
$txtUser.Left = 70
$txtUser.Top = 20
$txtUser.Width = 125
$txtUser.Height = 20

$lblPass = $fraSec.Label()
$lblPass.Caption = "Password:"
$lblPass.Left = 255
$lblPass.Top = 25
$lblPass.Width = 70
$lblPass.Height = 20
$txtPass = $fraSec.TextBox()
$txtPass.Left = 325
$txtPass.Top = 20
$txtPass.Width = 125
$txtPass.Height = 20
$txtPass.PasswordChar = "*"


; ========================= Evt Frame - Event Data
$fraEvt = $frmMain.Frame()
$fraEvt.Left = 5
$fraEvt.Top = 140
$fraEvt.Width = 600
$fraEvt.Height = 350
$fraEvt.Caption = "Event Settings"

; application
$sTT = "Full path to the command to be run."
$lblAPP = $fraEvt.Label()
$lblAPP.Left = 25
$lblAPP.Top = 25
$lblAPP.Width = 50
$lblAPP.Height = 20
$lblAPP.Caption = "Command:"
$txtAPP= $fraEvt.TextBox()
$txtAPP.Left = 90
$txtAPP.Top = 20
$txtAPP.Width = 230
$txtAPP.Height = 20
$txtAPP.Caption = ""
$txtAPP.ToolTip = $sTT

; Parameters
$sTT = "Any parameters required by the command."
$lblPRM = $fraEvt.Label()
$lblPRM.Left = 350
$lblPRM.Top = 25
$lblPRM.Width = 30
$lblPRM.Height = 20
$lblPRM.Caption = "Args:"
$txtPRM= $fraEvt.TextBox()
$txtPRM.Left = 380
$txtPRM.Top = 20
$txtPRM.Width = 200
$txtPRM.Height = 20
$txtPRM.ToolTip = $sTT

; Working dir
$sTT = ""
$lblWKD = $fraEvt.Label()
$lblWKD.Left = 15
$lblWKD.Top = 50
$lblWKD.Width = 70
$lblWKD.Height = 20
$lblWKD.Caption = "Working Dir:"
$txtWKD= $fraEvt.TextBox()
$txtWKD.Left = 90
$txtWKD.Top = 45
$txtWKD.Width = 230
$txtWKD.Height = 20
$txtWKD.ToolTip = $sTT

; Comment
$sTT = ""
$lblCMT = $fraEvt.Label()
$lblCMT.Left = 330
$lblCMT.Top = 50
$lblCMT.Width = 50
$lblCMT.Height = 20
$lblCMT.Caption = "Comment:"
$txtCMT= $fraEvt.TextBox()
$txtCMT.Left = 380
$txtCMT.Top = 45
$txtCMT.Width = 200
$txtCMT.Height = 20
$txtCMT.ToolTip = $sTT

; Enabled
$sTT = "Disables task without deleting it."
$lblSUS = $fraEvt.Label()
$lblSUS.Left = 30
$lblSUS.Top = 73
$lblSUS.Width = 150
$lblSUS.Height = 20
$lblSUS.Caption = "Task is Enabled"
$chkSUS = $fraEvt.CheckBox()
$chkSUS.Left = 15
$chkSUS.Top = 75
$chkSUS.Width = 10
$chkSUS.Height = 10
$chkSUS.ToolTip = $sTT


; TRIGGER fields
$RowPos = 95 ; starting row position
$RowInc = 25 ; row increment value
; define the 10 edit buttons and trigger description fields
For $iX = 0 to 9
$RC = Execute('$$cmdTR$iX = $$fraEvt.CommandButton("Edit $iX",25,$RowPos,40,20)')
$RC = Execute('$$lblTR$iX = $$fraEvt.Label("", 80,$RowPos,500,20)')
$RC = Execute('$$cmdTR$iX.OnClick = "EditTrigger($iX)"')
$RowPos = $RowPos + $RowInc ; increment the row position
Next

$X = InitSub()
$sTT = ""

EndFunction

Function InitSub()

; ========================= SubForm - Trigger =========================

; ========================= Trigger Edit Form
$frmTrig = CreateObject("Kixtart.Form")
$frmTrig.Width = 500
$frmTrig.Height = 460
$frmTrig.Caption = "Trigger Editor"
$frmTrig.Tag = 1

$btnTr_DEL = $frmTrig.CommandButton() ; Delete
$btnTr_DEL.Left = 230
$btnTr_DEL.Top = 390
$btnTr_DEL.Width = 75
$btnTr_DEL.Height = 30
$btnTr_DEL.Caption = "Delete"
$btnTr_DEL.OnClick = "DeleteTrigger($TID)"

$btnTr_SAV = $frmTrig.CommandButton() ; Save
$btnTr_SAV.Left = 315
$btnTr_SAV.Top = 390
$btnTr_SAV.Width = 75
$btnTr_SAV.Height = 30
$btnTr_SAV.Caption = "Save"
$btnTr_SAV.OnClick = "SaveTrigger($TID)"

$btnTr_END = $frmTrig.CommandButton() ; Quit
$btnTr_END.Left = 400
$btnTr_END.Top = 390
$btnTr_END.Width = 75
$btnTr_END.Height = 30
$btnTr_END.Caption = "Cancel"
$btnTr_END.OnClick = "$$frmTrig.hide"

; Define the Type selector, default to current setting (if any)
$lblTrigType = $frmTrig.Label()
$lblTrigType.Left = 15
$lblTrigType.Top = 20
$lblTrigType.Width = 80
$lblTrigType.Height = 20
$lblTrigType.Caption = "Schedule Type"
$cboTrigType = $frmTrig.ComboBox()
$cboTrigType.Left = 100
$cboTrigType.Top = 15
$cboTrigType.Width = 120
$cboTrigType.Height = 100
$cboTrigType.OnClick = "DisplayTrigType()"

; initialize the trigger types (static)
For Each $T in $aryTYPES
$cboTrigType.AddItem($T)
Next

; ========================= Common Field: Start Time
$fraTrigS1 = $frmTrig.Frame()
$fraTrigS1.Left = 25
$fraTrigS1.Top = 65
$fraTrigS1.Width = 440
$fraTrigS1.Height = 40
$fraTrigS1.BorderStyle = 0

$lblTrigSTM = $fraTrigS1.Label()
$lblTrigSTM.Left = 15
$lblTrigSTM.Top = 15
$lblTrigSTM.Width = 60
$lblTrigSTM.Height = 20
$lblTrigSTM.Caption = "Start Time:"

$txtTrigSTM = $fraTrigS1.TextBox()
$txtTrigSTM.Left = 85
$txtTrigSTM.Top = 12
$txtTrigSTM.Width = 70
$txtTrigSTM.Height = 20
$txtTrigSTM.Caption = ""


; ========================= Common Field: Start Date
$fraTrigS2 = $frmTrig.Frame()
$fraTrigS2.Left = 25
$fraTrigS2.Top = 225
$fraTrigS2.Width = 220
$fraTrigS2.Height = 40
$fraTrigS2.BorderStyle = 0

$lblTrigSDT = $fraTrigS2.Label()
$lblTrigSDT.Left = 15
$lblTrigSDT.Top = 15
$lblTrigSDT.Width = 60
$lblTrigSDT.Height = 20
$lblTrigSDT.Caption = "Start Date:"

$txtTrigSDT = $fraTrigS2.TextBox()
$txtTrigSDT.Left = 85
$txtTrigSDT.Top = 12
$txtTrigSDT.Width = 70
$txtTrigSDT.Height = 20


; ========================= Common Field: End Date
$fraTrigS3 = $frmTrig.Frame()
$fraTrigS3.Left = 245
$fraTrigS3.Top = 225
$fraTrigS3.Width = 220
$fraTrigS3.Height = 40
$fraTrigS3.BorderStyle = 0

$chkTrigHED = $fraTrigS3.CheckBox()
$chkTrigHED.Left = 25
$chkTrigHED.Top = 16
$chkTrigHED.Width = 10
$chkTrigHED.Height = 10

$lblTrigEDT = $fraTrigS3.Label()
$lblTrigEDT.Left = 45
$lblTrigEDT.Top = 15
$lblTrigEDT.Width = 60
$lblTrigEDT.Height = 20
$lblTrigEDT.Caption = "End Date:"

$txtTrigEDT = $fraTrigS3.TextBox()
$txtTrigEDT.Left = 105
$txtTrigEDT.Top = 12
$txtTrigEDT.Width = 70
$txtTrigEDT.Height = 20


; ========================= Common Field: Repeat Info
$fraTrigS4 = $frmTrig.Frame()
$fraTrigS4.Left = 25
$fraTrigS4.Top = 265
$fraTrigS4.Width = 440
$fraTrigS4.Height = 105
$fraTrigS4.Caption = ""
$fraTrigS4.BorderStyle = 0

; Labels
$lblTrigRPT = $fraTrigS4.Label()
$lblTrigRPT.Left = 40
$lblTrigRPT.Top = 15
$lblTrigRPT.Width = 50
$lblTrigRPT.Height = 20
$lblTrigRPT.Caption = "Repeats:"

$lblTrigLb1 = $fraTrigS4.Label()
$lblTrigLb1.Left = 60
$lblTrigLb1.Top = 35
$lblTrigLb1.Width = 30
$lblTrigLb1.Height = 20
$lblTrigLb1.Caption = "Every"

$lblTrigLb2 = $fraTrigS4.Label()
$lblTrigLb2.Left = 150
$lblTrigLb2.Top = 35
$lblTrigLb2.Width = 40
$lblTrigLb2.Height = 20
$lblTrigLb2.Caption = "Minutes"

$lblTrigLb3 = $fraTrigS4.Label()
$lblTrigLb3.Left = 72
$lblTrigLb3.Top = 60
$lblTrigLb3.Width = 15
$lblTrigLb3.Height = 20
$lblTrigLb3.Caption = "for"

$lblTrigLb4 = $fraTrigS4.Label()
$lblTrigLb4.Left = 150
$lblTrigLb4.Top = 60
$lblTrigLb4.Width = 30
$lblTrigLb4.Height = 20
$lblTrigLb4.Caption = "Hours"

$lblTrigLb5 = $fraTrigS4.Label()
$lblTrigLb5.Left = 255
$lblTrigLb5.Top = 60
$lblTrigLb5.Width = 40
$lblTrigLb5.Height = 20
$lblTrigLb5.Caption = "Minutes"

$lblTrigLb6 = $fraTrigS4.Label()
$lblTrigLb6.Left = 80
$lblTrigLb6.Top = 83
$lblTrigLb6.Width = 200
$lblTrigLb6.Height = 20
$lblTrigLb6.Caption = "Kill task if running at duration end."

; Repeats checkbox
$chkTrigRPT = $fraTrigS4.CheckBox()
$chkTrigRPT.Left = 25
$chkTrigRPT.Top = 16
$chkTrigRPT.Width = 10
$chkTrigRPT.Height = 10
$chkTrigRPT.Value = 0

; Repeat Interval value
$txtTrigINT = $fraTrigS4.TextBox()
$txtTrigINT.Left = 90
$txtTrigINT.Top = 32
$txtTrigINT.Width = 30
$txtTrigINT.Height = 20
$txtTrigINT.Caption = "0"
$txtTrigINT.Enabled = 0

; Repeat Interval SpinControl
$spnTrigINT = $fraTrigS4.SpinButton()
$spnTrigINT.Left = 120
$spnTrigINT.Top = 32
$spnTrigINT.Width = 20
$spnTrigINT.Height = 20
$spnTrigINT.Orientation = 1
$spnTrigINT.Min = 0
$spnTrigINT.Max = 720
$spnTrigINT.Value = 0
$spnTrigINT.OnChange = 'SpinChange("TrigINT")'
$txtTrigINT.Value = $spnTrigINT.Value

; Repeat Duration - Hours value
$txtTrigHRS = $fraTrigS4.TextBox()
$txtTrigHRS.Left = 90
$txtTrigHRS.Top = 57
$txtTrigHRS.Width = 30
$txtTrigHRS.Height = 20
$txtTrigHRS.Caption = ""
$txtTrigHRS.Enabled = 0 ; Don't allow direct entry

; Hours SpinControl
$spnTrigHRS = $fraTrigS4.SpinButton()
$spnTrigHRS.Left = 120
$spnTrigHRS.Top = 57
$spnTrigHRS.Width = 20
$spnTrigHRS.Height = 20
$spnTrigHRS.Orientation = 1
$spnTrigHRS.Min = 0
$spnTrigHRS.Max = 23
$spnTrigHRS.Value = 0
$spnTrigHRS.OnChange = 'SpinChange("TrigHRS")'
$txtTrigHRS.Value = $spnTrigHRS.Value

; Repeat Duration - Minutes
$txtTrigMIN = $fraTrigS4.TextBox()
$txtTrigMIN.Left = 195
$txtTrigMIN.Top = 57
$txtTrigMIN.Width = 30
$txtTrigMIN.Height = 20
$txtTrigMIN.Caption = ""
$txtTrigMIN.Enabled = 0 ; Don't allow direct entry

; Minutes SpinControl
$spnTrigMIN = $fraTrigS4.SpinButton()
$spnTrigMIN.Left = 225
$spnTrigMIN.Top = 57
$spnTrigMIN.Width = 20
$spnTrigMIN.Height = 20
$spnTrigMIN.Orientation = 1
$spnTrigMIN.Min = 0
$spnTrigMIN.Max = 59
$spnTrigMIN.Value = 0
$spnTrigMIN.OnChange = 'SpinChange("TrigMIN")'
$txtTrigMIN.Value = $spnTrigMIN.Value

; KillAtDuration checkbox
$chkTrigKAD = $fraTrigS4.CheckBox()
$chkTrigKAD.Left = 60
$chkTrigKAD.Top = 85
$chkTrigKAD.Width = 10
$chkTrigKAD.Height = 10

; "Trigger Type" frames obtain type-specific ARG data

; ========================= Trigger Type: DAILY
; #days Interval, Start Time, Start Date, End Date, Repeat
;
$fraTrigM1 = $frmTrig.Frame()
$fraTrigM1.Left = 15
$fraTrigM1.Top = 50
$fraTrigM1.Width = 460
$fraTrigM1.Height = 330
$fraTrigM1.Caption = "Run Daily"

$lblTrigM1Lb1 = $fraTrigM1.Label()
$lblTrigM1Lb1.Left = 25
$lblTrigM1Lb1.Top = 65
$lblTrigM1Lb1.Width = 30
$lblTrigM1Lb1.Height = 20
$lblTrigM1Lb1.Caption = "Every"

$lblTrigM1Lb2 = $fraTrigM1.Label()
$lblTrigM1Lb2.Left = 115
$lblTrigM1Lb2.Top = 65
$lblTrigM1Lb2.Width = 50
$lblTrigM1Lb2.Height = 20
$lblTrigM1Lb2.Caption = "Day(s)"

; DAYS INTERVAL
$txtTrigM1INT = $fraTrigM1.TextBox()
$txtTrigM1INT.Left = 60
$txtTrigM1INT.Top = 62
$txtTrigM1INT.Width = 30
$txtTrigM1INT.Height = 20
$txtTrigM1INT.Caption = ""
$txtTrigM1INT.Enabled = 0

$spnTrigM1INT = $fraTrigM1.SpinButton()
$spnTrigM1INT.Left = 90
$spnTrigM1INT.Top = 62
$spnTrigM1INT.Width = 20
$spnTrigM1INT.Height = 20
$spnTrigM1INT.Caption = ""
$spnTrigM1INT.Orientation = 1
$spnTrigM1INT.Min = 1
$spnTrigM1INT.Max = 90
$spnTrigM1INT.Value = 1
$txtTrigM1INT.Value = $spnTrigM1INT.Value
$spnTrigM1INT.OnChange = 'SpinChange("TrigM1INT")'


; ========================= Trigger Type: WEEKLY
$fraTrigM2 = $frmTrig.Frame()
$fraTrigM2.Left = 15
$fraTrigM2.Top = 50
$fraTrigM2.Width = 460
$fraTrigM2.Height = 330
$fraTrigM2.Caption = "Run Weekly"

; on day # of MONTH
; Create the frame fields
$lblTrigM2Lb1 = $fraTrigM2.Label()
$lblTrigM2Lb1.Left = 25
$lblTrigM2Lb1.Top = 65
$lblTrigM2Lb1.Width = 30
$lblTrigM2Lb1.Height = 20
$lblTrigM2Lb1.Caption = "Every"

$lblTrigM2Lb2 = $fraTrigM2.Label()
$lblTrigM2Lb2.Left = 115
$lblTrigM2Lb2.Top = 65
$lblTrigM2Lb2.Width = 70
$lblTrigM2Lb2.Height = 20
$lblTrigM2Lb2.Caption = "Week(s) on"

; Days Interval Value
$txtTrigM2INT = $fraTrigM2.TextBox()
$txtTrigM2INT.Left = 60
$txtTrigM2INT.Top = 62
$txtTrigM2INT.Width = 30
$txtTrigM2INT.Height = 20
$txtTrigM2INT.Enabled = 0

; Interval spin control
$spnTrigM2INT = $fraTrigM2.SpinButton()
$spnTrigM2INT.Left = 90
$spnTrigM2INT.Top = 62
$spnTrigM2INT.Width = 20
$spnTrigM2INT.Height = 20
$spnTrigM2INT.Orientation = 1
$spnTrigM2INT.Min = 1
$spnTrigM2INT.Max = 52
$txtTrigM2INT.Value = $spnTrigM2INT.Value
$spnTrigM2INT.OnChange = 'SpinChange("TrigM2INT")'

; set up the Days array
$chkTrigM2WD1 = $fraTrigM2.CheckBox("",190,68,10,10)
$chkTrigM2WD6 = $fraTrigM2.CheckBox("",260,68,10,10)
$chkTrigM2WD2 = $fraTrigM2.CheckBox("",190,88,10,10)
$chkTrigM2WD0 = $fraTrigM2.CheckBox("",260,88,10,10)
$chkTrigM2WD3 = $fraTrigM2.CheckBox("",190,108,10,10)
$chkTrigM2WD4 = $fraTrigM2.CheckBox("",190,128,10,10)
$chkTrigM2WD5 = $fraTrigM2.CheckBox("",190,148,10,10)
$lblTrigM2WD1 = $fraTrigM2.Label("Mon",205,65,40,15)
$lblTrigM2WD6 = $fraTrigM2.Label("Sat",275,65,40,15)
$lblTrigM2WD2 = $fraTrigM2.Label("Tue",205,85,40,15)
$lblTrigM2WD0 = $fraTrigM2.Label("Sun",275,85,40,15)
$lblTrigM2WD3 = $fraTrigM2.Label("Wed",205,105,40,15)
$lblTrigM2WD4 = $fraTrigM2.Label("Thu",205,125,40,15)
$lblTrigM2WD5 = $fraTrigM2.Label("Fri",205,145,40,15)

; ========================= Trigger Type: MONTHLY-DATE
$fraTrigM3 = $frmTrig.Frame()
$fraTrigM3.Left = 15
$fraTrigM3.Top = 50
$fraTrigM3.Width = 460
$fraTrigM3.Height = 330
$fraTrigM3.Caption = "Run Monthly - Specific Date"

; on day # of MONTH
; Create the frame fields
$lblTrigM3Lb1 = $fraTrigM3.Label()
$lblTrigM3Lb1.Left = 25
$lblTrigM3Lb1.Top = 65
$lblTrigM3Lb1.Width = 33
$lblTrigM3Lb1.Height = 20
$lblTrigM3Lb1.Caption = "On the"

$lblTrigM3Lb2 = $fraTrigM3.Label()
$lblTrigM3Lb2.Left = 125
$lblTrigM3Lb2.Top = 62
$lblTrigM3Lb2.Width = 30
$lblTrigM3Lb2.Height = 20
$lblTrigM3Lb2.Caption = "day of"

; Interval Value
$txtTrigM3INT = $fraTrigM3.TextBox()
$txtTrigM3INT.Left = 70
$txtTrigM3INT.Top = 62
$txtTrigM3INT.Width = 30
$txtTrigM3INT.Height = 20
$txtTrigM3INT.Enabled = 0

; Interval Spin Control
$spnTrigM3INT = $fraTrigM3.SpinButton()
$spnTrigM3INT.Left = 100
$spnTrigM3INT.Top = 62
$spnTrigM3INT.Width = 20
$spnTrigM3INT.Height = 20
$spnTrigM3INT.Orientation = 1
$spnTrigM3INT.Min = 1
$spnTrigM3INT.Max = 31
$txtTrigM3INT.Value = $spnTrigM3INT.Value
$spnTrigM3INT.OnChange = 'SpinChange("TrigM3INT")'

; set up the Months CheckBoxes
$chkTrigM3MO1 = $fraTrigM3.CheckBox("",230,66,10,10)
$chkTrigM3MO5 = $fraTrigM3.CheckBox("",300,66,10,10)
$chkTrigM3MO9 = $fraTrigM3.CheckBox("",370,66,10,10)
$chkTrigM3MO2 = $fraTrigM3.CheckBox("",230,91,10,10)
$chkTrigM3MO6 = $fraTrigM3.CheckBox("",300,91,10,10)
$chkTrigM3MO10 = $fraTrigM3.CheckBox("",370,91,10,10)
$chkTrigM3MO3 = $fraTrigM3.CheckBox("",230,116,10,10)
$chkTrigM3MO7 = $fraTrigM3.CheckBox("",300,116,10,10)
$chkTrigM3MO11 = $fraTrigM3.CheckBox("",370,116,10,10)
$chkTrigM3MO4 = $fraTrigM3.CheckBox("",230,141,10,10)
$chkTrigM3MO8 = $fraTrigM3.CheckBox("",300,141,10,10)
$chkTrigM3MO12 = $fraTrigM3.CheckBox("",370,141,10,10)

; and the Months Labels
$lblTrigM3MO1 = $fraTrigM3.Label("Jan",245,65,40,15)
$lblTrigM3MO2 = $fraTrigM3.Label("May",315,65,40,15)
$lblTrigM3MO3 = $fraTrigM3.Label("Sep",385,65,40,15)
$lblTrigM3MO4 = $fraTrigM3.Label("Feb",245,90,40,15)
$lblTrigM3MO5 = $fraTrigM3.Label("Jun",315,90,40,15)
$lblTrigM3MO6 = $fraTrigM3.Label("Oct",385,90,40,15)
$lblTrigM3MO7 = $fraTrigM3.Label("Mar",245,115,40,15)
$lblTrigM3MO8 = $fraTrigM3.Label("Jul",315,115,40,15)
$lblTrigM3MO9 = $fraTrigM3.Label("Nov",385,115,40,15)
$lblTrigM3MO10 = $fraTrigM3.Label("Apr",245,140,40,15)
$lblTrigM3MO11 = $fraTrigM3.Label("Aug",315,140,40,15)
$lblTrigM3MO12 = $fraTrigM3.Label("Dec",385,140,40,15)


; ========================= Trigger Type: MONTHLY-DOW
; Week, Weekday, Month(s), Start Time, Start Date, End Date, Repeat
;
$fraTrigM4 = $frmTrig.Frame()
$fraTrigM4.Left = 15
$fraTrigM4.Top = 50
$fraTrigM4.Width = 460
$fraTrigM4.Height = 330
$fraTrigM4.Caption = "Run Monthly - Specific Weekday"

; Create the frame fields
$lblTrigM4Lb1 = $fraTrigM4.Label()
$lblTrigM4Lb1.Left = 25
$lblTrigM4Lb1.Top = 65
$lblTrigM4Lb1.Width = 33
$lblTrigM4Lb1.Height = 20
$lblTrigM4Lb1.Caption = "On the"

$lblTrigM4Lb2 = $fraTrigM4.Label()
$lblTrigM4Lb2.Left = 210
$lblTrigM4Lb2.Top = 65
$lblTrigM4Lb2.Width = 20
$lblTrigM4Lb2.Height = 20
$lblTrigM4Lb2.Caption = "of"

; Week of the Month
; uses $aryWeeks
$cboTrigM4WK = $fraTrigM4.ComboBox()
$cboTrigM4WK.Left = 62
$cboTrigM4WK.Top = 63
$cboTrigM4WK.Width = 65
$cboTrigM4WK.Height = 100
$cboTrigM4WK.Style = 1

; populate with values
For $iX = 1 to 5
$cboTrigM4WK.AddItem($aryWeeks[$iX])
Next

; Day of the Week
; uses $aryDays
$cboTrigM4DY = $fraTrigM4.ComboBox()
$cboTrigM4DY.Left = 125
$cboTrigM4DY.Top = 63
$cboTrigM4DY.Width = 85
$cboTrigM4DY.Height = 100
$cboTrigM4DY.Style = 1

; populate with values
For $iX = 0 to 6
$cboTrigM4DY.AddItem($aryDays[$iX])
Next

; set up the Months CheckBoxes
$chkTrigM4MO1 = $fraTrigM4.CheckBox("",230,66,10,10)
$chkTrigM4MO5 = $fraTrigM4.CheckBox("",300,66,10,10)
$chkTrigM4MO9 = $fraTrigM4.CheckBox("",370,66,10,10)
$chkTrigM4MO2 = $fraTrigM4.CheckBox("",230,91,10,10)
$chkTrigM4MO6 = $fraTrigM4.CheckBox("",300,91,10,10)
$chkTrigM4MO10 = $fraTrigM4.CheckBox("",370,91,10,10)
$chkTrigM4MO3 = $fraTrigM4.CheckBox("",230,116,10,10)
$chkTrigM4MO7 = $fraTrigM4.CheckBox("",300,116,10,10)
$chkTrigM4MO11 = $fraTrigM4.CheckBox("",370,116,10,10)
$chkTrigM4MO4 = $fraTrigM4.CheckBox("",230,141,10,10)
$chkTrigM4MO8 = $fraTrigM4.CheckBox("",300,141,10,10)
$chkTrigM4MO12 = $fraTrigM4.CheckBox("",370,141,10,10)

; and the Months Labels
$lblTrigM4MO1 = $fraTrigM4.Label("Jan",245,65,40,15)
$lblTrigM4MO2 = $fraTrigM4.Label("May",315,65,40,15)
$lblTrigM4MO3 = $fraTrigM4.Label("Sep",385,65,40,15)
$lblTrigM4MO4 = $fraTrigM4.Label("Feb",245,90,40,15)
$lblTrigM4MO5 = $fraTrigM4.Label("Jun",315,90,40,15)
$lblTrigM4MO6 = $fraTrigM4.Label("Oct",385,90,40,15)
$lblTrigM4MO7 = $fraTrigM4.Label("Mar",245,115,40,15)
$lblTrigM4MO8 = $fraTrigM4.Label("Jul",315,115,40,15)
$lblTrigM4MO9 = $fraTrigM4.Label("Nov",385,115,40,15)
$lblTrigM4MO10 = $fraTrigM4.Label("Apr",245,140,40,15)
$lblTrigM4MO11 = $fraTrigM4.Label("Aug",315,140,40,15)
$lblTrigM4MO12 = $fraTrigM4.Label("Dec",385,140,40,15)


; ========================= Trigger Type: ONCE
$fraTrigM5 = $frmTrig.Frame()
$fraTrigM5.Left = 15
$fraTrigM5.Top = 50
$fraTrigM5.Width = 460
$fraTrigM5.Height = 330
$fraTrigM5.Caption = "Run Once"


; ========================= Trigger Type: ON IDLE
$fraTrigM6 = $frmTrig.Frame()
$fraTrigM6.Left = 15
$fraTrigM6.Top = 50
$fraTrigM6.Width = 460
$fraTrigM6.Height = 330
$fraTrigM6.Caption = "Run When Idle"
$lblTrigM6Lb1 = $fraTrigM6.Label("When the computer is idle for",20,65,150,20)

; Minutes Idle value
$txtTrigM6INT = $fraTrigM6.TextBox()
$txtTrigM6INT.Left = 170
$txtTrigM6INT.Top = 62
$txtTrigM6INT.Width = 30
$txtTrigM6INT.Height = 20
$txtTrigM6INT.Caption = ""
$txtTrigM6INT.Enabled = 0

; Minutes Idle spinner
$spnTrigM6INT = $fraTrigM6.SpinButton("",200,62,20,20)
$spnTrigM6INT.Left = 200
$spnTrigM6INT.Top = 62
$spnTrigM6INT.Width = 20
$spnTrigM6INT.Height = 20
$spnTrigM6INT.Caption = ""
$spnTrigM6INT.Orientation = 1
$spnTrigM6INT.Min = 1
$spnTrigM6INT.Max = 60
$spnTrigM6INT.Value = 10
$txtTrigM6INT.Value = $spnTrigM6INT.Value
$spnTrigM6INT.OnChange = 'SpinChange("TrigM6INT")'


; ========================= Trigger Type: AT STARTUP
$fraTrigM7 = $frmTrig.Frame()
$fraTrigM7.Left = 15
$fraTrigM7.Top = 50
$fraTrigM7.Width = 460
$fraTrigM7.Height = 330
$fraTrigM7.Caption = "Run at Startup"

; simple message label
$lblTrigMsg7 = $fraTrigM7.Label()
$lblTrigMsg7.Left = 20
$lblTrigMsg7.Top = 180
$lblTrigMsg7.Width = 430
$lblTrigMsg7.Height = 20
$lblTrigMsg7.Caption = "No configurable options!"
$lblTrigMsg7.Alignment = 2
$lblTrigMsg7.FontBold = 1


; ========================= Trigger Type: AT LOGON
$fraTrigM8 = $frmTrig.Frame()
$fraTrigM8.Left = 15
$fraTrigM8.Top = 50
$fraTrigM8.Width = 460
$fraTrigM8.Height = 330
$fraTrigM8.Caption = "Run at User Logon"

; simple message label
$lblTrigMsg8 = $fraTrigM8.Label()
$lblTrigMsg8.Left = 20
$lblTrigMsg8.Top = 180
$lblTrigMsg8.Width = 430
$lblTrigMsg8.Height = 20
$lblTrigMsg8.Caption = "No configurable options!"
$lblTrigMsg8.Alignment = 2
$lblTrigMsg8.FontBold = 1


EndFunction


; QUERY SERVER =====================================================
; get an array of task event names from the designated server
; the EVENTS array is loaded and used until a new query is performed.
; This function is called
; A. When a new server name is entered
; B. When the QUERY button is clicked
; C. When a task is deleted (query server to insure deletion!)
; D. When a task is saved (uses opt Selected parameter to re-select
; and reload saved event
;
Function QueryServer(Optional $Selected)

Dim $TSK, $cnt

; Load EVENTS Array with task names
$EVENTS = tsGetTasks($txtHost.Value)

Select
; Error when we get a bad host name - complain and retry
Case @ERROR = 1
EMsg("Can't communicate with server!")
Exit 1

; If array is empty, no tasks exist. Set up to Add a new task
Case UBound($EVENTS) = -1 ; no tasks
EMsg("No tasks configured on remote server!")
ClrFrm()
$cboTask.Clear
$cboTask.AddItem("New_Task")
$cboTask.SetFocus
$cboTask.Text = "New_Task"
Exit @ERROR

EndSelect

; valid host, with tasks.. load the combo box
EMsg(" ^-- Query successful - select a task!")
ClrFrm()
$cboTask.Clear
$cboTask.AddItem("New_Task") ; start with New Task option
$cboTask.SetFocus
$Cnt = 1 ; Account for "New Task" at pos-0
For Each $TSK in $EVENTS
If $TSK <> ""
$cboTask.AddItem($TSK) ; add items returned from server
If $TSK = $Selected
$QueryServer = $Cnt
EndIf
$Cnt = $Cnt + 1 ; increment the position
EndIf
Next

EndFunction



; LOAD EVENT =======================================================
; Loads Task and Trigger arrays with data from a specified event on
; the target server. This is called each time a different event is
; selected from the combo-box, except for New Task.
;
Function LoadEvent(Optional $Paste)

Dim $RC, $iTID, $iX, $iT

$btnSVE.Enabled = 1 ; allow saving of loaded task
$btnSVA.Enabled = 1

If $Paste = ""
; If "New_Task", clear data fields
If $cboTask.Text = "New_Task"
ClrFrm(1)
$aryTask = tsInitTask() ; initialize default task & trig arrays
$aryTrig = tsInitTrigger()
EMsg('"RQ" indicates a REQUIRED field!')
If $T2Buffer = 1
$btnPST.Enabled = 1 ; Enable Paste if New_Task And $T2Buffer is set
EndIf
Else
$aryTask = tsInitTask(1)
$aryTrig = tsInitTrigger(1)
; get task data from server & display
tsGetEvent($txtHost.Value, $cboTask.Text, "aryTask", "aryTrig")
$btnPST.Enabled = 0 ; disable paste if not New_Task
EndIF
EndIF

$txtAPP.Value = $aryTask[0]
$txtPRM.Value = $aryTask[1]
$txtWKD.Value = $aryTask[2]
$txtCMT.Value = $aryTask[3]
$chkSUS.Value = Not(Val($aryTask[13]))
$txtUser.Value = $aryTask[20]
$aryTmp = Split($aryTask[7]," ",2)
$IdleWait = $aryTmp[0]
$IdleDeadline = $aryTmp[1]

; display the trigger settings
For $iX = 0 to 9
$RC = Execute('$$lblTR$iX.Value = TrigMsg($iX)')
Next

; enable the trigger edit buttons for each trigger defined.
; enable one more trigger edit button to allow new triggers to be
; added. Trigger 0 Edit button is always enabled.
$cmdTR0.Enabled = 1

For $iTID = 0 to 8
$iT = $iTID + 1
If $aryTrig[$iTID,10] = "T"
$RC = Execute("$$cmdTR" + $iT + ".Enabled = 1")
Else
$RC = Execute("$$cmdTR" + $iT + ".Enabled = 0")
EndIf
Next

; Enable Delete & Set Credentials buttons on active tasks
$btnDLE.Enabled = 1
$btnSEC.Enabled = 1
$btnSTA.Enabled = 1
$btnCPC.Enabled = 1

EndFunction



; SAVE EVENT =======================================================
; writes the contents of the current task and trigger arrays to the
; target server, activating the event. Confirms that the account
; credentials are defined. The newly written task is re-loaded and
; displayed.
;
Function SaveEvent(Optional $SAFlag)

Dim $sTaskName

$sTaskName = $cboTask.Text

Select
Case $txtUser.Value = ""
EMsg("Can't save task event with null UserName!")
Exit 1

Case $txtPass.Value = ""
EMsg("Can't save task event with null Password!")
Exit 1

Case $cboTask.Text = "New_Task"
If $txtAPP.Value = "RQ"
EMsg("Can't save incomplete task event!")
Exit 1
EndIf
; New task, so ask for task name
$sTaskName = $FrmMain.InputBox("Enter task name:")
$SAFlag = 0
EndSelect

If $SAFlag
$sTaskName = $FrmMain.InputBox("Enter task name:")
EndIF

If $sTaskName = ""
EMsg("Invalid task name!")
Exit 1
EndIf

; Copy form values & credentials into the task array
; the trigger array is updated when the subform closes
$aryTask[0] = $txtAPP.Value
$aryTask[1] = $txtPRM.Value
$aryTask[2] = $txtWKD.Value
$aryTask[3] = $txtCMT.Value
$aryTask[7] = $IdleWait + " " + $IdleDeadline
$aryTask[13] = cStr(Not($chkSUS.Value))

; Task array values 4-17 are updated when the Advanced Settings
; subform closes (future implementation)

$aryTask[20] = $txtUser.Value
$aryTask[21] = $txtPass.Value

tsActivateEvent($txtHost.Value, $sTaskName, "aryTask", "aryTrig")
If @ERROR = 0
EMsg("Successfully Saved!")
$Tag = QueryServer($sTaskName) ; reload the task list
$cboTask.ListIndex = $Tag
LoadEvent()
Else
EMsg("Save failed: " + @SERROR)
Exit 1
EndIf

EndFunction



; DELETE EVENT =====================================================
; Deletes the currently displayed event from the target server. The
; form is cleared, and the server re-queried.
;
Function DeleteEvent()

; call tsDeleteEvent
tsDeleteEvent($txtHost.Value, $cboTask.Text)

; clear the form
ClrFrm()

; Query Server for latest task list
QueryServer()

EndFunction


; SET CREDENTIALS ==================================================
; resets the credentials of the currently displayed event on the
; target server. No other changes of the event are sent to the remote
; server. Useful for changing the password of a remote event.
;
Function SetEventCredentials()

Select
Case $txtUser.Value = ""
EMsg("Can't set credentials with null UserName!")
Exit 1
Case $txtPass.Value = ""
EMsg("Can't set credentials with null Password!")
Exit 1
Case $cboTask.Text = "New_Task"
EMsg("Can't set credentials on undefined task!")
Exit 1
EndSelect

tsSetEventCredentials($txtHost.Value, $cboTask.Text, $txtUser.Value, $txtPass.Value)
If @ERROR = 0
EMsg("Set credentials succeeded!")
Else
EMsg("Set credentials failed!")
EndIf

EndFunction


; TRIGGER MSG ======================================================
; create a description of the trigger
;
Function TrigMsg($TID)

Dim $MSG, $TYP, $DURH, $DURM

; Only display info for valid triggers - deleted triggers will have
; element 10 set to "F"
If $aryTrig[$TID,10] <> "T"
Exit 0
EndIf

$MSG = ""

$TYP = $aryTrig[$TID,8]

; Process the simple TYPEs first
Select

Case $TYP = "ONCE"
$MSG = "At " + $aryTrig[$TID,2] + " on " + $aryTrig[$TID,0]

Case $TYP = "ONIDLE"
$MSG = "Run after idle for " + $IdleWait + " minutes."

Case $TYP = "ATSTARTUP"
$MSG = "Run at system startup"

Case $TYP = "ATLOGON"
$MSG = "Run at user logon"

EndSelect

If $MSG = "" ; MSG not defined, so need more thought

; MSG is either "At STime" or "Every M minutes from STime for Duration"
If $aryTrig[$TID,3] <> 0
$DURH = Val($aryTrig[$TID,3]) / 60
$DURM = Val($aryTrig[$TID,3]) Mod 60
$MSG = "Every " + $aryTrig[$TID,4] + " Minutes from " + $aryTrig[$TID,2]
$MSG = $MSG + " for " + $DURH + " hours"
If $DURM <> 0
$MSG = $MSG + " " + $DURM + " mins"
EndIf
$MSG = $MSG + ","
Else
$MSG = "At " + $aryTrig[$TID,2]
EndIF


; MSG then gets specific days/weeks/months
$P = Split($aryTrig[$TID,9],',',-1) ; split out the TYPEARGS

Select
Case $TYP = "DAILY"
If $p[0] = 1
$MSG = $MSG + " every day,"
Else
$MSG = $MSG + " every " + $P[0] + " days,"
EndIf

Case $TYP = "WEEKLY"
If $p[0] = 1
$MSG = $MSG + " every week on " + CvtDays($P[1])
Else
$MSG = $MSG + " every " + $P[0] + " weeks on " + CvtDays($P[1])
EndIf

Case $TYP = "MonthlyDate"
$MSG = $MSG + " on the " + $P[0] + " of " + CvtMonths($P[1])

Case $TYP = "MonthlyDOW"
$MSG = $MSG + " on the " + CvtWeeks($p[0]) + " " + CvtDays($P[1])+ " of every " + CvtMonths($P[2])

EndSelect


; MSG ends with "Starting on SDate" and optionally ends with "and ends EDate"


$MSG = $MSG + " starting on " + $aryTrig[$TID,0]


;If Left($aryTrig[$TID,1],5) <> '00/00'
If $aryTrig[$TID,5] = 1
$MSG = $MSG + ", and ending " + $aryTrig[$TID,1]
EndIF

EndIF

$TrigMsg = $MSG

EndFunction



; EDIT TRIGGER =====================================================
; Load the trigger values into the appropriate form/frame fields
;
Function EditTrigger($TID)

Dim $TYPE, $T, $HRS, $MIN, $DUR, $iX
Dim $M2DAYS[7]
Dim $M4DAYS[7]
Dim $M3MONS[13]
Dim $M4MONS[13]

$frmTrig.Show

$TYPE = $aryTrig[$TID,8]
$aryTypeArg = Split($aryTrig[$TID,9]+",,,",",",3)


; Load default values unless this trigger is undefined
If $aryTrig[$TID,10] = "T"
$cboTrigType.Text = $TYPE
Else
$cboTrigType.Text = "Daily"
$TYPE = "Daily"
EndIf

DisplayTrigType()
;=================================================================
; DAILY M1
$spnTrigM1INT.Value = $aryTypeArg[0]
$txtTrigM1INT.Value = $spnTrigM1INT.Value

;=================================================================
; WEEKLY M2

; Convert "umtwrfa" to array of BOOLs
If $Type = "Weekly"
For $iX = 0 to 6
If InStr("umtwrfa", SubStr($aryTypeArg[1], $iX + 1, 1)) > 0
$M2DAYS[$iX] = 1
Else
$M2DAYS[$iX] = 0
EndIf
Next
EndIf

; Create the frame fields
$lblTrigM2Lb1 = $fraTrigM2.Label("Every",25,65,30,20)
$lblTrigM2Lb2 = $fraTrigM2.Label("Week(s) on",115,65,70,20)

; DAYS INTERVAL
$spnTrigM2INT.Value = $aryTypeArg[0]
$txtTrigM2INT.Value = $spnTrigM2INT.Value

; set up the Days checkboxes
For $iX = 0 to 6
$RC = Execute('$$chkTrigM2WD$iX.Value = $M2DAYS[$iX]')
Next

;=================================================================
; MONTHLY DATE M3

If $Type = "MonthlyDate"
; Convert "janfebmar..." to array of BOOLs
For $iX = 1 to 12
If InStr($aryTypeArg[1], $aryMonths[$iX]) > 0
$M3MONS[$iX] = 1
Else
$M3MONS[$iX] = 0
EndIf
Next
EndIf

; DAY OF MONTH
$spnTrigM3INT.Value = $aryTypeArg[0]
$txtTrigM3INT.Value = $spnTrigM3INT.Value

; set up the Months checkboxes
For $iX = 1 to 12
$RC = Execute('$$chkTrigM3MO$iX.Value = $M3MONS[$iX]')
Next

;=================================================================
; MONTHLY DOW M4

If $Type = "MonthlyDOW"
; Convert "umtwrfa" to array of BOOLs
For $iX = 0 to 6
If InStr("umtwrfa", SubStr($aryTypeArg[1], $iX + 1, 1)) > 0
$M4DAYS[$iX] = 1
Else
$M4DAYS[$iX] = 0
EndIf
Next
; Convert "janfebmar..." to array of BOOLs
For $iX = 0 to 11
If InStr($aryTypeArg[2], $aryMonths[$iX]) > 0
$M4MONS[$iX] = 1
Else
$M4MONS[$iX] = 0
EndIf
Next
EndIf


; WEEK OF MONTH
$iX = Val($aryTypeArg[0])
$cboTrigM4WK.ListIndex = $iX - 1

; DAY OF THE WEEK
For $iX = 0 to 6
If $M4DAYS[$iX] = 1
$cboTrigM4DY.ListIndex = $iX
EndIf
Next


; set up the Months CheckBoxes
For $iX = 1 to 12
$RC = Execute('$$chkTrigM4MO$iX.Value = $M4MONS[$iX]')
Next

;=================================================================
; ON IDLE M6
; MINUTES IDLE
$spnTrigM6INT.Value = $IdleWait
$txtTrigM6INT.Value = $spnTrigM6INT.Value

;=================================================================
; START TIME S1
$txtTrigSTM.Value = $aryTrig[$TID,2]

;=================================================================
; START DATE S2
$txtTrigSDT.Value = $aryTrig[$TID,0]

;=================================================================
; END DATE S3
If $aryTrig[$TID,5] <> 0
$txtTrigEDT.Value = $aryTrig[$TID,1]
$chkTrigHED.Value = $aryTrig[$TID,5]
EndIF

;=================================================================
; REPEATS S4
If $aryTrig[$TID,3] > 0 And $aryTrig[$TID,4] > 0
$chkTrigRPT.Value = 1
EndIf

; REPEAT INTERVAL
$spnTrigINT.Value = $aryTrig[$TID,4]
$txtTrigINT.Value = $spnTrigINT.Value

$DUR = Val($aryTrig[$TID,3])
$HRS = $DUR / 60
$MIN = $DUR Mod 60

; REPEAT DURATION - HOURS
$spnTrigHRS.Value = $HRS
$txtTrigHRS.Value = $spnTrigHRS.Value

; REPEAT DURATION - MINUTES
$spnTrigMIN.Value = $MIN
$txtTrigMIN.Value = $spnTrigMIN.Value

$chkTrigKAD.Value = $aryTrig[$TID,6]

;=================================================================

$frmMain.TopMost = 0
$frmTrig.TopMost = 1
While $frmTrig.Visible And $FrmTrig.Tag = 1
$ = Execute($frmTrig.DoEvents())
$btnTr_END.Cancel = 1
Loop
$frmTrig.TopMost = 0
$frmMain.TopMost = 0


EndFunction



Function SaveTrigger($ID)
; Collect the data from the frame-fields, write it back to the arrays, & exit (hiding form)

Dim $svSTD, $svEDT, $svSTM, $svDUR, $svINT
Dim $svHED, $svKAD, $svDIS, $svTYP, $svARG
Dim $iX, $RC, $TV

$svTYP = $cboTrigType.Text
$svSTM = $txtTrigSTM.Value
$svSDT = $txtTrigSDT.Value
$svHED = $chkTrigHED.Value
If $svHED = 1
$svEDT = $txtTrigEDT.Value
Else
$svEDT = ""
$svHED = 0
EndIf
If $chkTrigRPT.Value = 1
$svDUR = (Val($txtTrigHRS.Value) * 60) + Val($txtTrigMIN.Value)
$svINT = $txtTrigINT.Value
$svKAD = $chkTrigKAD.Value
Else
$svDUR = 0
$svINT = 0
$svKAD = 0
EndIf

$svDIS = 0

$iOK = 1 ; Flag for checked values

Select
Case $svTYP = "Daily"
$svARG = $txtTrigM1INT.Value

Case $svTYP = "Weekly"
$iOK = 0 ; Flag for checked values
$svARG = $txtTrigM2INT.Value + ","
For $iX = 0 to 6
$RC = Execute('$$TV = $chkTrigM2WD' + $iX + '.Value')
If $TV = 1
$svARG = $svARG + $aryDCode[$iX]
$iOK = 1
Else
$svARG = $svARG + "."
EndIf
Next

Case $svTYP = "MonthlyDate"
$svARG = $txtTrigM3INT.Value + ","
For $iX = 1 to 12
$RC = Execute('$$TV = $chkTrigM3MO' + $iX + '.Value')
If $TV = 1
$svARG = $svARG + $aryMonths[$iX]
EndIf
Next

Case $svTYP = "MonthlyDOW"
$iOK = 0 ; Flag for checked values
; Start with the week index
$svARG = cStr($cboTrigM4WK.ListIndex + 1) + ","

; Build the DOW string
$iDOW = $cboTrigM4DY.ListIndex ; Which DOW?
$sTmp = "" ; clear string
For $iX = 0 to 6
If $iX = $iDOW ; match
$sTmp = $sTmp + $aryDCode[$iX]
Else
$sTmp = $sTmp + "."
EndIf
Next

; add it to the arg list
$svARG = $svARG + $sTmp + ","

; Add the month names
For $iX = 1 to 12
$RC = Execute('$$iV = $chkTrigM4MO$iX.Value')
If $iV = 1
$iOK = 1 ; got a Check!
$svARG = $svARG + $aryMonths[$iX]
EndIf
Next


Case $svTYP = "OnIdle"
; save to the $aryTask directly
$IdleWait = $txtTrigM6INT.Value

EndSelect

; Exit if at least one checkbox isn't selected..
If $iOK = 0
eMsg("Can't save! Must select at least 1 checkbox.")
Exit 1
EndIf

; debugging print statements...
;"Trigger ID: $ID" ?
;"Start Date: " + $svSDT ?
;" End Date: " + $svEDT ?
;"Start Time: " + $svSTM ?
;" Duration: " + $svDUR ?
;" Interval: " + $svINT ?
;"HasEndDate: " + $svHED ?
;" Kill@@Dur: " + $svKAD ?
;" Disabled: " + $svDIS ?
;" Type: " + $svTYP ?
;" Arguments: " + $svARG ?

$frmTrig.Hide

$aryTrig[$ID,0] = $svSDT
$aryTrig[$ID,1] = $svEDT
$aryTrig[$ID,2] = $svSTM
$aryTrig[$ID,3] = $svDUR
$aryTrig[$ID,4] = $svINT
$aryTrig[$ID,5] = $svHED
$aryTrig[$ID,6] = $svKAD
$aryTrig[$ID,7] = $svDIS
$aryTrig[$ID,8] = $svTYP
$aryTrig[$ID,9] = $svARG
$aryTrig[$ID,10] = "T"

; refresh the displayed description
$RC = Execute('$$lblTR' + $ID + '.Value = TrigMsg(' + $ID + ')')

; enable the trigger edit buttons for each trigger defined.
; enable one more trigger edit button to allow new triggers to be
; added. Trigger 0 Edit button is always enabled.
$cmdTR0.Enabled = 1

For $iTID = 0 to 8
$iT = $iTID + 1
If $aryTrig[$iTID,10] = "T"
$RC = Execute("$$cmdTR" + $iT + ".Enabled = 1")
Else
$RC = Execute("$$cmdTR" + $iT + ".Enabled = 0")
EndIf
Next

Exit 0

EndFunction


; DELETE TRIGGER ===================================================
; Delete the defined trigger
;
Function DeleteTrigger($TID)

; delete the trigger
$RC = tsDeleteTrigger($txtHost.Value, $cboTask.Text, $TID)
If @error = 0
EMsg("Trigger " + $TID + " deleted!")
$frmTrig.hide
LoadEvent() ; refresh the form window
Else
EMsg("Delete failed: @SError")
EndIF

EndFunction


Function DisplayTrigType()

Dim $iX, $RC, $TType

$TType = $cboTrigType.Text

; hide all MASTER frames
For $iX = 1 to 8
$RC = Execute('$$fraTrigM$iX.Hide')
Next

; hide all SUB frames
For $iX = 1 to 4
$RC = Execute('$$fraTrigS$iX.Hide')
Next



; define the view based on the TYPE value & load values from the array
Select
Case $TTYPE = "Daily"
$fraTrigM1.Show ; Daily
$fraTrigS1.Show ; Start Time
$fraTrigS2.Show ; Start Date
$fraTrigS3.Show ; End Date
$fraTrigS4.Show ; Repeats


Case $TTYPE = "Weekly"
$fraTrigM2.Show ; Weekly
$fraTrigS1.Show ; Start Time
$fraTrigS2.Show ; Start Date
$fraTrigS3.Show ; End Date
$fraTrigS4.Show ; Repeats


Case $TTYPE = "MonthlyDate"
$fraTrigM3.Show ; Monthly Date
$fraTrigS1.Show ; Start Time
$fraTrigS2.Show ; Start Date
$fraTrigS3.Show ; End Date
$fraTrigS4.Show ; Repeats


Case $TTYPE = "MonthlyDOW"
$fraTrigM4.Show ; Monthly DOW
$fraTrigS1.Show ; Start Time
$fraTrigS2.Show ; Start Date
$fraTrigS3.Show ; End Date
$fraTrigS4.Show ; Repeats


Case $TTYPE = "Once"
$fraTrigM5.Show ; Once
$fraTrigS1.Show ; Start Time
$fraTrigS2.Show ; Start Date
$fraTrigS4.Show ; Repeats


Case $TTYPE = "OnIdle"
; for XX minute(s)
$fraTrigM6.Show

Case $TTYPE = "AtStartup"
; no options
$fraTrigM7.Show

Case $TTYPE = "AtLogon"
; no options
$fraTrigM8.Show

EndSelect

EndFunction



; CONVERT DAYS =====================================================
; interprets the "umtwrfa" string, returning "Su,Mo,We,Th,Fr,Sa"
;
Function CvtDays($Val)

Dim $iX, $cD, $sTmp

$sTmp = ""
For $iX = 1 to 7
$cD = SubStr($Val,$iX,1)
If $cD <> "."
$sTmp = $sTmp + $aryDY[$iX - 1] + ","
EndIF
Next

; return the string, trimming the trailing ","
$CvtDays = Left($sTmp,Len($sTmp) - 1)

EndFunction


; CONVERT WEEKS ====================================================
; Converts numbers 1-5 to "first, second, third, fourth, last"
Function CvtWeeks($Val)

$CvtWeeks = $aryWeeks[$Val]

EndFunction



; CONVERT MONTHS ===================================================
; Converts "JANFEBMAR" to "Jan,Feb,Mar"
;
Function CvtMonths($Val)

Dim $sTmp, $iX

$sTmp = ""

For $iX = 1 to 12
If InStr($Val,$aryMonths[$iX]) <> 0
$sTmp = $sTmp + $aryMonths[$iX] + ","
EndIf
Next

; return the string, trimming the trailing ","
$CvtMonths = Left($sTmp,Len($sTmp) - 1)

EndFunction



; CLEAR FORM =======================================================
; clear the main form fields and the task list combo box
; If the optional flag is non-null, leave the combo-box loaded
;
Function ClrFrm(OPTIONAL $FLAG)

Dim $iX, $RC

; disable Delete and SetID butons when no event is loaded
$btnDLE.Enabled = 0
$btnSEC.Enabled = 0
$btnSTA.Enabled = 0
$btnCPC.Enabled = 0

; Clear the data fields
$txtAPP.Value = ""
$txtPRM.Value = ""
$txtWKD.Value = ""
$txtCMT.Value = ""

; Clear the 10 trigger definitions & hide the edit buttons
For $iX = 0 to 9
$RC = Execute('$$lblTR' + $iX + '.Value = ""')
$RC = Execute('$$cmdTR' + $iX + '.Enabled = 0')
Next

; Return if the FLAG is set
If $FLAG <> ""
Exit 0
EnfIf

; otherwise clear task list and disable the Save button
$cboTask.Clear
$btnSVE.Enabled = 0
$btnSVA.Enabled = 0

EndFunction



; STATUS MESSAGE ===================================================
; Display an informational, status, or error message on the form
; The message flashes, then remains visible for 2 seconds
;
Function EMsg($MSG)

; Beep & Flash the message, then display it for 2 seconds
Beep
$lblTMsg.Value = $MSG
Sleep(0.2)
$lblTMsg.Value = ""
Sleep(0.2)
$lblTMsg.Value = $MSG
$ETimer = $frmMain.Timer()
$ETimer.Interval = 2000
$ETimer.OnTimer = "EMsgClr()"

EndFunction

; clears the message when the timer expires.
; used only by the EMsg function
;
Function EMsgClr()

$lblTMsg.Value = ""

EndFunction



Function SpinChange($ID)
; generic control of spinners to update the text fields
Dim $RV, $RC
$RC = Execute('$$RV = spn$ID.Value')
$RV = '$$' + $RV
$RC = Execute('$$txt$ID.Value = $RV')
EndFunction

Function ShowStatus()
; MostRecentRun,NextRun,StartError,ExitCode, and Status.
Dim $sStatus

$sStatus = "Most Recent Run: " + $aryTask[22] + @CRLF
$sStatus = $sStatus + " Next Run: " + $aryTask[23] + @CRLF
$sStatus = $sStatus + " Start Error: " + $aryTask[24] + @CRLF
$sStatus = $sStatus + " Exit Code: " + $aryTask[25] + @CRLF
$sStatus = $sStatus + " Status: " + $aryTask[26]

$RC = $frmMain.MsgBox($sStatus, "Task Status", 64)

EndFunction


Function CpyClr()

Global $aryTask2, $aryTrig2

If $T2Buffer = 0
$aryTask2 = $aryTask ; copy the arrays
$aryTrig2 = $aryTrig
$btnCPC.Caption = "Clear" ; change the button name
$T2Buffer = 1 ; set the flag
$btnPST.Enabled = 1
Else
$T2Buffer = 0 ; clear the flag
$btnCPC.Caption = "Copy" ; change the button name
$btnPST.Enabled = 0
EndIF

EndFunction

Function Paste()

$aryTrig = $aryTrig2
$aryTask = $aryTask2
LoadEvent(1)

EndFunction;;

;
Function Include($LibFile, OPTIONAL $SoftErr)

; define a comma-separated list of allowed library file extensions
$Extensions = ".udf, .kxf"

; define the locations where the UDFs are maintained
; default is C:\usr\lib, then %KIXLIBPATH%, then script-start directory
$PATHS = "%SystemDrive%\usr\lib\", "%KixLibPath%\", "@ScriptDir\"

; use split to insure array format, even with one extension name
$EXTS = Split($Extensions, ",")
For Each $PATH in $PATHS
For Each $EXT in $EXTS
If Exist($PATH + $LibFile + Trim($EXT))
$LoadPath = $PATH + $LibFile + Trim($EXT)
Call $LoadPAth
Exit 0
EndIf
Next
Next

; Lib not found! Return error if SoftErr is set or DIE!
If $SoftErr
Exit 1
Else
"Failed to load required library: " + $LibFile + " - Aborting!"


Last edited by gbarnas on Wed Dec 02, 2009 12:32 am; edited 15 times in total
Back to top
View user's profile Send private message Visit poster's website
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Fri Mar 07, 2003 9:22 pm    Post subject: Reply with quote

Nice job. However, just to be a pain in the @#$, can you also post it into the COM Fourm of KiXtart.org ?
Back to top
View user's profile Send private message Send e-mail MSN Messenger
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Sat Mar 08, 2003 3:03 am    Post subject: Reply with quote

Well, maybe if you ask nicely Wink

Actually, right after I posted this, I found a small problem. When the task on the remote computer is corrupt, the functions return a null array, and the TSADM exits without a failure message. I've modified the error handling in the tsControl and added an error handler in TSADM. Both are very minor changes and are only affected by tasks that JT indicates are corrupt. I'll post the updated code here and on the Kix BB tomorrow.

Glenn
Back to top
View user's profile Send private message Visit poster's website
Radimus
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 157
Location: Tampa, Florida

PostPosted: Sun Mar 09, 2003 3:43 am    Post subject: Reply with quote

If you would package up the entire code and dependencies into a zip (and perhaps a screenshot) either Doc or I can host it for you... makes it a bunch easier than trying to collect the 2 novellas that make up this script.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Sun Mar 09, 2003 2:06 pm    Post subject: WOW! Reply with quote

Thanks! I'll definately take you up on that!

I have a dynamic address at home and can't maintain it there, and certainly couldn't host it on a government server at work.. (at least while remaining employed Very Happy )

I've added a couple of features that I thought would be in a later release, but found they were much easier to impelment than I thought. I'm doing some final testing, adding ToolTip info, and will create a Word doc tonight. Then I'll zip them up and let you know when it's ready.

Um, "novellas"? I should dig up the 140K unix shell script from a few years ago! It was the Readers Digest version of War and Peace! Laughing

Thanks again!

Glenn
Back to top
View user's profile Send private message Visit poster's website
Rod
KiXforms Webmaster
KiXforms Webmaster


Joined: 22 Feb 2003
Posts: 202
Location: United Kingdom

PostPosted: Sun Mar 09, 2003 2:43 pm    Post subject: Reply with quote

First of all, well done Glenn, this is a very impressive achievement. Second, do you have an issue if I post your script in the KiXforms Script Archive with all of it's dependencies included in a ZIP file as per Rad's suggestion? If not, my only concern is whether there would be any licensing problems if I also include Microsoft's jt.exe (license_jt.txt file) in the ZIP file?

I also have couple of suggestions if it is packaged it up into a single ZIP file, how about changing:

Code:
; Load any needed functions
Call %SYSTEMDRIVE%\usr\lib\tscontrol.kxf


to ...

Code:
; Load any needed functions
Call @SCRIPTDIR\tscontrol.kxf


and in tscontrol.kxf, replacing all occurrences of:

Code:
%SYSTEMDRIVE%\TEMP\


with ...

Code:
%TEMP%\


as on my machine I did not have a C:\TEMP directory which caused the script to fail. With these mods it should run out of the box. Wink

Rod.

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Sun Mar 09, 2003 10:52 pm    Post subject: Reply with quote

Thanks..

Posting everything together wuold make a lot of sense. It would let me include the docs files that caused so much consternation on the Kix board. (I never did post the complete docs, and rewrote much in HTML). I doubt there would be any issues about including the entire JT.ZIP file within the TSadm.zip, since JT.ZIP is as it comes from MS and is freely available.

I can change the %TEMP% easily enough.. all of our systems have \TEMP directories, and with 12 admins, it's easier to just clean one folder. tsAdm cleans up after itself so there's no issue using "dem stink'n" personal temp directories. (can ya tell I'm not partial to them?)

I have a (small) issue with changing the call statement to load the lib from the same directory as the script. I'm not sure about the Kix community, but I've always had code libraries separate from the executables, even on Unix scripts. We maintain this library folder on our systems, so I'd need to maintain two copies of the code. Any alternatives come to mind? I can, of course, check 2-3 "standard" locations, like "/usr/lib", %KIXLIBPATH%, and then @SCRIPTDIR to locate the lib file.

Finally, If I zip the code, how can I maintain it without being a bother? Is there some way I could push the ZIP up when updates occur? Also, would a copy of the code remain on the board (visually) to serve as a reference?

Thanks -

Glenn
Back to top
View user's profile Send private message Visit poster's website
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Sun Mar 09, 2003 11:17 pm    Post subject: Reply with quote

I think the problem with the .DOC documentaton on KORG was the fact that the boards cannot display the documentation in it's native format. I would also include the DOC file in the package. Microsoft Word documents compress very nicely with all the fluff thats inherent in the .DOC format.

I have to agree on the %TEMP% issue. By using this variable you are pretty much assured that the user running the script can actually write to the assigned TEMP directory.

With regards to the library load, I would also have it loaded by default form @SCRIPTDIR. However, I would put a comment into the line reminding the user to adapt it to his/her environment. By default, users will just unzip the package and run the script. In that case the library is in the same directory as the script and the user gets instant success.

However, I also have my UDF libraries in a separate directory with different library files according to purpose, similar to the C++ header files.

_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Mon Mar 10, 2003 2:47 am    Post subject: Reply with quote

My .DOC frustration came from MS Word creating overly complex HTML. Jeez, I wanted a simple web-doc, and the resulting html was 50% larger than the original document!

I'm on-board with %TEMP%, but still gonna think about the lib thing.. too tired after a day of skiing to do anything more tonight. Smile

Glenn
Back to top
View user's profile Send private message Visit poster's website
Sealeopard
KiXforms Aficionado
KiXforms Aficionado


Joined: 05 Mar 2003
Posts: 436
Location: Boston, MA

PostPosted: Mon Mar 10, 2003 1:13 pm    Post subject: Reply with quote

The reason for Word behaving like this is that they try to mimick the original document as closely as possible. That's why you end up with onflated HTML code. Most fo the time it's much easier to just copy/past a Word document into an HTML editor and reformatting it yourself or to use another DOC-2-HTML converter. However, none of these, AFAIK, are available for free.
_________________
Jens

'There are two kinds of vessels, submarines and targets.'
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Lonkero
KiXforms Devotee
KiXforms Devotee


Joined: 13 Mar 2003
Posts: 1022
Location: Espoo, Finland

PostPosted: Thu Mar 13, 2003 12:53 pm    Post subject: Reply with quote

actually, there are some free doc2html converters.
the best ones are costly but the GNU codes work just fine...
well, on most of the documents.
as example, kixtart.doc does not translate perfectly... might be that the rtf-layer word uses is not standard.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Sun Jan 11, 2004 12:29 am    Post subject: Updated code available Reply with quote

2004/01/10 - Added screenshot images, link to latest code.

Glenn
Back to top
View user's profile Send private message Visit poster's website
Rod
KiXforms Webmaster
KiXforms Webmaster


Joined: 22 Feb 2003
Posts: 202
Location: United Kingdom

PostPosted: Sun Jan 11, 2004 5:48 pm    Post subject: Reply with quote

Please note that I have also updated the tstools ZIP file, stored in the Script Archive, to the latest version.

Rod.

_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sptomey
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 18 Mar 2003
Posts: 158

PostPosted: Sun Jan 11, 2004 7:58 pm    Post subject: Reply with quote

If you have office 2K on windows 2K you can download the below HTML Filter for office. IIRC it reduced the size of saved HTML files a great deal.

http://www.microsoft.com/downloads/details.aspx?FamilyID=209adbee-3fbd-482c-83b0-96fb79b74ded&DisplayLang=en

_________________
-Shane
Back to top
View user's profile Send private message MSN Messenger
gbarnas
KiXforms Regular
KiXforms Regular


Joined: 07 Mar 2003
Posts: 41
Location: Mahwah, NJ

PostPosted: Fri Oct 14, 2005 2:58 pm    Post subject: New version released Reply with quote

A new version was released - please see the updates in the beginning of the post.

Glenn
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Script Archive All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group