Page 1 of 1 1
Topic Options
#187573 - 2008-05-12 08:21 PM KIXFORMS Issue - Making script wait for user to press button
VTC Offline
Fresh Scripter

Registered: 2008-04-17
Posts: 26
Loc: Alexandria, Virginia
I need some help here with kixforms. How do I make the script wait for a button to be pressed. My problem is that it continues on through the script after the point where i need a user to input data.
Top
#187574 - 2008-05-12 09:50 PM Re: KIXFORMS Issue - Making script wait for user to press button [Re: VTC]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
You would be better off asking at http://www.kixforms.org (KFORG).

That said, it is really depedent on how you have your code structured.

If you can post your code we probably could help out much more.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#187579 - 2008-05-13 02:45 AM Re: KIXFORMS Issue - Making script wait for user to press button [Re: Gargoyle]
VTC Offline
Fresh Scripter

Registered: 2008-04-17
Posts: 26
Loc: Alexandria, Virginia
 Code:
;*************************************************************
;*************** LOGIN SCRIPT GUI ****************************
;Created by Jeremy Cejka
;Last Updated on 05/12/2008
;*************************************************************

Break On

SetConsole("Hide")
$System = CreateObject("Kixtart.System")

;----------------------------------------
; *************GUI BUILD****************
;----------------------------------------

;KD START

