Page 2 of 2 <12
Topic Options
#212160 - 2016-12-15 09:18 AM Re: can some one help me [Re: ChristopheM]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
 Originally Posted By: ChristopheM
Hi,

i have made some changes in the code and put more parameters in the share config file.
i have rewriten the kixforms part. i hope this will be helpful.

if the config file is growing to much, it is a good thing to optimize by copying the file locally at the beginning iof the script. Reading a local ini file is more efficient because for each call to ReadProfileString, the file is entirely read from disk to memory.
For example, 10 reads in a file of 10 KB on a network share and it is 100 KB over the network !!!

Thank you so much it helped massively

Top
#212161 - 2016-12-15 09:21 AM Re: can some one help me [Re: Powerdrib]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
 Code:
function AddTextbox( $GroupBox, $label, $textvalue, $x1, $y1, $width, $height )
	dim $lbl, $textbox

	$lbl = $GroupBox.Controls.Add( "Label" )
	$lbl.text = $label
	$lbl.location = $x1, $y1
	$lbl.size = $width, $height

	$textbox = $GroupBox.Controls.Add( "TextBox" )
	$textbox.text = $textvalue
	$textbox.location = $x1+$width, $y1
	$textbox.size = $width, $height
	$textbox.BackColor=$Form.BackColor
	$textbox.Enabled=0
endfunction

function Trim( $str )
	$trim = LTrim( RTrim($str) )
endfunction

and now the only problem is that i get another error in this line Specificly
 Code:
$lbl.location = $x1, $y1
the error is "unexpected command"
hopefully you can help with this

Top
#212163 - 2016-12-15 09:39 AM Re: can some one help me [Re: Powerdrib]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
nvm I already fixed it

but the same error from before comes back to these lines
 Code:
$NewsRadioButton = $ActionFrame.RadioButton("Bericht weergeven", 5, 15, 230, 15)
	$SharesRadioButton = $ActionFrame.RadioButton("Netwerkverbindingen maken", 5, 30, 230, 15)
	$StandardSettingsRadioButton = $ActionFrame.RadioButton("Standaard instellingen", 5, 45, 230, 15)			
	$TempfoldersRadioButton = $ActionFrame.RadioButton("Tijdelijke mappen aanmaken", 5, 60, 230, 15)
"expected ')'"

Top
#212164 - 2016-12-15 03:45 PM Re: can some one help me [Re: Powerdrib]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
What happens if you do it this way instead?

 Code:
$NewsRadioButton = $ActionFrame.Controls.Add("RadioButton")
$NewsRadioButton.Text = "Bericht weergeven"
$NewsRadioButton.Left = 5
$NewsRadioButton.Top = 15
$NewsRadioButton.Width = 230
$NewsRadioButton.Height = 15

$SharesRadioButton = $ActionFrame.Controls.Add("RadioButton")
$SharesRadioButton.Text = "Netwerkverbindingen maken"
$SharesRadioButton.Left = 5
$SharesRadioButton.Top = 30
$SharesRadioButton.Width = 230
$SharesRadioButton.Height = 15

$StandardSettingsRadioButton = $ActionFrame.Controls.Add("RadioButton")
$StandardSettingsRadioButton.Text = "Standaard instellingen"
$StandardSettingsRadioButton.Left = 5
$StandardSettingsRadioButton.Top = 45
$StandardSettingsRadioButton.Width = 230
$StandardSettingsRadioButton.Height = 15

$TempfoldersRadioButton = $ActionFrame.Controls.Add("RadioButton")
$TempfoldersRadioButton.Text = "Tijdelijke mappen aanmaken"
$TempfoldersRadioButton.Left = 5
$TempfoldersRadioButton.Top = 60
$TempfoldersRadioButton.Width = 230
$TempfoldersRadioButton.Height = 15

Top
#212165 - 2016-12-15 05:13 PM Re: can some one help me [Re: Powerdrib]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
 Code:
