Powerdrib
(Fresh Scripter)
2016-12-14 10:23 AM
can some one help me

$InfoFrame = $Form.Frame ("Informatie", 250,5,240,120)
i get the error "Expected ')'" but i cant find where I must place it
if someone is kind enough to help that would be great


Arend_
(MM club member)
2016-12-14 10:56 AM
Re: can some one help me

It looks like somewhere in the script you've missed a " or a '.
Apart from that try to remove the space before the "(".
 Code:
$InfoFrame = $Form.Frame("Informatie", 250,5,240,120)



Arend_
(MM club member)
2016-12-14 11:01 AM
Re: can some one help me

If you're using KiXforms.net, I'm sure "Frame" is not a member of the Form object.

Powerdrib
(Fresh Scripter)
2016-12-14 11:25 AM
Re: can some one help me

 Originally Posted By: Arend_
If you're using KiXforms.net, I'm sure "Frame" is not a member of the Form object.


I used your code but I get still the same error
I'm using Kixstarter as my editor


Arend_
(MM club member)
2016-12-14 11:43 AM
Re: can some one help me

I used your code but I get still the same error
I'm using Kixstarter as my editor [/quote]

Could you paste your entire code here?
And please use code tags.


Mart
(KiX Supporter)
2016-12-14 11:45 AM
Re: can some one help me

Is the code in your original post all there is? If not, can you post the full script so we can help to find the error. It looks like the issue is caused by another line in the script.

Edit: Hmmm....that’s what you get for starting a phone call when typing a reply. Arend beat me to it.


Powerdrib
(Fresh Scripter)
2016-12-14 11:55 AM
Re: can some one help me

 Code:
;**************************************************************
;** Script:	Login Script
;** Version:	1.0
;** 
;** Author:	Mathieu van der Heijden
;** E-mail:	xxxxxxxxxxxxx@hotmail.com
;**
;**************************************************************

;Break Off
Break On

;Default Settings
$os=""
$os_type=""
$os_service_pack=""
$progressstep=3
$sleeptime=0
$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("\\dc1\netlogon")

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

;Main Application

; Draw Form
	DrawForms()

; Show News
	ShowNews()
	
; Connecting Drives
	ConnectDrives()

; Set machine to standard Settings
	StandardSettings()

; Create Temp Folders and Files
	Tempfolders()

; 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()
	$NewsRadioButton.Value=1
	Progress( "Retrieving News")
	If Open(1, $FileLocation + "\News.txt") = 0
		$NewsLine = ReadLine(1)
		While @ERROR=0
			$NewsTextBox.Text=$NewsTextBox.Text + $NewsLine + Chr(13) + Chr(10)
			$NewsLine = ReadLine(1)
		Loop
		If Close (1) <> 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:")
	Groepbepaling()
	ConnectHomeDrive()
	ConnectDefaultDrives()
	$SharesRadioButton.Value=0
	$SharesRadioButton.Enabled =0	
EndFunction

;***********************************************************************
;**
;**  Connect Home Drive
;**
Function ConnectHomeDrive()
	;******************************	
	; Home DriveShares
	;******************************	
	Progress( "Connecting H:")
	DbgMessage("Info","  - Y: = " + "\\dc1\users\$userid")
	
	Use H: /delete
	If ($NT_mode = "no") 
		DelKey("HKEY_CURRENT_USER\Network\Persistent\Y")
	EndIf
	Use H: "\\dc1\users\$userid"
		If @ERROR = 0
			DbgMessage ("Info","Home Share Connected")
		Else
			DBGMessage ("HOMESHR","No Home Share available")
			Return
		EndIf
EndFunction

;***********************************************************************
;**
;**  Connect DefaultShares to Drives
;**
Function ConnectDefaultDrives()
	;******************************	
	; Default DriveShares
	;******************************
	If Exist($FileLocation + "\shares.ini")
		For $x = 1 to 10 
			$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", "EVERYONE", "drive" + $x)
			If @ERROR = 0
				If $DriveDefinition<>""
			  		ConnectShare($DriveDefinition)
				EndIf
			Else
				Return
			EndIf
		Next
	EndIf
EndFunction

;***********************************************************************
;**
;**  Zorgen dat je een bepaalde groupshare krijgt door groeplidmaatschap
;**  
Function Groepbepaling()
	if ingroup ("Directie") $Group="Directie" ConnectGroupDrives() endif
	if ingroup ("Networking") $Group="Networking" ConnectGroupDrives() endif
Endfunction