$Form = $System.Form()
$Form.BackColor = 255,255,255
$Form.Height = 520
$Form.Left = 500
$Form.Text = "KiXforms Designer Template"
$Form.Top = 52
$Form.Width = 575
$PictureBox1 = $Form.Controls.PictureBox()
$PictureBox1.BackColor = 255,255,255
$PictureBox1.BorderStyle = 0
$PictureBox1.Height = 120
$PictureBox1.Left = 0
$PictureBox1.Picture = "\\server\pic.bmp
$PictureBox1.Top = 0
$PictureBox1.Width = 630
$GroupBox4 = $Form.Controls.GroupBox()
$GroupBox4.BackColor = 255,255,255
$GroupBox4.Enabled = "False"
$GroupBox4.FlatStyle = 0
$GroupBox4.Height = 77
$GroupBox4.Left = 10
$GroupBox4.Text = ""
$GroupBox4.Top = 125
$GroupBox4.Width = 546
$WelcomeLabel = $GroupBox4.Controls.TextBox()
$WelcomeLabel.FontSize = 10
$WelcomeLabel.Height = 61
$WelcomeLabel.Left = 10
$WelcomeLabel.Multiline = "True"
$WelcomeLabel.ReadOnly = "True"
$WelcomeLabel.Text = ""
$WelcomeLabel.TextAlign = 2
$WelcomeLabel.Top = 10
$WelcomeLabel.Width = 528
$ProcessTreeBox = $Form.Controls.GroupBox()
$ProcessTreeBox.BackColor = 255,255,255
$ProcessTreeBox.Enabled = "False"
$ProcessTreeBox.Height = 280
$ProcessTreeBox.Left = 10
$ProcessTreeBox.Text = "Logon Script Process Tree"
$ProcessTreeBox.Top = 205
$ProcessTreeBox.Width = 155
$WelcomeChkBox = $ProcessTreeBox.Controls.CheckBox()
$WelcomeChkBox.BackColor = 255,255,255
$WelcomeChkBox.CheckAlign = 16
$WelcomeChkBox.Height = 20
$WelcomeChkBox.Left = 10
$WelcomeChkBox.Text = "Welcome"
$WelcomeChkBox.Top = 20
$WelcomeChkBox.Width = 135
$UserInfoChkBox = $ProcessTreeBox.Controls.CheckBox()
$UserInfoChkBox.BackColor = 255,255,255
$UserInfoChkBox.CheckAlign = 16
$UserInfoChkBox.Height = 20
$UserInfoChkBox.Left = 10
$UserInfoChkBox.Text = "User Information"
$UserInfoChkBox.Top = 45
$UserInfoChkBox.Width = 135
$OCSChkBox = $ProcessTreeBox.Controls.CheckBox()
$OCSChkBox.BackColor = 255,255,255
$OCSChkBox.CheckAlign = 16
$OCSChkBox.Height = 20
$OCSChkBox.Left = 10
$OCSChkBox.Text = "OCS Inventory"
$OCSChkBox.Top = 70
$OCSChkBox.Width = 135
$TimeChkBox = $ProcessTreeBox.Controls.CheckBox()
$TimeChkBox.BackColor = 255,255,255
$TimeChkBox.CheckAlign = 16
$TimeChkBox.Height = 20
$TimeChkBox.Left = 10
$TimeChkBox.TabStop = "False"
$TimeChkBox.Text = "Time Syncronization"
$TimeChkBox.Top = 95
$TimeChkBox.Width = 135
$DNSChkBox = $ProcessTreeBox.Controls.CheckBox()
$DNSChkBox.BackColor = 255,255,255
$DNSChkBox.CheckAlign = 16
$DNSChkBox.Height = 20
$DNSChkBox.Left = 10
$DNSChkBox.TabStop = "False"
$DNSChkBox.Text = "Disable DNS Cache"
$DNSChkBox.Top = 120
$DNSChkBox.Width = 135
$PrinterChkBox = $ProcessTreeBox.Controls.CheckBox()
$PrinterChkBox.BackColor = 255,255,255
$PrinterChkBox.CheckAlign = 16
$PrinterChkBox.Height = 20
$PrinterChkBox.Left = 10
$PrinterChkBox.Text = "Map Printers"
$PrinterChkBox.Top = 170
$PrinterChkBox.Width = 135
$NShareChkBox = $ProcessTreeBox.Controls.CheckBox()
$NShareChkBox.BackColor = 255,255,255
$NShareChkBox.CheckAlign = 16
$NShareChkBox.Height = 20
$NShareChkBox.Left = 10
$NShareChkBox.TabStop = "False"
$NShareChkBox.Text = "Map Share Drives"
$NShareChkBox.Top = 145
$NShareChkBox.Width = 135
$OutlookChkBox = $ProcessTreeBox.Controls.CheckBox()
$OutlookChkBox.BackColor = 255,255,255
$OutlookChkBox.CheckAlign = 16
$OutlookChkBox.Height = 20
$OutlookChkBox.Left = 10
$OutlookChkBox.Text = "Outlook Setup"
$OutlookChkBox.Top = 220
$OutlookChkBox.Width = 135
$ScreenSaverChkBox = $ProcessTreeBox.Controls.CheckBox()
$ScreenSaverChkBox.BackColor = 255,255,255
$ScreenSaverChkBox.CheckAlign = 16
$ScreenSaverChkBox.Height = 20
$ScreenSaverChkBox.Left = 10
$ScreenSaverChkBox.Text = "Screen Saver"
$ScreenSaverChkBox.Top = 195
$ScreenSaverChkBox.Width = 135
$LogChkBox = $ProcessTreeBox.Controls.CheckBox()
$LogChkBox.BackColor = 255,255,255
$LogChkBox.CheckAlign = 16
$LogChkBox.Height = 20
$LogChkBox.Left = 10
$LogChkBox.TabStop = "False"
$LogChkBox.Text = "Log Created"
$LogChkBox.Top = 245
$LogChkBox.Width = 135
$GroupBox2 = $Form.Controls.GroupBox()
$GroupBox2.BackColor = 255,255,255
$GroupBox2.Height = 281
$GroupBox2.Left = 170
$GroupBox2.Text = "Command Line Dialog"
$GroupBox2.Top = 205
$GroupBox2.Width = 385
$cmdText = $GroupBox2.Controls.TextBox()
$cmdText.Height = 256
$cmdText.Left = 5
$cmdText.Multiline = "True"
$cmdText.ScrollBars = 1
$cmdText.Text = ""
$cmdText.Top = 20
$cmdText.Width = 372
$Outlook = $Form.Controls.GroupBox()
$Outlook.BackColor = 255,255,255
$Outlook.Height = 231
$Outlook.Left = 10
$Outlook.Text = "Outlook Setup"
$Outlook.Top = 490
$Outlook.Visible = "False"
$Outlook.Width = 539
$TextBox3 = $Outlook.Controls.TextBox()
$TextBox3.FontSize = 10
$TextBox3.Height = 59
$TextBox3.Left = 10
$TextBox3.Multiline = "True"
$TextBox3.ReadOnly = "True"
$TextBox3.Text = "Welcome to the Automated Outlook Setup Wizard.  If your outlook has already been configured and is operational, please press CANCEL.  If you wish to contiunue with the setup, please enter your Domain Password and then press SETUP."
$TextBox3.TextAlign = 2
$TextBox3.Top = 15
$TextBox3.Width = 521
$EmailSetup = $Outlook.Controls.TextBox()
$EmailSetup.BorderStyle = 0
$EmailSetup.Height = 72
$EmailSetup.Left = 165
$EmailSetup.Multiline = "True"
$EmailSetup.ReadOnly = "True"
$EmailSetup.Text = ""
$EmailSetup.TextAlign = 1
$EmailSetup.Top = 90
$EmailSetup.Width = 115
$EmailDisplay = $Outlook.Controls.TextBox()
$EmailDisplay.BorderStyle = 0
$EmailDisplay.Height = 72
$EmailDisplay.Left = 285
$EmailDisplay.Multiline = "True"
$EmailDisplay.ReadOnly = "True"
$EmailDisplay.Text = ""
$EmailDisplay.Top = 90
$EmailDisplay.Width = 115
$Label2 = $Outlook.Controls.Label()
$Label2.BackColor = 255,255,255
$Label2.FontUnderline = "True"
$Label2.Height = 14
$Label2.Left = 240
$Label2.Text = "Outlook Setup"
$Label2.Top = 75
$Label2.Width = 92
$TextBox6 = $Outlook.Controls.TextBox()
$TextBox6.BorderStyle = 0
$TextBox6.Height = 13
$TextBox6.Left = 165
$TextBox6.ReadOnly = "True"
$TextBox6.Text = "Domain Password:"
$TextBox6.TextAlign = 1
$TextBox6.Top = 165
$TextBox6.Width = 114
$OutlookPwdText = $Outlook.Controls.TextBox()
$OutlookPwdText.Height = 20
$OutlookPwdText.Left = 285
$OutlookPwdText.PasswordChar = "*"
$OutlookPwdText.Text = ""
$OutlookPwdText.Top = 162
$OutlookPwdText.Width = 115
$setup = $Outlook.Controls.Button()
$setup.DialogResult = 0
$setup.Height = 25
$setup.Left = 180
$setup.Text = "SETUP"
$setup.Top = 195
$setup.Width = 100
$setup.OnClick = "click_setup()"
$Button3 = $Outlook.Controls.Button()
$Button3.DialogResult = 0
$Button3.Height = 24
$Button3.Left = 285
$Button3.Text = "CANCEL"
$Button3.Top = 195
$Button3.Width = 99
$Button3.OnClick = "cmd_click()"