$lbl = $GroupBox.Controls.Add( "Label" )
	$lbl.text = $label
	$lbl.location = $x1, $y1
	$lbl.size = $width, $height

	$textbox = $GroupBox.Controls.Add( "TextBox" )
	$textbox.text = $textvalue
	$textbox.location = $x1+$width, $y1
	$textbox.size = $width, $height
	$textbox.BackColor=$Form.BackColor
	$textbox.Enabled=0

this whole section is under the error "unexpected error"

Top
#212166 - 2016-12-15 08:36 PM Re: can some one help me [Re: Powerdrib]
ChristopheM Offline
Hey THIS is FUN
*****

Registered: 2002-05-13
Posts: 309
Loc: STRASBOURG, France
what is your version of kix32.exe and kixforms.dll ?

I am using kix 4.66 and kixforms 2.46.55
in kixforms.chm (for version 2.46), i found that frame is deprecated.

if you have an error with my code in the function addtextbox, you should have an error before because location is used with $logo and $infoframe !!!

a command
 Code:
$object.location = $x, $y
can be replaced with
 Code:
$object.left = $x
$object.top = $y
_________________________
Christophe

Top
#212175 - 2016-12-20 11:51 AM Re: can some one help me [Re: ChristopheM]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
 Originally Posted By: ChristopheM
what is your version of kix32.exe and kixforms.dll ?

I am using kix 4.66 and kixforms 2.46.55
in kixforms.chm (for version 2.46), i found that frame is deprecated.

if you have an error with my code in the function addtextbox, you should have an error before because location is used with $logo and $infoframe !!!

a command
 Code:
$object.location = $x, $y
can be replaced with
 Code:
$object.left = $x
$object.top = $y

how can i change this
 Code:
$textbox.location = $x1+$width, $y1
	$textbox.size = $width, $height

Top
#212180 - 2016-12-20 03:22 PM Re: can some one help me [Re: Powerdrib]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Location is just a shorter way of setting the Left and Top...Like so...
 Code:
$object.Left = $x
$object.Top = $y

$textbox.Width = $width
$textbox.Height = $height
$textbox.Left = $x1+$width
$textbox.Top = $y1

Top
#212181 - 2016-12-20 03:49 PM Re: can some one help me [Re: Powerdrib]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
 Code:
Function Progress( $ProgressText, optional $Step )
	If $Step=""
		$Step=$progressstep
	EndIf
	$ProgressTextBox.Text = $ProgressText
	If $ProgressBar.Value + $Step < 101
		$ProgressBar.Value = $ProgressBar.Value+$Step
		If $DebugFlag = $TRUE		 
			Sleep $sleeptime
		EndIf
	Else
		$ProgressBar.Value=100
	EndIf
	$=Execute($Form.DoEvents())
EndFunction

I have problems With this line
 Code:
$=Execute($Form.DoEvents())
the error is
 Quote:
invalid method/Function call: missing comma

Top
#212184 - 2016-12-22 06:02 PM Re: can some one help me [Re: Powerdrib]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Are you sure you have registered kixforms on the PC you are running the script?
Top
#212203 - 2017-01-10 09:16 AM Re: can some one help me [Re: Allen]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
yes i have registered kixforms but it will still doesn't work

Top
#212219 - 2017-01-16 02:33 PM Re: can some one help me [Re: Powerdrib]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
the code now works so everyone that helped thank you
Top
#212220 - 2017-01-16 03:01 PM Re: can some one help me [Re: Powerdrib]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
Please share your/the solution.
Top
#212221 - 2017-01-17 08:02 AM Re: can some one help me [Re: Allen]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
 Code:
;-------------------------------------------------------------------------------
; Script:	Login Script
; Version:	1.0
;
; Author:	Mathieu van der Heijden
; E-mail:	xxxxxxxxxxxx@hotmail.com

;-------------------------------------------------------------------------------

Break On

;-- Default Settings --
$os=""
$os_type=""
$os_service_pack=""
$progressstep=3
$sleeptime=0.5
$numerrors=0
Global $time

