Page 1 of 1 1
Topic Options
#167527 - 2006-09-12 05:18 PM Brand New to KiXtart and KiXForms First Post
abaldwin Offline
Fresh Scripter

Registered: 2006-09-12
Posts: 7
I am having two issues with the script below. This is my first script so please be gentle. I am using KiXforms to create the form and then modified the script from there.
Issue 1. The script runs fine on my machine but when I set another user to execute the same script at login he gets the following error
Quote:

Unexpected command FormLogin.kix Line 14




Here are lines 1 - 24

Code:
Break On
$System = CreateObject("Kixtart.System")

$Form = CreateObject("Kixtart.Form")
;If Not $System
; $= MessageBox("Script Processor Not Initiated. This Script Will Now Install it for you.","Error",16)
; InstKixForms()
;EndIf

;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.ControlBox = "False"
$Form.Height = 361
$Form.Left = 216
$Form.MaximizeBox = "False"
$Form.MinimizeBox = "False"
$Form.Text = "Welcome to the DCT Domain"
$Form.Top = 95
$Form.TopMost = "True"
$Form.Width = 663
;**************************************



After getting this part to work on other machines I know that I need to modify my MapDrives Function but I will do that later.

Issue 2. I can not find any examples here or other places that would allow me to replace one of my labels with a control and the script that would allow me to load the contents of an RTF fiel . Basically this login script welcomes the user and will list some basic rules of our network. If they hit the accept button the script contines to map drives and ends. If they reject it then as youc an see I have an attempt to reboot their machines.

Here is the entire script, Many thanks to others who have posted scripts that I was able to derive this from.



Code:
 Break On
$System = CreateObject("Kixtart.System")

$Form = CreateObject("Kixtart.Form")
;If Not $System
; $= MessageBox("Script Processor Not Initiated. This Script Will Now Install it for you.","Error",16)
; InstKixForms()
;EndIf

;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.ControlBox = "False"
$Form.Height = 361
$Form.Left = 216
$Form.MaximizeBox = "False"
$Form.MinimizeBox = "False"
$Form.Text = "Welcome to the DCT Domain"
$Form.Top = 95
$Form.TopMost = "True"
$Form.Width = 663
;**************************************

;************* picLogo **************
$picLogo = $Form.Controls.PictureBox()
$picLogo.BackColor = 212,208,200
$picLogo.BorderStyle = 0
$picLogo.Height = 105
$picLogo.Left = 0
$picLogo.Picture = "itw.bmp"
$picLogo.Top = 0
$picLogo.Width = 655
;**************************************

;************* Label1 **************
$Label1 = $Form.Controls.Label()
$Label1.BackColor = 212,208,200
$Label1.FontBold = "True"
$Label1.FontName = "Tahoma"
$Label1.FontSize = 10
$Label1.Height = 51
$Label1.Left = 0
$Label1.Text = "This network is intended blah blah blah"
$Label1.Top = 135
$Label1.Width = 656
;**************************************

;************* Label2 **************
$Label2 = $Form.Controls.Label()
$Label2.BackColor = 212,208,200
$Label2.FontBold = "True"
$Label2.FontName = "Tahoma"
$Label2.FontSize = 10
$Label2.Height = 33
$Label2.Left = 0
$Label2.Text = "By clicking below and continuing to sign in you accept the terms of the network useage policy."
$Label2.Top = 195
$Label2.Width = 658
;**************************************

;************* cmdAccept **************
$cmdAccept = $Form.Controls.Button()
$cmdAccept.Height = 23
$cmdAccept.Left = 60
$cmdAccept.Text = "Accept Terms"
$cmdAccept.Top = 270
$cmdAccept.Width = 150
$cmdAccept.OnClick = "cmdAccept_Click()"
;**************************************

;************* cmdDecline **************
$cmdDecline = $Form.Controls.Button()
$cmdDecline.Height = 23
$cmdDecline.Left = 450
$cmdDecline.Text = "Decline"
$cmdDecline.Top = 270
$cmdDecline.Width = 150
$cmdDecline.OnClick = "cmdDecline_Click()"
;**************************************

;************* lblName **************
$lblName = $Form.Controls.Label()
$lblName.BackColor = 212,208,200
$lblName.FontBold = "True"
$lblName.FontName = "Tahoma"
$lblName.FontSize = 10
$lblName.Height = 25
$lblName.Left = 0
$lblName.Text = ""
$lblName.Top = 105
$lblName.Width = 483
;**************************************


;KD END
$Form.Center
$Form.show

;Startup

While $Form.Visible
$lblName.text = "Hello " + @FULLNAME + " Welcome to " + @LDOMAIN
$=Execute($Form.DoEvents())
Loop
Exit 1