;KD END

$Form.Show

;------------------------------------------------------
;********************* Welcome *******************
;------------------------------------------------------ 
:Welcome


	$WelcomeLabel.AppendText("Welcome "+ @FULLNAME+" to the "+@DOMAIN+" domain." +@CRLF) 
	$WelcomeLabel.AppendText("Today is " + @DAY + ", " + @MONTH + " " + @MDAYNO + ", "+ @YEAR+"."+ @CRLF) 
	$WelcomeLabel.AppendText("The time is currently "+@TIME+".") 
	$WelcomeChkBox.Checked = "True" 
	$WelcomeChkBox.Enabled = "False" Sleep 0.1
	
	$cmdText.AppendText("***USER INFO***" +@CRLF)
	$cmdText.AppendText("Username	: " + @USERID + @CRLF) Sleep 0.25
	$cmdText.AppendText("FullName		: " + @FULLNAME + @CRLF) Sleep 0.25 
	$cmdText.AppendText("Privilage    	: " + @PRIV+ + @CRLF) Sleep 0.25 
	$cmdText.AppendText("Workstation  	: " + @WKSTA + @CRLF) Sleep 0.25   
	$cmdText.AppendText("Domain       	: " + @DOMAIN + @CRLF) Sleep 0.25
	$cmdText.AppendText("Logon Server 	: " + @LSERVER + @CRLF) Sleep 0.25
	$cmdText.AppendText("Current Time	: " + @TIME + @CRLF)
	$UserInfoChkBox.Checked = "True" 
	$UserInfochkBox.Enabled = "False" Sleep 0.1

;------------------------------------------------------
;********************* OCS Inventory ******************
;------------------------------------------------------ 
:OCS

	$cmdText.AppendText(@CRLF + "***OCS INVENTORY***"+@CRLF)
	$cmdText.AppendText("Run '\\mrsteel.virtc.com\shared\inspector.virtc.com.exe /Debug /NP /notag'"+@CRLF)Sleep 0.25
		
	$cmdText.AppendText("OCS Inventory updated for " + @WKSTA +@CRLF) Sleep 0.1
	$OCSChkBox.Checked = "True" 
	$OCSChkBox.Enabled = "False" Sleep 0.1

;------------------------------------------------------
;********************* Time Sync *******************
;------------------------------------------------------ 
:TimeSync

	$cmdText.AppendText(@CRLF + "***TIME SYNC***"+@CRLF)
	$cmdText.AppendText("Run 'net time \\birdman /set /yes'"+@CRLF)Sleep 0.25
	
	Run 'net time \\birdman /set /yes'
	
	$cmdText.AppendText("Time Synchronization Complete" +@CRLF)Sleep 0.25
	$TimeChkBox.Checked = "True" 
	$TimeChkBox.Enabled = "False" Sleep 0.1
	