Global $UpdateSoftware[0]
$userid=@userid
$Updates=0
$RunUpdates=$False
$tmpdir=ExpandEnvironmentVars("%tmp%")
$systemdrive=ExpandEnvironmentVars("%systemdrive%")
$windir=ExpandEnvironmentVars("%windir%")
$comspec=ExpandEnvironmentVars("%comspec%")
;;$Filelocation=ExpandEnvironmentVars("\\PFSV1\netlogon")
$Filelocation=@scriptdir

$inisharefile=$FileLocation + "\shares.ini"
$NewsFile=$FileLocation + "\news.txt"

Global $DebugMessages[0]
$NumMessages=0
$DebugMessages[$NumMessages]="-BEGIN--------------------------"

;Main Application

	;-- Draw Form --
	$=DrawForms()
	sleep $sleeptime

	;-- Show News --
	$=ShowNews()
	sleep $sleeptime

	;-- Connecting Drives --
	$=ConnectDrives()
	sleep $sleeptime

	;-- Set machine to standard Settings --
	$=StandardSettings()
	sleep $sleeptime

	;-- Create Temp Folders and Files --
	$=Tempfolders()
	sleep $sleeptime

	;-- Fill Progressbar --
	While $ProgressBar.Value < 100
		$=Progress( "Afronden", 20 )
	Loop

Exit 1

;-------------------------------------------------------------------------------
;  Update the clock
;-------------------------------------------------------------------------------
Function UpdateClock()
	If @Time<>$time
		$Clock.Text=@Time
		$time=@time
	EndIf
EndFunction

;-------------------------------------------------------------------------------
;  Retrieve News File
;-------------------------------------------------------------------------------
Function ShowNews()
	If not Exist($newsfile)	exit	endif

	dim $handle

	$NewsRadioButton.Value = 1
	$ = Progress( "Retrieving News")
	$handle = FreeFileHandle()
	If Open($handle, $NewsFile) = 0
		$NewsLine = ReadLine($handle)
		While @ERROR=0
			$NewsTextBox.Text = $NewsTextBox.Text + $NewsLine + @crlf
			$NewsLine = ReadLine($handle)
		Loop
		If Close($handle) <> 0
			$=DbgMessage("Error","News File could not be closed", @SError)
		EndIf
	Else
		$=DbgMessage("Debug","No News")
	EndIf
	$NewsRadioButton.Value = 0
	$NewsRadioButton.Enabled = 0
EndFunction

;-------------------------------------------------------------------------------
;  Connect Shares to Drives
;-------------------------------------------------------------------------------
Function ConnectDrives()
	$SharesRadioButton.Value = 1
	$=Progress( "Connecting Drives")
	$=DbgMessage("Info","Connecting Drives:")
	$=ConnectHomeDrive()
	$=ConnectDefaultDrives()
	$=ConnectSpecificDrives()
	$SharesRadioButton.Value = 0
	$SharesRadioButton.Enabled = 0
EndFunction

;-------------------------------------------------------------------------------
;  Connect Home Drive
;-------------------------------------------------------------------------------
Function ConnectHomeDrive()
	If not Exist($inisharefile)	exit	endif

	dim $inisection, $DriveDefinition

	$inisection = "HomeDrive"

	$DriveDefinition = ReadProfileString( $inisharefile, $inisection, "drive" )
	if $share
		$DriveDefinition = $DriveDefinition + "\" + $userid + ", Home Share"

		$=ConnectShare($DriveDefinition)
	endif
EndFunction


;-------------------------------------------------------------------------------
;  Connect DefaultShares to Drives
;-------------------------------------------------------------------------------
Function ConnectDefaultDrives()
	$=ConnectGroupDrives( "EveryOne" )
EndFunction