;***********************************************************************
;**
;**  Connect GroupShares to Drives
;**
Function ConnectGroupDrives()
	;******************************	
	; GroupShares
	;******************************
	If Exist($FileLocation + "\shares.ini")
	DBGMessage ("Testing Groupshares",$group)
		If $group<>""
			For $x = 1 to 10 
				$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", $group, "drive" + $x)
				If @ERROR = 0
					If $DriveDefinition<>""
						ConnectShare($DriveDefinition)
					EndIf
				Else
					Return
				EndIf
			Next 
		EndIf
	EndIf
EndFunction

;************************************************************************
;**
;** Set machine to default settings
;**
Function StandardSettings()
	$StandardSettingsRadioButton.Value=1
	Progress( "Setting Standard Settings")
	DbgMessage("Info","Setting standard settings:")	
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iCountry" , "31" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iCurrency" , "2" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iDate" , "1" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iFirstDayOfWeek" , "0" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iFirstWeekOfYear" , "2" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iMeasure" , "0" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iNegCurr" , "11" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iTime" , "1" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "Local" , "413" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "s1159" , "" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "s2359" , "" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sCountry" , "Netherlands" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sCurrency" , "€" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sDate" , "-" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sDecimal" , "," , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sLanguage" , "NLD" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sList" , ";" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sMonDecimalSep" , "," , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sMonThousandSep" , "." , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sShortDate" , "dd-MM-yyyy" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sThousand" , "." , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sTimeFormat" , "H:mm:ss" , "REG_SZ")
		writevalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" , "TaskbarSizeMove" , "0" , "REG_DWORD" )
		writevalue( "HKEY_CURRENT_USER\Control Panel\Colors" , "Background" , "50 240 0" , "REG_SZ")
		writevalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting" , "2" , "REG_DWORD" )

		;****** Default Printer 
		$defprint = ReadValue("HKEY_CURRENT_USER\Software\Lantack", "defaultprinter")
		WriteValue ("HKEY_CURRENT_USER\Software\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:, \\OXYGEN\LOG_Procurement$, Logistics Procurement")
;**
Function ConnectShare( $DriveDefinition)
	$DriveLetter=SubStr($DriveDefinition,1,InStr($DriveDefinition,",")-1)
	$DriveDefinition=Ltrim(Rtrim(SubStr($DriveDefinition,InStr($DriveDefinition,",")+1)))
	$Share=Ltrim(Rtrim(SubStr($DriveDefinition,1,InStr($DriveDefinition,",")-1)))
	$ShareDesc=Ltrim(Rtrim(SubStr($DriveDefinition,InStr($DriveDefinition,",")+1)))
	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 

;***********************************************************************
;**
;**  Update Progress Bar
;**
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

;************************************************************
;** 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.Height = 500
	If $DebugFlag=$True
		$Form.Left=(1280 / 2) - (500 / 2)
		$Form.Top=(1024  / 2) - (400 /2 )	
	Else
		$Form.Center
	EndIf
	; ClockTimer
		$Timer = $Form.Timer("600,0,0,15,15")
		$Timer.OnTimer = "UpdateClock()"

; Logo
	$Logo=$Form.PictureBox
	$Logo.Left=5
	$Logo.Top=5
	$Logo.Width=203
	$Logo.Height=239
	$Logo.Picture="reddev10.bmp"

; Info Frame 
	$InfoFrame = $Form.Frame("Informatie", 250,5,240,120)
		
	$UserIdLbl = $InfoFrame.Label("Username", 5, 15, 115, 15)
	$UserIdBox = $InfoFrame.TextBox(@USERID	, 120, 15, 115, 15)
	$UserIdBox.BackColor=$Form.BackColor
	$UserIdBox.Enabled=0
	$FullNameLbl = $InfoFrame.Label("Full Name", 5, 30, 115, 15)
	$FullNameBox = $InfoFrame.TextBox(@FULLNAME, 120, 30, 115, 15)
	$FullNameBox.BackColor=$Form.BackColor
	$FullNameBox.Enabled=0
	$WorkStnLbl = $InfoFrame.Label("Terminal Server", 5, 45, 115, 15)
	$WorkStnBox = $InfoFrame.TextBox(@WKSTA, 120, 45, 115, 15)
	$WorkStnBox.BackColor=$Form.BackColor
	$WorkStnBox.Enabled=0
	$DomainLbl = $InfoFrame.Label("Domein", 5, 60, 115, 15)
	$DomainBox = $InfoFrame.TextBox(@DOMAIN, 120, 60, 115, 15)
	$DomainBox.BackColor=$Form.BackColor
	$DomainBox.Enabled=0
	$TimeLbl = $InfoFrame.Label("Tijd", 5, 75, 115, 15)
	$TimeBox = $InfoFrame.TextBox(@TIME, 120, 75, 115, 15)
	$TimeBox.BackColor=$Form.BackColor
	$TimeBox.Enabled=0
	$DateLbl = $InfoFrame.Label("Datum", 5, 90, 115, 15)
	$DateBox = $InfoFrame.TextBox(@DATE, 120, 90, 115, 15)
	$DateBox.BackColor=$Form.BackColor
	$DateBox.Enabled=0