;------------------------------------------------------
;********************* Disable DNS Cache***************
;------------------------------------------------------
:DNS

	DIM $dnsvalue
	
	$cmdText.AppendText(@CRLF + "***DISABLE DNS CACHE SERVICE***"+@CRLF)
	$dnsvalue = "4"
	$dnscheck = ReadValue ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache","Start")
	
	If $dnscheck <> $dnsvalue
		Run 'ipconfig /flushdns'
		
		$cmdText.AppendText("c:\ipconfig /flushdns" +@CRLF) Sleep 0.2
		$cmdText.AppendText("Windows IP Configuration" + @CRLF)
		$cmdText.AppendText(@CRLF + "Successfully Flushed DNS Resolver Cache+"+@CRLF) Sleep 0.1
		
		Run 'net stop dnscache'
		
		$cmdText.AppendText(@CRLF+"C:\net stop dnscache "+@CRLF)
		$cmdText.AppendText("The DNS Client Service is stopping."+@CRLF) Sleep 2
		$cmdText.AppendText("The DNS Client Service was stopped successfully" +@CRLF) Sleep 0.1
	
		Run 'sc config dnscache start= disabled'
		
		$cmdText.AppendText(@CRLF+@CRLF+ "C:\sc config dnscache start= disabled"+@CRLF) Sleep 0.5
		$cmdText.AppendText("[SC] ChangeServiceConfig SUCCESS" + @CRLF)
		$cmdText.AppendText(" " +@CRLF)
	EndIf
	
	$cmdText.AppendText("DNS Caching Service Disable "+ @CRLF) Sleep 0.1
	$DNSChkBox.Checked = "True"
	$DNSChkBox.Enabled = "Falsed" Sleep 0.1
 
;-----------------------------------------------
; *** Assigned Drive letters to share drives ***
;-----------------------------------------------

:set_vars
	
	$cmdText.AppendText(@CRLF + "***Mapping Standard Network Share Drives***" + @CRLF)
	         
		$s="\\BIRDMAN\shared"
		$p="\\BIRDMAN\projects"
		$v="\\BIRDMAN\IS"
		$i="\\mrcrunchy\intellitrack"
		$m="\\mrcrunchy\Management"
		$o="\\Guru9000\TCEXPORT"
		$r="\\vtcsqldb\DELTEK"
		$y="\\mrcrunchy\Shared"
		$t="\\mrcrunchy\payroll"
		$g="\\mrcrunchy\finance"
		$f="\\mrgates\shared"
	
	$ShellCMD = "\\mrsteel.virtc.com\shared\inspector.virtc.com.exe /DEBUG /NP /notag "
		
			     	
		     	Use e: /delete $cmdText.AppendText("e:	/deleted" + @CRLF) Sleep 0.25
		     	Use g: /delete $cmdText.AppendText("g:	/deleted" + @CRLF) Sleep 0.25
		     	Use f: /delete $cmdText.AppendText("f:	/deleted" + @CRLF) Sleep 0.25
		     	Use i: /delete $cmdText.AppendText("i:	/deleted" + @CRLF) Sleep 0.25
		     	Use m: /delete $cmdText.AppendText("m:	/deleted" + @CRLF) Sleep 0.25
		     	Use o: /delete $cmdText.AppendText("o:	/deleted" + @CRLF) Sleep 0.25
		     	Use p: /delete $cmdText.AppendText("p:	/deleted" + @CRLF) Sleep 0.25
		     	Use r: /delete $cmdText.AppendText("r:	/deleted" + @CRLF) Sleep 0.25
		     	Use s: /delete $cmdText.AppendText("s:	/deleted" + @CRLF) Sleep 0.25
		     	Use t: /delete $cmdText.AppendText("t:	/deleted" + @CRLF) Sleep 0.25
		     	Use v: /delete $cmdText.AppendText("v:	/deleted" + @CRLF) Sleep 0.25
		     	Use y: /delete $cmdText.AppendText("y:	/deleted" + @CRLF) Sleep 0.25
		     	Use z: /delete $cmdText.AppendText("z:	/deleted" + @CRLF) Sleep 0.25
		     	Use P: $p $cmdText.AppendText("p:	\\BIRDMAN\projects mapped" + @CRLF)
		     	Use S: $s $cmdText.AppendText("s:	\\BIRDMAN\shared mapped" + @CRLF) 
		     	Use V: $v $cmdText.AppendText("v:	\\BIRDMAN\IS mapped" + @CRLF) 
	     
			Sleep 3
			
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.drives.fail.kix" 
		EndIf

		
;-------------------------------------------------------------
; *** Defining specific groups and their necessary access ***
;-------------------------------------------------------------