;-------------------------------------------------------------------------------
;  Zorgen dat je een bepaalde groupshare krijgt door groeplidmaatschap
;-------------------------------------------------------------------------------
Function ConnectSpecificDrives()
	If not Exist($inisharefile)	exit	endif

	dim $inisection, $arrKeys, $key, $group

	$inisection = "Groups List"

	;-- get all key in the section --
	$arrKeys = ReadProfileString( $inisharefile, $inisection, "" )

	;-- convert to array --
	$arrKeys = split( $arrGroups, chr(10) )
	for each $key in $arrKeys
		if $key
			$group = ReadProfileString( $inisharefile, $inisection, $key )
			if $group
				if ingroup($group)   $=ConnectGroupDrives( $group ) endif
			endif
		endif
	next
Endfunction

;-------------------------------------------------------------------------------
;  Connect GroupShares to Drives
;-------------------------------------------------------------------------------
Function ConnectGroupDrives( $group )
	If $group""	exit endif
	If not Exist($inisharefile)	exit	endif

	$=DBGMessage("Testing Groupshares",$group)

	dim $arrKeys, $key, $DriveDefinition

	;-- get all key in the section --
	$arrKeys = ReadProfileString( $inisharefile, $group, "" )

	;-- convert to array --
	$arrKeys = split( $arrGroups, chr(10) )
	for each $key in $arrKeys
		if Left($key,5)="Drive"
			$DriveDefinition = ReadProfileString( $inisharefile, $group, $key )
			If $DriveDefinition<>""
				$=ConnectShare($DriveDefinition)
			EndIf
		endif
	next
EndFunction