; Action Frame
	$ActionFrame = $Form.Frame("Bewerkingen",250,125,240,120)
	
	$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)

; Logging Frame
	$NewsFrame = $Form.Frame("Nieuws",5,250,485,150)
	
	$NewsTextBox = $NewsFrame.TextBox(",5,15,475,130")
	$NewsTextBox.BackColor = $Form.BackColor
	$NewsTextBox.MultiLine=1
	$NewsTextBox.Enable=0
	$NewsTextBox.Text=""
	$NewsTextBox.ScrollBars=2
	$NewsTextBox.Wordwrap=1

; Progress Bar
	$ProgressTextBox= $Form.TextBox
	$ProgressTextBox.Left=5
	$ProgressTextBox.Top=400
	$ProgressTextBox.Width=200
	$ProgressTextBox.Height=20
	$ProgressTextBox.Enable=0
	$ProgressTextBox.BackColor = $Form.BackColor	
	
	$ProgressBar = $Form.ProgressBar
	$ProgressBar.Left=210
	$ProgressBar.Top=400
	$ProgressBar.Width=220
	$ProgressBar.Height=20
	$ProgressBar.Style = 1

; Clock
	$CurrentTime=@Time
	$Clock = $Form.TextBox("",435,400,55,20)
	$Clock.Alignment=2
	$Clock.Enabled=0
	$Clock.BackColor=$Form.BackColor

$Form.Show
; DebugForm
If $DebugFlag=$True
	$DbgForm = CreateObject("Kixtart.Form")	
	$DbgForm.Caption = "DebugBox"
	$DbgForm.Width = 300
	$DbgForm.Height = 300
	$DbgForm.Left=1280 - 300
	$DbgFOrm.Top=1024 - 300
	
	$DbgTextBox=$DbgForm.TextBox()
	$DbgTextBox.Left=5
	$DbgTextBox.Top=5
	$DbgTextBox.Width=235
	$DbgTextBox.Height=205
	$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


here is the full code


Arend_
(MM club member)
2016-12-14 12:52 PM
Re: can some one help me

I can see that it's using the regular KiXforms, not KiXforms.Net.
However in the helpfile I have "Frame" is also not listed as a member of the Form class.
The code itself seems sound, I can't detect a missing bracket or quotation mark.

So to me it seems the error is related to the "Frame" member that does not exist when you call it with $Form.Frame.
Maybe someone else can shed more light on this.

Update, I've tested the simple code:
 Code:
$Form = CreateObject("Kixtart.Form")
? @SERROR
$InfoFrame = $Form.Frame("Informatie", 250,5,240,120)
? @SERROR

This seems to work fine so that indicated that the "Frame" part does indeed work.
I'll need more time to sift through the entire code.


Arend_
(MM club member)
2016-12-14 01:02 PM
Re: can some one help me

Try to reregister your kixforms.dll:
 Code:
regsvr32 -u kixforms.dll
regsvr32 kixforms.dll


Powerdrib
(Fresh Scripter)
2016-12-14 01:10 PM
Re: can some one help me

 Originally Posted By: Arend_
Try to reregister your kixforms.dll:
 Code:
regsvr32 -u kixforms.dll
regsvr32 kixforms.dll
and how do i do that i'm a noob with kixtart


Arend_
(MM club member)
2016-12-14 01:11 PM
Re: can some one help me

 Originally Posted By: Powerdrib
and how do i do that i'm a noob with kixtart

From Command Prompt, you type that in the black box :P


Powerdrib
(Fresh Scripter)
2016-12-14 01:17 PM
Re: can some one help me

 Originally Posted By: Arend_
 Originally Posted By: Powerdrib
and how do i do that i'm a noob with kixtart

From Command Prompt, you type that in the black box :P
i have tried that and it didnt work still the same error "expected ')'"