:Domain_Admin     
	$section=$section+1          ; Section 3
	If InGroup ("Adminstations") 
	     	$cmdText.AppendText(@CRLF+"***Mapping Admin Drives***" + @CRLF)				
	     	Use Y: $y  $cmdText.AppendText("y:	\\mrcrunchy\shared mapped"+@CRLF) Sleep 0.25
		
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.admin.drives.fail.kix" 
		EndIf
	EndIf
	
	If InGroup ("finance")   	
	     	$cmdText.AppendText(@CRLF + "***Mapping Finance Drive***"+@CRLF)				
	     	Use G: $g $cmdText.AppendText("g:	\\mrcrunchy\finance mapped" + @CRLF) Sleep 0.25
		
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.finance.drive.fail.kix" 
		EndIf
	EndIf
	
	If InGroup ("payroll")
	     	$cmdText.AppendText(@CRLF + "***Mapping Payroll Drive***" + @CRLF)
	     	Use T: $t $cmdText.AppendText("t:	\\mrcrunchy\payroll mapped" + @CRLF) Sleep 0.25
		
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.payroll.drive.fail.kix" 
		EndIf
	EndIf
	
	If InGroup ("intellitrack")
	     	$cmdText.AppendText(@CRLF + "***Mapping Intellitrak Drive***" + @CRLF) 
	     	Use I: $i $cmdText.AppendText("i:	\\mrcrunchy\intellitrak mapped" + @CRLF) Sleep 0.25
		
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.intellitrak.drive.fail.kix" 
		EndIf
	EndIf
	
	If InGroup ("management")
	     	$cmdText.AppendText(@CRLF + "***Mapping Management Drive***" + @CRLF)
	     	Use M: $m $cmdText.AppendText("m:	\\mrcrunchy\management mapped" + @CRLF) Sleep 0.25
							
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.management.drive.fail.kix" 
		EndIf
	EndIf
	
	If InGroup ("time-collection")
	     	$cmdText.AppendText(@CRLF + "***Mapping Time Collection Drive***" + @CRLF)
	     	Use o: $o $cmdText.AppendText("o:	\\Guru9000\TCEXPORT mapped" + @CRLF) Sleep 0.25
		
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.time.collection.drive.fail.kix" 
			EndIf
		EndIf
	
	If InGroup ("deltek")
	     	$cmdText.AppendText(@CRLF + "***Mapping Deltek Drive***" + @CRLF) 
	     	Use r: $r $cmdText.AppendText("r:	\\vtcsqldb\DELTEK mapped" + @CRLF) Sleep 0.25
							
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.deltek.drive.fail.kix" 
		EndIf
	EndIf
	
	
	If InGroup ("orlstations")
	     	$cmdText.AppendText(@CRLF + "***Mapping Orlando Drives***" + @CRLF) 
		
	     	Use F: $f $cmdText.AppendText("f:	\\mrgates\shared mapped" + @CRLF) Sleep 0.25
		
		If @ERROR<>0 
			Call @LSERVER + "\netlogon\mapping.orlando.drives.fail.kix" 
		EndIf
	EndIf
	
	$cmdText.AppendText("All Network Share Drives assigned have been mapped." + @CRLF)
	
	$NShareChkBox.Checked = "True" 
	$NShareChkBox.Enabled = "False" Sleep 0.1