;-------------------------------------------------------------------------------
; Set machine to default settings
;-------------------------------------------------------------------------------
Function StandardSettings()
	dim $regHKCUControlPanel, $regHKCUSoftware

    $regHKCUControlPanel = "HKEY_CURRENT_USER\Control Panel1"
    $regHKCUSoftware = "HKEY_CURRENT_USER\Software1"

	$StandardSettingsRadioButton.Value = 1
	$=Progress( "Setting Standard Settings")
	$=DbgMessage("Info","Setting standard settings:")

	$=WriteValue($regHKCUControlPanel+"\International" , "iCountry" , "31" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iCurrency" , "2" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iDate" , "1" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iFirstDayOfWeek" , "0" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iFirstWeekOfYear" , "2" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iMeasure" , "0" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iNegCurr" , "11" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "iTime" , "1" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "Local" , "413" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "s1159" , "" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "s2359" , "" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sCountry" , "Netherlands" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sCurrency" , "€" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sDate" , "-" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sDecimal" , "," , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sLanguage" , "NLD" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sList" , ";" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sMonDecimalSep" , "," , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sMonThousandSep" , "." , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sShortDate" , "dd-MM-yyyy" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sThousand" , "." , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\International" , "sTimeFormat" , "H:mm:ss" , "REG_SZ")
	$=WriteValue($regHKCUControlPanel+"\Colors" , "Background" , "50 240 0" , "REG_SZ")
	$=WriteValue($regHKCUSoftware+"\Microsoft\Windows\CurrentVersion\Explorer\Advanced" , "TaskbarSizeMove" , "0" , "REG_DWORD" )
	$=WriteValue($regHKCUSoftware+"\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting" , "2" , "REG_DWORD" )

	;****** Default Printer 
	$defprint = ReadValue($regHKCUSoftware+"\Lantack", "defaultprinter")
	$=WriteValue ($regHKCUSoftware+"\Microsoft\Windows NT\CurrentVersion\Windows", "device", $defprint, "REG_SZ")

	$StandardSettingsRadioButton.Value = 0
	$StandardSettingsRadioButton.Enabled = 0
EndFunction

;-------------------------------------------------------------------------------
; Tijdelijke mappen aanmaken
;-------------------------------------------------------------------------------
Function Tempfolders()
	$TempfoldersRadioButton.Value=1
	$=Progress( "Tijdelijke mappen worden aangemaakt")
	$=DbgMessage("Info", "Tijdelijke mappen aanmaken")

	$TempfoldersRadioButton.Value=0
	$TempfoldersRadioButton.Enabled=0
EndFunction

;-------------------------------------------------------------------------------
; Function: ConnectShare
; Usage: ConnectShare ("H:, \\PFSV1\Networking$, Logistics Procurement")
;-------------------------------------------------------------------------------
Function ConnectShare( $DriveDefinition )
	dim $arr, $i, $DriveLetter, $Share, $ShareDesc

	$arr = split( $DriveDefinition, "," )
	$DriveLetter = trim( $arr[0] )
	if UBound($arr)>0	$Share = trim( $arr[1] )	endif
	if UBound($arr)>1
		for $i = 2 to UBound($arr)
			$ShareDesc = $ShareDesc + "," + $arr[$i]
		next
		$ShareDesc = right( $SHareDesc, -1 )
	endif

	$=DbgMessage("Info","  - Disconnecting " + $DriveLetter + " on " + $Share)
;	Use $DriveLetter /delete
;	If @ERROR <> 0
;		DBGMessage ( "DisMountError", $DriveLetter)
;	EndIf
	If ($NT_mode = "no") 
		DelKey("HKEY_CURRENT_USER\Network\Persistent\" + $DriveLetter)
	EndIf
	$=Progress( "Connecting " + $DriveLetter + " to " + $Share)
	$=DbgMessage("Info","  - Connecting " + $DriveLetter + " on " + $Share)
	Use $DriveLetter $Share
	If @ERROR <> 0
		$=DBGMessage ( "MountError", $DriveLetter + " on " + $Share )
	EndIf
EndFunction 


;-------------------------------------------------------------------------------
; Function: DBGMessage
; Usage: DBGMessage( "Debug", "DuhhBugg" )
; DebugType : Info, Debug, Error
;-------------------------------------------------------------------------------
Function DBGMessage($DebugType, $DebugMessage, Optional $SError)
	Select
		Case $DebugLevel="Error"
			If $DebugType="Info" OR $DebugType="Debug"
				Return
			EndIf
		Case $DebugLevel="Info"
			If $DebugType="Debug"
				Return
			EndIf
	EndSelect
	
	If $DebugType="Error"
		$numerrors=$numerrors+1
	EndIf
	$NumMessages=$NumMessages + 1
	ReDim Preserve $DebugMessages[$NumMessages]
	
	$DebugTime="" + @Date + " - " + @Time +" >"
	$DebugText=$DebugType + " : " + $DebugMessage
	If $SError<>""
		 $DebugText=$DebugText + " | Additional Info: @SERROR"
	EndIf
	
	$DebugMessages[$NumMessages]=$DebugTime + $DebugText
	If $DebugFlag = $TRUE		 
		$DbgTextBox.Text=$DbgTextBox.Text + $DebugText + @CRLF
		Sleep $sleeptime
	EndIf		
EndFunction

;-------------------------------------------------------------------------------
;  DrawForms()
;-------------------------------------------------------------------------------
Function DrawForms()
	;-- Form --
	$Form = CreateObject("Kixtart.Form")
	$Form.Caption = "PoliForm Login Script"
	$Form.Width = 500
	$Form.Heigth = 500
	$Form.Center

	;-- Logo --
	$Logo=$Form.Controls.Add( "PictureBox" )
	$Logo.Left = 5
	$Logo.Top = 5
	$Logo.Width = 220
	$Logo.Height = 240
	$Logo.sizemode = 1
	$Logo.Picture = @scriptdir+"\reddev10.bmp"

	;-- Info Frame --
	$InfoFrame = $Form.Controls.Add( "GroupBox" )
	$InfoFrame.text = "Informatie"
	$InfoFrame.Left = 250
	$infoframe.Top 5
	$InfoFrame.Width = 240
	$InfoFrame.Heigth	= 120

	$ = AddTextbox( $InfoFrame, "Username", @USERID, 5, 15, 115, 15)
	$ = AddTextbox( $InfoFrame, "Full Name", @FULLNAME, 5, 30, 115, 15)
	$ = AddTextbox( $InfoFrame, "Terminal Server", @WKSTA, 5, 45, 115, 15)
	$ = AddTextbox( $InfoFrame, "Domain", @DOMAIN, 5, 60, 115, 15)
	$ = AddTextbox( $InfoFrame, "Tijd", @TIME, 5, 75, 115, 15)
	$ = AddTextbox( $InfoFrame, "Datum", @DATE, 5, 90, 115, 15)

	;-- Action Frame --
	$ActionFrame = $Form.Controls.Add( "GroupBox" )
	$ActionFrame.text = "Bewerkingen"
	$ActionFrame.Left = 250
	$actionFrame.Top = 125
	$ActionFrame.Widht = 240
	$ActionFrame.Height = 120

	$NewsRadioButton = $ActionFrame.Controls.Add("RadioButton")
	$NewsRadioButton.Text = "Bericht weergeven"
	$NewsRadioButton.Left = 5
	$NewsRadioButton.Top = 15
	$NewsRadioButton.Width = 230
	$NewsRadioButton.Height = 15

	$SharesRadioButton = $ActionFrame.Controls.Add("RadioButton")
	$SharesRadioButton.Text = "Netwerkverbindingen maken"
	$SharesRadioButton.Left = 5
	$SharesRadioButton.Top = 30
	$SharesRadioButton.Width = 230
	$SharesRadioButton.Height = 15

	$StandardSettingsRadioButton = $ActionFrame.Controls.Add("RadioButton")
	$StandardSettingsRadioButton.Text = "Standaard instellingen"
	$StandardSettingsRadioButton.Left = 5
	$StandardSettingsRadioButton.Top = 45
	$StandardSettingsRadioButton.Width = 230
	$StandardSettingsRadioButton.Height = 15

	$TempfoldersRadioButton = $ActionFrame.Controls.Add("RadioButton")
	$TempfoldersRadioButton.Text = "Tijdelijke mappen aanmaken"
	$TempfoldersRadioButton.Left = 5
	$TempfoldersRadioButton.Top = 60
	$TempfoldersRadioButton.Width = 230
	$TempfoldersRadioButton.Height = 15	
;-- Logging Frame --
	$NewsFrame = $Form.Controls.Add( "GroupBox" )
	$NewsFrame.text = "Nieuws"
	$NewsFrame.Left = 5
	$newsFrame.top = 250
	$NewsFrame.Width = 485
	$NewsFrame.height 150

	$NewsTextBox = $NewsFrame.Controls.Add( "TextBox" )
   	$NewsTextBox.Left = 10
	$NewsTextBox.top = 15
   	$NewsTextBox.Width = 465
	$NewsTextBox.Heigth = 130
	$NewsTextBox.BackColor = $Form.BackColor
	$NewsTextBox.MultiLine=1
	$NewsTextBox.Enable=0
	$NewsTextBox.Text=""
	$NewsTextBox.ScrollBars=2
	$NewsTextBox.Wordwrap=1

	;-- Progress Bar --
	$ProgressTextBox= $Form.Controls.Add( "TextBox" )
	$ProgressTextBox.Left = 5
	$ProgressTextBox.Top = 400
	$ProgressTextBox.Width = 200
	$ProgressTextBox.Heigth = 20
	$ProgressTextBox.Enable=0
	$ProgressTextBox.BackColor = $Form.BackColor	
	
	$ProgressBar = $Form.Controls.Add( "ProgressBar" )
	$ProgressBar.Left = 210
	$ProgressBar.Top = 400
	$ProgressBar.Width = 220
	$ProgressBar.Height = 20
	$ProgressBar.Style = 1

	;-- Clock --
	$CurrentTime=@Time
	$Clock = $Form.Controls.Add( "TextBox" )
	$clock.Left = 435
	$Clock.Top = 400
	$clock.Width = 55
	$clock.heigth = 20
	$Clock.Alignment=2
	$Clock.Enabled=0
	$Clock.BackColor=$Form.BackColor

	;-- ClockTimer --
	$Timer = $Form.Timer
	$Timer.Interval = 500
	$Timer.OnTick = "$=UpdateClock()"
	$Timer.start()

	$Form.Show
	If $DebugFlag=$True
	;-- DebugForm --
	$DbgForm = CreateObject("Kixtart.Form")
	$DbgForm.Caption = "DebugBox"
	$DbgForm.Left = 10
	$DbgForm.Top = 10
	$DbgForm.Width = 245
		$DbgForm.Heigth = 300

	$DbgTextBox=$DbgForm.Controls.add("TextBox")
	$DbgTextBox.Left = 5
	$DbgTextBox.Top = 5
	$DbgTextBox.Width = 230
	$DbgTextBox.Heigth 260
	$DbgTextBox.MultiLine=1
	$DbgTextBox.Enable=0
	$DbgTextBox.Text=""
	$DbgTextBox.ScrollBars=2
	$DbgTextBox.Wordwrap=1

	$CurrentX=0
	$CurrentY=0
	$DbgForm.Show

	;*********************************************************************************
	;*************************************************
	;**********************
	;Om het debugwindow weer te geven moet de ";" voor $DbgForm.Show weggehaald worden
	;**********************
	;*************************************************
	;*********************************************************************************
	EndIf
EndFunction

function AddTextbox( $GroupBox, $label, $textvalue, $x1, $y1, $width, $height )
	dim $lbl, $textbox

	$lbl = $GroupBox.Controls.Add( "Label" )
	$lbl.text = $label
	$lbl.Left = $x1
	$lbl.Top = $y1
	$lbl.Width = $width
	$lbl.height $height

	$textbox = $GroupBox.Controls.Add( "TextBox" )
	$textbox.text = $textvalue
	$textbox.Width = $width
	$textbox.Height = $height
	$textbox.Left = $x1+$width
	$textbox.Top = $y1
	$textbox.BackColor=$Form.BackColor
	$textbox.Enabled=0
endfunction

function Trim( $str )
	$trim = LTrim( RTrim($str) )
endfunction

this is the code that i use

Top
#212222 - 2017-01-17 03:18 PM Re: can some one help me [Re: Powerdrib]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
But what did you change or fix so that it worked?
Top
#212223 - 2017-01-17 10:47 PM Re: can some one help me [Re: Allen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Agreed - we all learn from both our own and other's mistakes. \:\)

When anyone posts their failed and working code and a note about what made the difference it may be the Aha! moment for many others.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#212225 - 2017-01-18 12:10 PM Re: can some one help me [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
The only thing I can see is that he omitted the event handling for the form completely..
Will work for this special case as noone clicks into this kind of form anyway.
_________________________



Top
#212230 - 2017-01-18 04:48 PM Re: can some one help me [Re: Jochen]
Powerdrib Offline
Fresh Scripter

Registered: 2016-12-14
Posts: 26
Loc: Holland
the errors i was getting where mainly the location thing
and i've deleted this
 Code:
Function Progress( $ProgressText, optional $Step )
	If $Step=""
		$Step=$progressstep
	EndIf
	$ProgressTextBox.Text = $ProgressText
	If $ProgressBar.Value + $Step < 101
		$ProgressBar.Value = $ProgressBar.Value+$Step
		If $DebugFlag = $TRUE		 
			Sleep $sleeptime
		EndIf
	Else
		$ProgressBar.Value=100
	EndIf
	$=Execute($Form.DoEvents())
EndFunction


because it was for the progressbar and to be honest it wasnt inportant


Edited by Powerdrib (2017-01-18 04:48 PM)

Top
#212234 - 2017-01-19 10:37 AM Re: can some one help me [Re: Powerdrib]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
I would even consider, if I were in your place, to let go of anything visible to the user, as this is a logon script anyway.
The only thing that counts here is speed, not bells and whistles ;\)
_________________________



Top
Page 2 of 2 <12


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

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.051 seconds in which 0.018 seconds were spent on a total of 14 queries. Zlib compression enabled.

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