ShaneEP
(MM club member)
2016-12-14 03:29 PM
Re: can some one help me

This may or may not be an issue, but it doesnt look right to me...
 Code:
$Timer = $Form.Timer("600,0,0,15,15")
$Timer.OnTimer = "UpdateClock()"
maybe should be
 Code:
$Timer = $Form.Timer()
$Timer.Interval = 600 ; number of milliseconds
$Timer.OnTick = "UpdateClock()"


Powerdrib
(Fresh Scripter)
2016-12-14 03:36 PM
Re: can some one help me

 Originally Posted By: ShaneEP
This may or may not be an issue, but it doesnt look right to me...
 Code:
$Timer = $Form.Timer("600,0,0,15,15")
$Timer.OnTimer = "UpdateClock()"
maybe should be
 Code:
$Timer = $Form.Timer()
$Timer.Interval = 600 ; number of milliseconds
$Timer.OnTick = "UpdateClock()"
thanks shane I changed it and it still worked


ShaneEP
(MM club member)
2016-12-14 03:38 PM
Re: can some one help me

Like Arend said...That error usually lead to syntax error. Maybe start commenting out large chunks of the script until it works to narrow it down.

Sorry I would help more, but I don't have the kixforms dll registered on my work computer.


Powerdrib
(Fresh Scripter)
2016-12-14 03:43 PM
can some one help me

 Code:
$InfoFrame = $Form.Frame("Informatie", 250,5,240,120)
		
	$UserIdLbl = $InfoFrame.Label("Username", 5, 15, 115, 15)
	$UserIdBox = $InfoFrame.TextBox(@USERID	, 120, 15, 115, 15)
	$UserIdBox.BackColor=$Form.BackColor
	$UserIdBox.Enabled=0
	$FullNameLbl = $InfoFrame.Label("Full Name", 5, 30, 115, 15)
	$FullNameBox = $InfoFrame.TextBox(@FULLNAME, 120, 30, 115, 15)
	$FullNameBox.BackColor=$Form.BackColor
	$FullNameBox.Enabled=0
	$WorkStnLbl = $InfoFrame.Label("Terminal Server", 5, 45, 115, 15)
	$WorkStnBox = $InfoFrame.TextBox(@WKSTA, 120, 45, 115, 15)
	$WorkStnBox.BackColor=$Form.BackColor
	$WorkStnBox.Enabled=0
	$DomainLbl = $InfoFrame.Label("Domein", 5, 60, 115, 15)
	$DomainBox = $InfoFrame.TextBox(@DOMAIN, 120, 60, 115, 15)
	$DomainBox.BackColor=$Form.BackColor
	$DomainBox.Enabled=0
	$TimeLbl = $InfoFrame.Label("Tijd", 5, 75, 115, 15)
	$TimeBox = $InfoFrame.TextBox(@TIME, 120, 75, 115, 15)
	$TimeBox.BackColor=$Form.BackColor
	$TimeBox.Enabled=0
	$DateLbl = $InfoFrame.Label("Datum", 5, 90, 115, 15)
	$DateBox = $InfoFrame.TextBox(@DATE, 120, 90, 115, 15)
	$DateBox.BackColor=$Form.BackColor
	$DateBox.Enabled=0

; Action Frame
	$ActionFrame = $Form.Frame("Bewerkingen",250,125,240,120)
	
	$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)

; Logging Frame
	$NewsFrame = $Form.Frame("Nieuws",5,250,485,150)
	
	$NewsTextBox = $NewsFrame.TextBox(",5,15,475,130")
in all these line the same error comes up so maybe its has something to do with the numbers at the end because if I remove the numbers from one line its says that the error is in the next line


Mart
(KiX Supporter)
2016-12-14 05:12 PM
Re: can some one help me

Almost time to head home here but after dinner I'll copy and paste your code and do some checking.

ChristopheM
(Hey THIS is FUN)
2016-12-14 09:19 PM
Re: can some one help me

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 !!!


Mart
(KiX Supporter)
2016-12-14 09:27 PM
Re: can some one help me

Not sure why but I have not been able to get a Frame working with your code. As far as I can see a frame is more or less the same as a multiline textbox (but I might be wrong as I never used frames).

This works fine for me.

 Code:
Break on

; Form
$Form = CreateObject("Kixtart.Form")
$Form.Caption = "Test"
$Form.Width = 500
$Form.Height = 500
$Form.Center