;------------------------------------------------------
;********************* Printers Mapping****************
;------------------------------------------------------
:upstairs
	
	$cmdText.AppendText(@CRLF+"***Mapping Network Printers***" +@CRLF)
	If InGroup ("thirdfloor")
	     	$cmdText.AppendText("Floor		: Third" + @CRLF)
				
	
			If NOT PrinterExist ("\\mrwizard\printer-entrance") 
				$rc = AddPrinterConnection ("\\mrwizard\printer-entrance")
				$cmdText.AppendText("Entrance		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Entrance		: Status - OK" + @CRLF)
			EndIf
			
			If NOT PrinterExist("\\mrwizard\printer-color")
				$rc = AddPrinterConnection ("\\mrwizard\printer-color")
				$cmdText.AppendText("Color		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Color		: Status - OK" + @CRLF)
			EndIf	
			
			If NOT PrinterExist ("\\mrwizard\printer-copy") 
		     		$rc = AddPrinterConnection ("\\mrwizard\printer-copy")
				$cmdText.AppendText("Copy		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Copy		: Status - OK" + @CRLF)
			EndIf
				
			
			If NOT PrinterExist ("\\mrwizard\printer-exit") 
				$rc = AddPrinterConnection ("\\mrwizard\printer-exit") 
				$cmdText.AppendText("Exit		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Exit		: Status - OK" + @CRLF)		
			EndIf
			
			Sleep 3
			
			$cmdText.AppendText("All Printers for the third floor have been added." +@CRLF)
			$PrinterChkBox.Checked = "True"
			$PrinterChkBox.Enabled = "False" Sleep 0.1

		EndIf
	
	;If InGroup ("orlandofloor")
	; 	## dkw: 03-05-2008: have no print server in Orlando!
	;     CLS
	;     AT (11,30) "Adding Third Floor Alexandria Printers (testfloor)"
	;     AddPrinterConnection ("\\mrgates\printer-hall")
	;     AddPrinterConnection ("\\mrgates\printer-orl")
	;EndIf
	
	
	
	If InGroup ("secondfloor")
		
		Color w+/n
			AT (11,25) "Floor       : "    ; display some text strings
			AT (12,25) "Adocs		: "
			AT (13,25) "copy        : "
			AT (14,25) "Color       : "
			AT (15,25) "Recruiting	: "

		$cmdText.AppendText("Floor       : Second" + @CRLF)
	        				
			If NOT PrinterExist ("\\mrwizard\printer-adocs") 
				AddPrinterConnection ("\\mrwizard\printer-adocs")
				$cmdText.AppendText("Adocs		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Adocs		: Status - OK"+ @CRLF)
			EndIf
			
			If NOT PrinterExist ("\\mrwizard\printer-copy") 
			     	AddPrinterConnection ("\\mrwizard\printer-copy")
				$cmdText.AppendText("Copy		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Copy		: Status - Ok" + @CRLF)
			EndIf
			
			If NOT PrinterExist ("\\mrwizard\printer-color")
				AddPrinterConnection ("\\mrwizard\printer-color")
				$cmdText.AppendText("Color		: Added" + @CRLF)
			Else
				$cmdText.AppendText("Color		: Status - OK" + @CRLF)
			EndIf
				
			If NOT PrinterExist ("\\mrwizard\printer-recruiting") 
				AddPrinterConnection ("\\mrwizard\printer-recruiting")
				$cmdText.AppendText("Recruiting	: Added" + @CRLF)
			Else
				$cmdText.AppendText("Recruiting	: Status - OK" + @CRLF)
			EndIf
			
			$cmdText.AppendText("All Printers for the second floor have been added." +@CRLF)
			$PrinterChkBox.Checked = "True"
			$PrinterChkBox.Enabled = "False" Sleep 0.1
		EndIf
	
	
 

;------------------------------------------------------
;********************* Screen Saver *******************
;------------------------------------------------------ 
:Securing_Station	; Section 12
	
	$cmdText.AppendText(@CRLF + "***Securing Station***" + @CRLF)      

   
	$cmdText.AppendText("Checking Screen saver. Please Wait"+@CRLF)
	
		$act=ReadValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive")
		$sec=ReadValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaverIsSecure")
	
	If $act=1 AND $sec=1
	     	GoTo Dontwrite
	Else
	     	GoTo Write
	EndIf
	
	If @ERROR<>0 
		Call @LSERVER + "\netlogon\fail.kix" 
	EndIf
;------------------------------------------
;  ****  ****
;------------------------------------------

:Write

	
	WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ")
	WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaverIsSecure","1","REG_SZ")
	WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","1200","REG_SZ")
	     
	$cmdText.AppendText("Screen Saver set to 2400 seconds"+@CRLF)
	
	WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","c:\winnt\system32\ssflwbox.SCR","REG_SZ")
	WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DFlowerBox","JointType","2","REG_SZ")
	
	If @ERROR = 0 	     
		$cmdText.AppendText("Screen Saver updated"+@CRLF)
		$ScreenSaverChkBox.Checked = "True"
		$ScreenSaverChkBox.Enabled = "False" Sleep 0.1
	Else
	     	If @ERROR<>0 
			Call @LSERVER + "\netlogon\fail.kix" 
		EndIf
	EndIf
	;Goto IE_Start_Page
	
;-------------------------------------------
;  ****  ****
;-------------------------------------------
	
:Dontwrite
        ; Section 14
		
	$cmdText.AppendText("Saver Already Set" + @CRLF)
	$ScreenSaverChkBox.Checked = "True"
	$ScreenSaverChkBox.Enabled = "False" Sleep 0.1

	


;-------------------------------------------
;  ****  ****
;-------------------------------------------

	
;:IE_Start_Page          
	;$section=$section+1          ; Section 15
	;$home=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page")
	
	;If $home<>"//djvkir1psv1/olealliance/index.htm"
		;Goto Set_Home_Page
	;Else
		;Goto end
	;EndIf

;------------------------------------------
;  ****  ****
;------------------------------------------

