The Chef
Fresh Scripter
Registered: 2003-01-08
Posts: 23
Loc: New Jersey
|
Ok folks, sorry this took so long, and I am happy that you are all so willing to help. Here's the code, I had to cut it up. You will need to bypass the InGroup line if you wish to execute. The first script runs:
$Count = 0 $ThreeTry = "false" $GoodGUI = "false"
;====================KixForms.dll regsvr32 registration============= ; Creates the KixGUI desktop object if KixGUI.dll has already ;been registered. If not registered, attempts registration by copying ;KixGUI.dll to C:\ and running regsvr32 /s 3 times before failure. ;(Registration will likely fail unless user is local admin)
$FormRoot = CreateObject("Kixtart.Form") If NOT @Serror = "The operation completed successfully." Do Copy "\\MyDCserver\netlogon\Kixforms.dll" "C:\temp\Kixforms.dll" Shell "%comspec% /c regsvr32 /s C:\temp\Kixforms.dll" $FormRoot = CreateObject("Kixtart.Form") If @Serror = "The operation completed successfully." $ThreeTry = "true" $GoodGUI = "true" EndIf $Count = $Count + 1 If $Count > 3 $ThreeTry = "true" EndIf Until $ThreeTry = "true" Else $GoodGUI = "true" EndIf
;======================KixForms form creation======================= ; Creates the form trees and 3 forms that are displayed. 2 static ;picture forms and one dynamic progressbar form
If $GoodGUI = "true" $X = $FormRoot.Screen.Width $Y = $FormRoot.Screen.Height $FormRoot.Caption = "MyOrg Dialog" $FormRoot.Width = 600 $FormRoot.Height = 150 $FormRoot.Location = 10,$Y-(($FormRoot.Height)+40)
$ProgressBar = $FormRoot.ProgressBar("",8, ($FormRoot.Height-40), ($FormRoot.Width-20), 10)
$Banner = $FormRoot.PictureBox $Banner.Top = 4 $Banner.Left = 4 $Banner.Width = $FormRoot.Width-15 $Banner.Height = $FormRoot.Height-70 $Banner.BackColor = $FormRoot.RGB(255,255,255)
$BannerLabel1 = $Banner.Label("Welcome to the @domain domain.",80,6,$Banner.Width - 80,30) $BannerLabel1.FontBold = 1 $BannerLabel1.FontSize = 12 $BannerLabel1.FontWeight = 800 $BannerLabel1.FontName = "Arial"
$BannerLabel2 = $Banner.Label("@FullName, authenticates to @LSERVER",80,26,$Banner.Width - 80,30) $BannerLabel2.FontBold = 1 $BannerLabel2.FontSize = 8 $BannerLabel2.ForeColor = $FormRoot.RGB(0,130,30) $BannerLabel2.FontName = "Arial"
$BannerLabel3 = $Banner.Label("Adapter @address using IP @IPADDRESS0",80,40,$Banner.Width - 80,30) $BannerLabel3.FontBold = 1 $BannerLabel3.FontSize = 8 $BannerLabel3.ForeColor = $FormRoot.RGB(0,130,30) $BannerLabel3.FontName = "Arial"
$BannerLabel4 = $Banner.Label("Please be patient while the script configures your computer...",80,54,$Banner.Width - 80,30) $BannerLabel4.FontBold = 1 $BannerLabel4.FontSize = 8 $BannerLabel4.ForeColor = $FormRoot.RGB(0,130,30) $BannerLabel4.FontName = "Arial"
$BannerInfocon = $Banner.Label("INFOCON " + $Infocon,440,56,$Banner.Width - 80,30) $BannerInfocon.FontBold = 1 $BannerInfocon.FontSize = 12 $BannerInfocon.FontName = "Arial" Select Case $Infocon = "NORMAL" $BannerInfocon.ForeColor = $FormRoot.RGB(0,0,0) Case $Infocon = "ALPHA" $BannerInfocon.ForeColor = $FormRoot.RGB(0,130,30)
Case $Infocon = "BRAVO" $BannerInfocon.ForeColor = $FormRoot.RGB(255,255,0)
Case $Infocon = "CHARLIE" $BannerInfocon.ForeColor = $FormRoot.RGB(255,140,28)
Case $Infocon = "DELTA" $BannerInfocon.ForeColor = $FormRoot.RGB(255,0,0) EndSelect
$Icon3 = $Banner.Image $Icon3.Picture = "shell32.dll;16" $Icon3.Top = 8 $Icon3.Left = 8 $Icon3.Height = 60 $Icon3.Width = $Icon3.Height
$FormRoot.Show EndIf
If InGroup("IPMSinventory") UpdateProgressBar(2,10,"Please inventory your computer",22,24) If $GoodGUI = "true" Call "C:\inventorytest.kix" EndIf UpdateProgressBar(10,10,"Thanks!",22,24) EndIf
Exit 1
;============================================================= Function UpdateProgressBar($CurrentBar, $TotalBar, $TextUpdate, $IconNumber, $IconScale) If $GoodGUI ="true" $ProgressBar.Min = 0 $ProgressBar.Max = $TotalBar $ProgressBar.Value = $CurrentBar $TaskLabel = $FormRoot.Label($TextUpdate, 40, $FormRoot.Height - 58, $FormRoot.Width - 40, 16) $TaskLabel.FontBold = 1 $TaskLabel.FontSize = 8 $TaskLabel.FontName = "Arial" If NOT $Icon $Icon = $FormRoot.Image EndIf $Icon.Visible = 0 $Icon.Picture = "shell32.dll;" + $IconNumber $Icon.Top = $FormRoot.Height - 66 $Icon.Left = 10 $Icon.Height = $IconScale $Icon.Width = $IconScale $Icon.Visible = 1 EndIf
EndFunction
====================================== ====================================== ====================================== And the second script that runs DoEvent follows, with the "On-click" calls with that dash so that the BB doesnt think its html. The ReturnFocus function was just for me to experiment... Watch out for the registry entry, I've remmed it out. Also, you will need to replace the "less than". This dern BB keeps thinking its a link. I know theres a way around that, but I am about to punch something and I dont care.
Break on
$SecondTry = 0 $ADPEinventoryDate = "011503"
If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\MyOrg","ADPEinventoryDate") = $ADPEinventoryDate Quit EndIf
$InvForm = CreateObject("Kixtart.Form")
$InvForm.Top = 100 $InvForm.Width = 400 $InvForm.Height = 180 $InvForm.Caption = "MyOrg Inventory"
$InvFrame = $InvForm.Frame ;$InvFrame.Caption = "Notice" $InvFrame.Left = 10 $InvFrame.Top = 7 $InvFrame.Width = $InvForm.Width-26 $InvFrame.Height = 85
$InvLabelExplain = $InvFrame.Label $InvLabelExplain.FontBold = 1 $InvLabelExplain.Caption = " The MyOrg requires your assistance to locate and inventory computer equipment. Please take a moment to enter the building number where this computer is located, and the last four characters of the barcode number on this computer's IPMS label." $InvLabelExplain.Left = 10 $InvLabelExplain.Top = 12 $InvLabelExplain.Width = $InvFrame.Width - 20 $InvLabelExplain.Height = $InvFrame.Height - 20
$InvHelpLink = $InvForm.HyperLink $InvHelpLink.Value = "\\dcserver\NETLOGON\InventoryHelper.doc" $InvHelpLink.Caption = "Click here for help" $InvHelpLink.Top = 95 $InvHelpLink.Left = 300 $InvHelpLink.Height = 20
$InvLabelBldg = $InvForm.Label $InvLabelBldg.Caption = "Building Number:" $InvLabelBldg.Top = 100 $InvLabelBldg.Left = 20
$InvBldgText = $InvForm.TextBox $InvBldgText.Top = 98 $InvBldgText.Left = 145 $InvBldgText.Width = 50 $InvBldgText.Height = 18 $InvBldgText.Alignment = 2 $InvBldgText.OnChange = "CheckEntriesOnKey()"
$InvLabelIPMS = $InvForm.Label $InvLabelIPMS.Caption = "IPMS Barcode Last Four:" $InvLabelIPMS.Top = 125 $InvLabelIPMS.Left = 20
$InvIPMSText = $InvForm.TextBox $InvIPMSText.SelLength = 4 $InvIPMSText.Top = 123 $InvIPMSText.Left = 145 $InvIPMSText.Width = 50 $InvIPMSText.Height = 18 $InvIPMSText.Alignment = 2 $InvIPMSText.OnChange = "CheckEntriesOnKey()"
$InvSubmitButton = $InvForm.Button $InvSubmitButton.Default = 1 $InvSubmitButton.Caption = "Submit" $InvSubmitButton.FontBold = 1 $InvSubmitButton.Left = 246 $InvSubmitButton.Top = 118 $InvSubmitButton.Height = 25 $InvSubmitButton.Width = 90 $InvSubmitButton.On_Click = "SubmitOn_Click()"
$InvForm.Show $InvForm.Visible = 1 $InvBldgText.SetFocus $InvForm.OnLostFocus = "ReturnFocus()"
While $InvForm.Visible ? "looping" $=Execute($InvForm.DoEvents) Loop exit 1 ;===============================================
Function CheckEntriesOnKey()
If Len($InvIPMSText.Text) > 4 $InvIPMSText.Text = SubStr($InvIPMSText.Text, 1, 4) $InvIPMSText.SelStart = 4 $InvIPMSText.SetFocus EndIf
If Len($InvBldgText.Text) > 5 $InvBldgText.Text = SubStr($InvBldgText.Text, 1, 5) $InvBldgText.SelStart = 5 $InvBldgText.SetFocus EndIf
EndFunction
;===============================================
Function SubmitOn_Click()
Select
Case Len($InvBldgText.Text) "less than(damn html)" 4 MessageBox("Please enter a valid value for Building number!" + Chr(13) + Chr(10) + "(the value must be at least 4 digits)","Hey!",48) SendKeys("~{TAB}") $InvBldgText.SetFocus Case Len($InvIPMSText.Text) = 0 MessageBox("Please enter a value For IPMS Serial Last Four!" + Chr(13) + Chr(10) + "(the value must be 4 characters in length)","Hey!",48) SendKeys("~{TAB}") $InvIPMSText.SetFocus
Case 1 $WriteError = 0 $ComputerName = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName") $WriteError = $WriteError + Open(1, "\\server2\IPMSinventory\IPMSinventory.txt", 5) $WriteError = $WriteError + WriteLine(1, $ComputerName + ";" + $InvBldgText.Text + ";" + $InvIPMSText.Text + ";" + @userid + Chr(13) + Chr(10)) $WriteError = $WriteError + Close(1)
If NOT $WriteError MessageBox("These damn messageboxes give me html errors on the BB.","Thanks!",64,3) $InvForm.Visible = 0 ;WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Site","ADPEinventoryDate",$ADPEinventoryDate,"REG_SZ") Else If $SecondTry $InvForm.Visible = 0 MessageBox("Network or file operation problems are preventing your computer from logging this information. Please try again at your next logon. If this problem persists, call the MyOrg Helpdesk at xxx-xxx","Error",16) Else MessageBox("The information you have provided was not logged. Please resubmit your building and IPMS information.","Submit Error",48,10) SendKeys("~{TAB}") EndIf $SecondTry = "true"
EndIf EndSelect
EndFunction
;===================================================
Function ReturnFocus() $InvForm.SetFocus $InvBldgText.SetFocus
EndFunction
|