$TextBox = $Form.Controls.TextBox() 
$TextBox.Dock = Fill 
$TextBox.Multiline = "True" 
$TextBox.ScrollBars = Vertical 
$TextBox.Text = "" 
$TextBox.WordWrap = "True" 

$Form.show

AddText()

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

Function AddText()
	$timer = 0
		
	For $timer = 0 to 20
		If $timer = 0
			$textBox.text = "Line: " + $timer
		Else
			$textBox.text = $TextBox.Text + @CRLF + "Line: " + $timer
		EndIf
		Sleep 1
	Next
EndFunction


It is also not that easy to test your script as it does things on my test system that I so not want. Just like Arend I do not see any missing or unmatched quotes or other weird things in your code.


Glenn BarnasAdministrator
(KiX Supporter)
2016-12-14 09:29 PM
Re: can some one help me

I ran the code through KGen to perform a Sanity check. Only warnings were from Undefined and Unused variables. Not best practice, but not technically an error either. The CSV data below represents the warning, varname, function and line where first referenced.
 Code:
Undeclared variable.,Implicit declaration as GLOBAL!,$os,Main,15
Undeclared variable.,Implicit declaration as GLOBAL!,$os_type,Main,16
Undeclared variable.,Implicit declaration as GLOBAL!,$os_service_pack,Main,17
Undeclared variable.,Implicit declaration as GLOBAL!,$progressstep,Main,18
Undeclared variable.,Implicit declaration as GLOBAL!,$sleeptime,Main,19
Undeclared variable.,Implicit declaration as GLOBAL!,$numerrors,Main,20
Undeclared variable.,Implicit declaration as GLOBAL!,$userid,Main,24
Undeclared variable.,Implicit declaration as GLOBAL!,$Updates,Main,25
Undeclared variable.,Implicit declaration as GLOBAL!,$RunUpdates,Main,26
Undeclared variable.,Implicit declaration as GLOBAL!,$False,Main,26
Undeclared variable.,Implicit declaration as GLOBAL!,$tmpdir,Main,27
Undeclared variable.,Implicit declaration as GLOBAL!,$systemdrive,Main,28
Undeclared variable.,Implicit declaration as GLOBAL!,$windir,Main,29
Undeclared variable.,Implicit declaration as GLOBAL!,$comspec,Main,30
Undeclared variable.,Implicit declaration as GLOBAL!,$Filelocation,Main,31
Undeclared variable.,Implicit declaration as GLOBAL!,$NumMessages,Main,34
Undeclared variable.,Implicit declaration as GLOBAL!,$ProgressBar,Main,55
Undeclared variable.,,$Clock,UpdateClock,67
Undeclared variable.,,$NewsRadioButton,ShowNews,77
Undeclared variable.,,$NewsLine,ShowNews,80
Undeclared variable.,,$NewsTextBox,ShowNews,82
Undeclared variable.,,$SharesRadioButton,ConnectDrives,100
Undeclared variable.,,$NT_mode,ConnectHomeDrive,122
Undeclared variable.,,$x,ConnectDefaultDrives,143
Undeclared variable.,,$DriveDefinition,ConnectDefaultDrives,144
Undeclared variable.,,$Group,Groepbepaling,161
Undeclared variable.,,$group,ConnectGroupDrives,175
Undeclared variable.,,$x,ConnectGroupDrives,177
Undeclared variable.,,$DriveDefinition,ConnectGroupDrives,178
Undeclared variable.,,$StandardSettingsRadioButton,StandardSettings,196
Undeclared variable.,,$defprint,StandardSettings,226
Undeclared variable.,,$TempfoldersRadioButton,Tempfolders,238
Undeclared variable.,,$DriveLetter,ConnectShare,251
Undeclared variable.,,$Share,ConnectShare,253
Undeclared variable.,,$ShareDesc,ConnectShare,254
Undeclared variable.,,$NT_mode,ConnectShare,260
Undeclared variable.,,$ProgressTextBox,Progress,279
Undeclared variable.,,$DebugFlag,Progress,282
Undeclared variable.,,$TRUE,Progress,282
Undeclared variable.,,$,Progress,288
Undeclared variable.,,$Form,Progress,288
Undeclared variable.,,$DebugLevel,DBGMessage,298
Undeclared variable.,,$DebugTime,DBGMessage,314
Undeclared variable.,,$DebugText,DBGMessage,315
Undeclared variable.,,$DebugFlag,DBGMessage,321
Undeclared variable.,,$TRUE,DBGMessage,321
Undeclared variable.,,$DbgTextBox,DBGMessage,322
Undeclared variable.,,$Form,DrawForms,334
Undeclared variable.,,$DebugFlag,DrawForms,338
Undeclared variable.,,$True,DrawForms,338
Undeclared variable.,,$Timer,DrawForms,345
Undeclared variable.,,$Logo,DrawForms,349
Undeclared variable.,,$InfoFrame,DrawForms,357
Undeclared variable.,,$UserIdLbl,DrawForms,359
Undeclared variable.,,$UserIdBox,DrawForms,360
Undeclared variable.,,$FullNameLbl,DrawForms,363
Undeclared variable.,,$FullNameBox,DrawForms,364
Undeclared variable.,,$WorkStnLbl,DrawForms,367
Undeclared variable.,,$WorkStnBox,DrawForms,368
Undeclared variable.,,$DomainLbl,DrawForms,371
Undeclared variable.,,$DomainBox,DrawForms,372
Undeclared variable.,,$TimeLbl,DrawForms,375
Undeclared variable.,,$TimeBox,DrawForms,376
Undeclared variable.,,$DateLbl,DrawForms,379
Undeclared variable.,,$DateBox,DrawForms,380
Undeclared variable.,,$ActionFrame,DrawForms,385
Undeclared variable.,,$NewsRadioButton,DrawForms,387
Undeclared variable.,,$SharesRadioButton,DrawForms,388
Undeclared variable.,,$StandardSettingsRadioButton,DrawForms,389
Undeclared variable.,,$TempfoldersRadioButton,DrawForms,390
Undeclared variable.,,$NewsFrame,DrawForms,393
Undeclared variable.,,$NewsTextBox,DrawForms,395
Undeclared variable.,,$ProgressTextBox,DrawForms,404
Undeclared variable.,,$CurrentTime,DrawForms,420
Undeclared variable.,,$Clock,DrawForms,421
Undeclared variable.,,$DbgForm,DrawForms,429
Undeclared variable.,,$DbgTextBox,DrawForms,436
Undeclared variable.,,$CurrentX,DrawForms,447
Undeclared variable.,,$CurrentY,DrawForms,448
Variable declared but not referenced.,Declaration line is referenced above.,$UpdateSoftware,Global,23
 80 warnings generated, 460 lines processed.,,,,