;****************************************************************
;Functions
;****************************************************************

Function cmdDecline_Click()
;User did not accept the terms
use "*" /delete
if INSTR(@PRODUCTTYPE,"Server") or INSTR(@PRODUCTTYPE,"XP") or INSTR(@PRODUCTTYPE,"2000")
SHUTDOWN("","User did not accept the Terms, Shutting down.",5,1,1)
else
SHELL "%windir%\RUNDLL32.EXE user.exe,EXITWINDOWS"
endif



EndFunction

Function cmdAccept_Click()
use "*" /delete
MapDrives()
Quit 5

EndFunction

Function MapDrives()
If InGroup("Domain Admins")
use h: "\\nb-resources\sales_data"
use s: "\\macolasql\macapps"
use n: "\\dctfs\dli_std1"
use p: "\\nb-resources\data"
use u: "\\nb-resources\OrderScan"
use z: "\\nb-resources\IS_Division"
EndIf
EndFunction

Function InstKixForms
; Install KixForm.dll and Register the dll
If Not Exist ("%windir%\KixForms.dll")
COPY "@LSERVER\NETLOGON\KixStart\KIXFORMS.DLL" "%Windir%"
SHELL "REGSVR32 /S %WinDir%\KIXFORMS.DLL"
EndIf
EndFunction



Top
#167528 - 2006-09-12 05:56 PM Re: Brand New to KiXtart and KiXForms First Post
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
About Issue 1:
The kixforms.dll is not registered on the other computers. Maybe you can think about distributing the kixforms.msi installer that you can download at http://www.kixforms.org/forum/viewtopic.php?p=3346&sid=c0c58c38a1ec5a5edbe06c7672e75a0d via a group policy in active directory.
To (install and) register a dll, administrative rights are needed.

Top
#167529 - 2006-09-12 09:18 PM Re: Brand New to KiXtart and KiXForms First Post
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
As to issue 2:
Really should move the discussion to http://www.KiXforms.org
The easy answer is that you hide your label, then create the RTF text box and load your file into it.

Top
#167530 - 2006-09-13 12:00 AM Re: Brand New to KiXtart and KiXForms First Post
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If I understand your second issue, you want to create a RichTextBox and put the content of a RTF into it.
Google helps finding the syntax for RichTextBox on kixforms.org.
Here is an example of a little form I created
Code:

If NOT @LOGONMODE
Break On
EndIf
Dim $SO
$SO = SetOption("Explicit","On")
$SO = SetOption("NoMacrosInStrings","On")
$SO = SetOption("NoVarsInStrings","On")
$SO = SetOption("WrapAtEOL","On")

Dim $File, $System, $Form, $RichTextBox1, $
$File = @SCRIPTDIR + "\YourFile.txt"

$System = CreateObject("Kixtart.System")

;KD START

$Form = $System.Form()
$Form.FontSize = 8,25
$Form.Left = 22
$Form.Text = "KiXforms Designer Template"
$Form.Top = 29
$RichTextBox1 = $Form.Controls.RichTextBox()
$RichTextBox1.AcceptsTab = "False"
$RichTextBox1.BorderStyle = 2
$RichTextBox1.FontSize = 8,25
$RichTextBox1.Height = 230
$RichTextBox1.HideSelection = "True"
$RichTextBox1.Left = 15
$RichTextBox1.MaxLength = 2147483647
$RichTextBox1.Multiline = "True"
$RichTextBox1.ReadOnly = "True"
$RichTextBox1.ScrollBars = 3
$RichTextBox1.TabStop = "True"
$RichTextBox1.Top = 15
$RichTextBox1.Width = 262
$RichTextBox1.WordWrap = "True"
$RichTextBox1.LoadFile($File, 0) ;0 = RichText, 1 = PlainText

;KD END

$Form.Show
While $Form.Visible
$=Execute($Form.DoEvents())
Loop
Exit 1


Top
#167531 - 2006-09-13 02:32 PM Re: Brand New to KiXtart and KiXForms First Post
abaldwin Offline
Fresh Scripter

Registered: 2006-09-12
Posts: 7
Thanks for the help.
Slightly embarrassing as to the install problem. The code above clearly has the code remarked out where the error checking and installation of the dll would have taken place.

I just could not find any help on getting a text file to load into a rich text control. The example above should get exactly what I need.

Thanks

Top
#167532 - 2006-09-13 03:33 PM Re: Brand New to KiXtart and KiXForms First Post
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
If this is for a logon script, and the users do not have administrative rights on their computers (which is IMHO most likely AND most advisable), they will not be able to copy and register the dll.
You could consider p.e. to distribute and install the dll via a group policy in active directory.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1046 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.053 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org