;:Set_Home_Page
	;$section=$section+1          ; Section 16
	;If InGroup ("Domain Admins")
		;Goto END
	;Else
		;WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page","//djvkir1psv1/olealliance/default.htm","REG_SZ")
	;EndIf
	
	;If @error<>0 
		;Call @LSERVER + "\netlogon\fail.kix" 
	;EndIf
	

;------------------------------------------
;  **** Outlook Profile ****
;------------------------------------------

:Outlook
	DIM $prof_name, $mail_serv, $port, $ssl,$Username,$pwd
	$prof_name = "Zimbra"
	$mail_serv = "mail.raytheonvtc.com"
	$port = 443
	$ssl = 1
	$username = @USERID + "@@raytheonvtc.com"
	$buttonpress = "False"
	$profile = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles","DefaultProfile")
	
	If $profile = ""		
		
		$msg= $Form.MsgBox("Would you like to setup up your mailbox?","Outlook Setup",4)
		
		
		If $msg = 6
			
			$Form.height = 765			
			$Outlook.Visible = "True"
				
			$EmailSetup.AppendText("Profile Name:" + @CRLF)
			$EmailSetup.AppendText("Mail Server:" + @CRLF)
			$EmailSetup.AppendText("Port:" + @CRLF)
			$EmailSetup.AppendText("SSL:" + @CRLF)
			$EmailSetup.AppendText("Username:")			
				
			$EmailDisplay.AppendText($prof_name +@CRLF)
			$EmailDisplay.AppendText($mail_serv +@CRLF)
			$EmailDisplay.AppendText($port + @CRLF)
			$EmailDisplay.AppendText(@CRLF+"Yes"+@CRLF)
			$EmailDisplay.AppendText(@USERID)
				
		Else
			$cmdText.AppendText("You opted out of the automated Outlook profile creation."+@CRLF)
			$Form.Height = 520
			GoTo Log
		EndIf
		
		
	Else
		$cmdText.AppendText("Your default outlook profile is already set to the standard." +@CRLF)
		$OutlookChkBox.Checked = "True"
		$OutlookChkBox.Enabled = "False" Sleep 0.2
		
	EndIf
	

;------------------------------------------------------
;********************* Scanner / Log *******************
;------------------------------------------------------ 
:Log
	$cmdText.AppendText(@CRLF + "***Creating Log***" + @CRLF)	
	




;------------------------------------------------------
;******************FADE OUT****************************
;------------------------------------------------------
;:FADE
	;Fade($form,,3000)

	
	
While $Form.Visible
   $=Execute($Form.DoEvents())
Loop