Glenn


Powerdrib
(Fresh Scripter)
2016-12-15 09:18 AM
Re: can some one help me

 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


Powerdrib
(Fresh Scripter)
2016-12-15 09:21 AM
Re: can some one help me

 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


Powerdrib
(Fresh Scripter)
2016-12-15 09:39 AM
Re: can some one help me

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 ')'"


ShaneEP
(MM club member)
2016-12-15 03:45 PM
Re: can some one help me

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


Powerdrib
(Fresh Scripter)
2016-12-15 05:13 PM
Re: can some one help me

 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"


ChristopheM
(Hey THIS is FUN)
2016-12-15 08:36 PM
Re: can some one help me

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


Powerdrib
(Fresh Scripter)
2016-12-20 11:51 AM
Re: can some one help me

 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


ShaneEP
(MM club member)
2016-12-20 03:22 PM
Re: can some one help me

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


Powerdrib
(Fresh Scripter)
2016-12-20 03:49 PM
Re: can some one help me

 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


AllenAdministrator
(KiX Supporter)
2016-12-22 06:02 PM
Re: can some one help me

Are you sure you have registered kixforms on the PC you are running the script?

Powerdrib
(Fresh Scripter)
2017-01-10 09:16 AM
Re: can some one help me

yes i have registered kixforms but it will still doesn't work


Powerdrib
(Fresh Scripter)
2017-01-16 02:33 PM
Re: can some one help me

the code now works so everyone that helped thank you

AllenAdministrator
(KiX Supporter)
2017-01-16 03:01 PM
Re: can some one help me

Please share your/the solution.

Powerdrib
(Fresh Scripter)
2017-01-17 08:02 AM
Re: can some one help me

 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


AllenAdministrator
(KiX Supporter)
2017-01-17 03:18 PM
Re: can some one help me

But what did you change or fix so that it worked?

Glenn BarnasAdministrator
(KiX Supporter)
2017-01-17 10:47 PM
Re: can some one help me

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


JochenAdministrator
(KiX Supporter)
2017-01-18 12:10 PM
Re: can some one help me

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.


Powerdrib
(Fresh Scripter)
2017-01-18 04:48 PM
Re: can some one help me

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


JochenAdministrator
(KiX Supporter)
2017-01-19 10:37 AM
Re: can some one help me

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 ;\)