;------------------------------------------------------
;*********************Functions************************
;------------------------------------------------------
Function PrinterExist($PrinterName,optional $remotepc)
  	DIM $service,$printer,$printers
  	$printerexist=0
  	
	If $remotepc=""
    		$remotepc='\\'+ @WKSTA
  	Else 
    		If not Left($remotepc,2)="\\"
      		$remotepc='\\' + $remotepc
    		EndIf
  	EndIf
  
	$Service=GetObject("winmgmts:{impersonationLevel=impersonate}!" + $remotepc +"\root\cimv2")
  	
	If not @ERROR=0
    		Exit @ERROR
  	EndIf
  
	$Printers=$service.execquery ('select * from Win32_Printer')
  
	For Each $printer In $printers
    		If UCase($printername)=UCase($printer.name)
      		$printerexist=1
   		 EndIf
    
		If Left($printer.name,2)="\\"
      		If UCase($printername)=UCase(Split(SubSTR($printer.name,3),"\")[1] + " on " + Split(SubSTR($printer.name,3),"\")[0])
        			$printerexist=1
     			 EndIf
   		 EndIf
  	Next
EndFunction

Function fnGetM(OPTIONAL $sM,OPTIONAL $lTO)
    DIM $X,$lT,$lTC
    Do
        $lT=@TICKS
        Sleep 0.05
        If KBHit()
            Get $X
            If ASC($X)>32
                $fnGetM=$fnGetM+$X
                If $sM $sM Else $X EndIf
            EndIf
            If InSTR($X,CHR(8)) AND Len($fnGetM)>0
                CHR(8) CHR(32) CHR(8)
                $fnGetM=Left($fnGetM,Len($fnGetM)-1)
            EndIf
            $lTC=0
        EndIf
        If $lTO
            If $lTC < $lTO*1000
                $lTC=$lTC+@TICKS-$lT
            Else
                $fnGetM=""
                ? Exit 121
            EndIf
        EndIf
    Until InSTR($X,CHR(13))
    ? Exit 0
EndFunction

Function click_setup()
	If $OutlookPwdText.Text= ""
		$= $Form.MsgBox("You must specify a password before clicking SETUP.", "Invalid Password")
		$OutlookPwdText.Text = $StringPasswordEndFunction
	Else
		$pwd = $OutlookPwdText.Text
	EndIf	
	
	; Check LDAP Authtentication to verify password
	

	
	; Run if authentication is verified. 
	Run '\\birdman\netlogon\CreateZimbraProfile.exe ' + $prof_name + ' ' + $mail_serv + ' ' + $port + ' ' + $ssl + ' ' + $username + ' ' + $pwd
	$cmdText("Run '\\birdman\netlogon\CreateZimbraProfile.exe'" + @CRLF)
	$rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles","DefaultProfile",$prof_name,"REG_SZ")
	$cmdText.AppendText("OutLook Profile Created" + @CRLF)
	$OutlookChkBox.Checked = "True"
	$OutlookChkBox.Enabled = "False" Sleep 0.2
	$Form.Height = 520
	$buttonPress = "True"
	
EndFunction

Function cmd_click()
	$Button3.DialogResult = 2
	$Outlook.Visible = "False"
	$Form.Height = 520
	$buttonPress = "True"
EndFunction

;Function Fade($Form,Optional $Opacity, $MSecs, $NoDispose) 

;   $Opacity=IIf($Opacity,$Opacity,0) 
;   $MSecs=IIf($MSecs,$MSecs,400) 
;   If $Form.visible=0 
;      $Form.Opacity=0 
;      $Form.Show 
;   EndIf 
;   Dim $Ticks,$Init,$Diff 
;   $Init=CDbl($Form.Opacity) 
;   If $Init<>$Opacity 
 ;     $Ticks=@TICKS 
 ;     $Diff=@TICKS-$Ticks 
  ;    Do $Form.Opacity=$Init+CDbl($Opacity-$Init)*$Diff/$msecs 
   ;      $Diff=@TICKS-$Ticks 
;      Until $Diff>=$msecs 
;      $Form.Opacity=$Opacity 
;   EndIf 
;   If $Opacity=0 
;      If $NoDispose 
 ;        $Form.Hide 
;;      Else 
;         $Form.Dispose 
 ;     EndIf 
  ; EndIf 

;EndFunction




Edited by NTDOC (2008-05-14 02:33 AM)
Edit Reason: Added CODE TAG - NTDOC

Top
#187581 - 2008-05-13 02:47 AM Re: KIXFORMS Issue - Making script wait for user to press button [Re: VTC]
VTC Offline
Fresh Scripter

Registered: 2008-04-17
Posts: 26
Loc: Alexandria, Virginia
The problem is that my Outlook Wizard runs through the lines and continues onto the log. I need it to wait for either $setup.OnClick to be true or $Button3.OnClick to be true. However their is no boolean value to say whether the button was actually clicked. Any help would prevent the any further balding as i continue to pull my hair out at every failed counter statement.
Top
#187586 - 2008-05-13 07:59 AM Re: KIXFORMS Issue - Making script wait for user to press button [Re: VTC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
has shawn made a new method .appendtext() that automatically refreshes the form?
that not nice.

anyhow, the easy way to make it work, is place the log line after:
While $Form.Visible
$=Execute($Form.DoEvents())
Loop

and then add a line to the buttons that sets the button pressed last:
$button3.onclick="$$buttonPressed='button3'"

even nicer would be, if you started using kixforms logics.
that is, first show the form and start doing that .doevents()
but then the coding would be a bit harder...
would need to use kf timer or other event functions for parts of your loginscript which would be written in UDF style.
_________________________
!

download KiXnet

Top
#187613 - 2008-05-13 08:17 PM Re: KIXFORMS Issue - Making script wait for user to press button [Re: Lonkero]
VTC Offline
Fresh Scripter

Registered: 2008-04-17
Posts: 26
Loc: Alexandria, Virginia
The suggestion works partly. It holds but it causes the engine to freeze once it tries to read in the conditions of each OnClick. For Example Setup button checks to make sure that the user entered valid data, if the password field is blank it notifies the user and exits out of the click function and waits back at the form for a valid entry. What happens now is that when a user presses setup without entering data into the password text field it notifies the user and then exits out of the script without continuing the rest of the script programming. Same thing for cancel button. Its ignoring the conditions. I tried to insert a counter statement to return if the buttons were pressed. no luck.
Top
#187642 - 2008-05-14 07:00 PM Re: KIXFORMS Issue - Making script wait for user to press button [Re: VTC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, you must make it not exit.
show us your code.
_________________________
!

download KiXnet

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 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.055 seconds in which 0.022 seconds were spent on a total of 13 queries. Zlib compression enabled.

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