Page 1 of 2 12>
Topic Options
#141007 - 2005-06-06 11:54 AM Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
hello,

I have a problem with my login script everything is working exept selecting group for groupshares. can anyone help me?
here is the logon.bat
Code:
 @ECHO OFF
:BATSTART
SET KIXDIR=%WINDIR%
SET KIXSCRIPT=\\homesrvr\NETLOGON\LOGON.KIX
SET KIXVER=KIXFORMS_001.TAG

REM ---------------------------------------------------------------------
IF NOT EXIST %KIXDIR%\NUL MKDIR %KIXDIR%

IF EXIST %KIXDIR%\%KIXVER% GOTO KIXCOPIED
DEL %KIXDIR%\*.TAG >NUL
COPY %0\WKIX32.EXE %KIXDIR% /Y >NUL
COPY %0\KIX32.EXE %KIXDIR% /Y >NUL
COPY %0\KX16.DLL %KIXDIR% /Y >NUL
COPY %0\KX32.DLL %KIXDIR% /Y >NUL
COPY %0\KX95.DLL %KIXDIR% /Y >NUL
COPY %0\KIXFORMS.DLL %KIXDIR% /Y >NUL
REGSVR32 /S %KIXDIR%\kixforms.dll
ECHO KIXTART INSTALLED >%KIXDIR%\%KIXVER%

:KIXCOPIED
WKIX32.exe %KIxscript% $group=ICT Admin <----- this is the group, but then you must make for every group a logon.bat (is there another way?)
:EXIT


Connectgroupdrives
Code:
 
Function ConnectGroupDrives()
;******************************
; GroupShares
;******************************
If Exist($FileLocation + "\shares.ini")
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


here is the shares.ini
Code:

[ICT Admin]
Drive1="S:, \\homesrvr02\IT$, ICT"

[SG Sales]
Drive1="S:, \\homesrvr\Sales$, Sales"




greets,

tim

Top
#141008 - 2005-06-06 01:50 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
where is this connectshare() ?
_________________________
!

download KiXnet

Top
#141009 - 2005-06-06 02:10 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
here is the complete code
Code:
$TRUE 		= 1
$FALSE = 0
If $Debug=1
$DebugFlag = 1
Else
$DebugFlag = 0
EndIf
$DebugLevel = "Info" ; Info, Debug, Error

$AdminEmail = "??@??.nl" ; Where to send all of the warning messages
$MailServer = "172.27.1.8"

$Lserver = homesrvr
;$LServer = "homesrvr"
$LoggingLocation="\\homesrvr\logging$"
$FileLocation="\\homesrvr\netlogon"
;$FileLocation=@LDRIVE + ""
;$FileLocation="."

;************************************************************

;Break Off
Break On

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

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

;Main Application

; Draw Form
DrawForms()
; Get OperatingSystemInformation
OperatingSystem()
$OSBox.Text=SubStr($os,1,22)
; Show News
ShowNews()
; Syncing Time
SyncTime()

; Connecting Drives
ConnectDrives()

; Set machine to stanard Settings
StandardSettings()

; Write Log File
WriteLogFile()

; Fill Progressbar
While $ProgressBar.Value < 100
Progress("Klaar met uitvoeren van script",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( "Ontvangen van nieuws")
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","Nieuws bestand kon niet worden gevonden", @SError)
EndIf
Else
DbgMessage("Debug","Geen Nieuws")
EndIf
$NewsRadioButton.Value=0
$NewsRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Syncronize the local system time with the logon server. The PDC
;** server syncronizes with NTP server
;**
Function SyncTime()
$TimeRadioButton.Value=1
DBGMessage ("Info", "Synchroniseren van de Tijd:" )
Progress( "Sync Tijd")
If $NT_Mode="yes"
SetTime "\\" + $Lserver
If @ERROR<>0
DBGMessage ("Error", " - Fout bij het zoeken van de Tijd Server : " + $Lserver )
Else
DbgMessage("Info"," - Tijd gesynchroniseerd met : " + $Lserver)
EndIf
EndIf
$TimeRadioButton.Value=0
$TimeRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Connect Shares to Drives
;**
Function ConnectDrives()
$SharesRadioButton.Value=1
Progress( "Verbinden met shares")
DbgMessage("Info","Verbinden van Shares:")
ConnectHomeDrive()
ConnectDefaultDrives()
ConnectGroupDrives()
$SharesRadioButton.Value=0
$SharesRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Connect Home Drive
;**
Function ConnectHomeDrive()
;******************************
; Home DriveShares
;******************************
Progress( "Verbinden met L:")
DbgMessage("Info"," - L: = " + @HOMESHR)

Use L: /delete
If ($NT_mode = "no")
DelKey("HKEY_CURRENT_USER\Network\Persistent\H")
EndIf
Use L: "\\homesrvr\@USERID$$"
If @ERROR = 0
DbgMessage ("Info","Verbonden Persoonlijke Drive")
Else
DBGMessage ("HOMESHR","Persoonlijke Drive niet beschikbaar")
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", "ALG", "drive" + $x)
If @ERROR = 0
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Else
Return
EndIf
Next
EndIf
EndFunction

;***********************************************************************
;**
;** Connect GroupShares to Drives
;**
Function ConnectGroupDrives()
;******************************
; GroupShares
;******************************
If Exist($FileLocation + "\shares.ini")
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
EndIfEndFunction

;************************************************************************
;**
;** Set machine to default settings
;**
Function StandardSettings()
$StandardSettingsRadioButton.Value=1
Progress( "Standaard settings instellen")
DbgMessage("Info","Instellen van standaard instellingen:")
DisablePWDCaching()
; ScreenSaver
; Auto Logoff MfgPro Gui Client

$StandardSettingsRadioButton.Value=0
$StandardSettingsRadioButton.Enabled=0
EndFunction
;************************************************************************
;************************************************************************
;**
;** Disable Password Caching on Win9x machines
;** Password only has to be set for Network not for local machine anymore
;**
Function DisablePWDCaching()
DbgMessage("Info","Disable Password Caching Win9x")

If (($OS = "Win95") OR ($OS = "Win98"))
Progress( "Disable Password Caching")
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK", "DisablePwdCaching","1","REG_SZ")
Else
EndIf
Else
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES")
If @ERROR = 0
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK", "DisablePwdCaching","1","REG_SZ")
Else
EndIf
Else
AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
EndIf
Else
AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES")
EndIf
EndIf
EndFunction ()

;************************************************************************
;**
;** Used to send email to the NT Administrator defined in $AdminEmail.
;** Attaches a copy of the local $DebugFile to the message so we can see
;** if there's a history of problems on the machine.
;**
;** Interprets the user's email address from their logon name. Both
;** logon names as well as email addresses are based on the employee's
;** insurance (employee) number.
;**
Function SendAdminMail()
If Len(DebugMessages)>1
Progress( "Verzenden van debug repport")
$UserEmail = @USERID + "@@" + $MailServer
; REM Run "POSTIE.exe -host:$MailServer -to:$AdminEmail -from:$UserEmail -s:Logon_Script_Error_on_@WKSTA -msg:" + Chr(34) + "$DebugMessages"
EndIf
EndFunction

;************************************************************
;** Function: ConnectShare
;** Usage: ConnectShare ("L:, \\homesrvr\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( "Verbinden " + $DriveLetter + " naar " + $Share)
DbgMessage("Info"," - Verbinden " + $DriveLetter + " aan " + $Share)
Use $DriveLetter $Share
If @ERROR <> 0
DBGMessage ( "Fout bij het verbinden", $DriveLetter + " aan " + $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", "This is a debug Message" )
;** 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

;************************************************************
;** Function: WriteLogfile
;** Usage: WriteLogFIle()
;**
Function WriteLogFile()
Display DebugMessage
$WriteLogFileRadioButton.Value=1
Progress( "Writing Logfile")
$LogFile=$LoggingLocation + "\" + @Wksta + ".log"
If Exist($LogFile)
If GetFileSize($LogFile) > 1024 * 1024
Del($LogFile)
EndIf
EndIf

$NumMessages=$NumMessages + 1
ReDim PRESERVE $DebugMessages[$NumMessages]
$DebugMessages[$NumMessages]="-END----------------------------"

If Open(1, $LogFile,5) = 0
For $x=0 to $NumMessages
If WriteLine(1, $DebugMessages[$x] + @CRLF)<>0
DbgMessage("Error","DebugLine could not be written")
EndIf
Next
If Close(1)<>0
DbgMessage("Error","Log File could not be closed")
EndIf
Else
DbgMessage("Debug","Log file could not be written")
EndIf
$WriteLogFileRadioButton.Value=0
$WriteLogFileRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** calculates OS version with service pack
;**
Function OperatingSystem()
DbgMessage("Info","Checking Operating System")
Progress("Checking Operating System")

If (@inwin = 1)
$NT_mode="yes"
Else
$NT_mode="no"
EndIf

$os=""
$os_dos=@dos
$os_product=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
$os_productSuite=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductSuite")
$os_service_pack=""
$os_subversion=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber")
Select
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.1") AND (InStr($os_productSuite,"Terminal Server") <> 0)
$os="XP_Terminal_Server"
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.1") ; - Windows XP Server
$os="XP_Server"
Case ($NT_mode = "yes") AND ($os_product = "WinNT") AND ($os_dos = "5.1") ; - Windows XP Professional
$os="XP_Professional"
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.0") AND (InStr($os_productSuite,"Terminal Server") <> 0)
$os="W2K_Terminal_Server"
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.0") ; - Windows 2000 -
$os="W2K_Server"
Case ($NT_mode = "yes") AND ($os_product = "WinNT") AND ($os_dos = "5.0")
$os="W2K_Professional"
Case ($NT_mode = "yes") AND ($os_product = "LANMANNT") ; - Windows NT -
$os="NT4_Domain_Controller"
Case ($NT_mode = "yes") AND ($os_product = "ServerNT") AND (InStr($os_productSuite,"Terminal Server") <> 0)
$os="NT4_Terminal_Server"
Case ($NT_mode = "yes") AND ($os_product = "ServerNT")
$os="NT4_Member_Server"
Case ($NT_mode = "yes") AND ($os_product = "WinNT")
$os="NT4"
Case ($NT_mode <> "yes") AND (@dos = "4.90")
$os="ME"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") AND (InStr(Lcase($os_subversion),"c") <> 0) ; - Windows 98 -
$os="W98c"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") AND (InStr(Lcase($os_subversion),"b") <> 0)
$os="W98b"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") AND (InStr(Lcase($os_subversion),"a") <> 0)
$os="W98a"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10")
$os="W98"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") AND (InStr(Lcase($os_subversion),"c") <> 0) ; - Windows 95 -
$os="W95c"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") AND (InStr(Lcase($os_subversion),"b") <> 0)
$os="W95b"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") AND (InStr(Lcase($os_subversion),"a") <> 0)
$os="W95a"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0")
$os="W95"
Case 1
$os="???" ; - undetermined -
EndSelect
;
$os_service_pack=""
Select
Case ($NT_mode = "yes") AND ($os_dos = "5.1") ; - Windows XP
$os_service_pack=ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","BuildLab")
If (Len($os_service_pack) <> 0)
$os=SubStr($os,1,3)+"_"+Ltrim(Rtrim($os_service_pack))
$os_service_pack=Ltrim(Rtrim($os_service_pack))
EndIf
Case ($NT_mode = "yes") AND ($os_dos <> "5.1") ; Windows NT4 + W2K
$os_service_pack=ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","CSDVersion")
If (Len($os_service_pack) <> 0)
$os=SubStr($os,1,3)+"_"+SubStr($os_service_pack,Len($os_service_pack),1)
$os_service_pack=Ltrim(Rtrim($os_service_pack))
EndIf
Case 1
; Windows 95, 98 + ME
EndSelect
;
$os_type=""
$os_dos=@dos
Select
Case ($NT_mode = "yes") AND ($os_dos = "5.1") ; - Windows XP -
$os_type="XP"
Case ($NT_mode = "yes") AND ($os_dos = "5.0") ; - Windows 2000 -
$os_type="W2K"
Case ($NT_mode = "yes") ; - Windows NT -
$os_type="NT4"
Case ($NT_mode <> "yes") AND ($os_dos = "4.90") ; - Windows ME -
$os_type="ME"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") ; - Windows 98 -
$os_type="W98"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") ; - Windows 95 -
$os_type="W95"
Case 1
$os_type="???" ; - undetermined -
EndSelect
$os_type=Ltrim(Rtrim(SubStr($os_type+" ",1,3)))
EndFunction

;***********************************************************************
;**
;** DrawForms()
;**
Function DrawForms()

; Form
$Form = CreateObject("Kixtart.Form")
$Form.Caption = "Login"
$Form.Width = 500
$Form.Height = 400
If $DebugFlag=$True
$Form.Left=(1024 / 2) - (500 / 2)
$Form.Top=(768 / 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=483
$Logo.Height=50
$Logo.Picture="logo.bmp"

; Info Frame
$InfoFrame = $Form.Frame("Informatie",5,55,240,140)

$OSLbl = $InfoFrame.Label("Besturingssysteem", 5, 15, 115, 15)
$OSBox = $InfoFrame.TextBox("", 120, 15, 115, 15)
$OSBox.BackColor=$Form.BackColor
$OSBox.Enabled=0
$UserIdLbl = $InfoFrame.Label("Acroniem", 5, 30, 115, 15)
$UserIdBox = $InfoFrame.TextBox(@USERID , 120, 30, 115, 15)
$UserIdBox.BackColor=$Form.BackColor
$UserIdBox.Enabled=0
$FullNameLbl = $InfoFrame.Label("Volledige Naam", 5, 45, 115, 15)
$FullNameBox = $InfoFrame.TextBox(@FULLNAME, 120, 45, 115, 15)
$FullNameBox.BackColor=$Form.BackColor
$FullNameBox.Enabled=0
$PriviledgeLbl = $InfoFrame.Label("PC Naam", 5, 60, 115, 15)
$PriviledgeBox = $InfoFrame.TextBox(@WKSTA, 120, 60, 115, 15)
$PriviledgeBox.BackColor=$Form.BackColor
$PriviledgeBox.Enabled=0
$WorkStnLbl = $InfoFrame.Label("Werkstation", 5, 75, 115, 15)
$WorkStnBox = $InfoFrame.TextBox(@WKSTA, 120, 75, 115, 15)
$WorkStnBox.BackColor=$Form.BackColor
$WorkStnBox.Enabled=0
$DomainLbl = $InfoFrame.Label("Domein", 5, 90, 115, 15)
$DomainBox = $InfoFrame.TextBox(@DOMAIN, 120, 90, 115, 15)
$DomainBox.BackColor=$Form.BackColor
$DomainBox.Enabled=0
$ServerLbl = $InfoFrame.Label("Server", 5, 105, 115, 15)
$ServerBox = $InfoFrame.TextBox($LSERVER, 120, 105, 115, 15)
$ServerBox.BackColor=$Form.BackColor
$ServerBox.Enabled=0
$MemberLbl = $InfoFrame.Label("Groeplid", 5, 120, 115, 15)
$MemberBox = $InfoFrame.TextBox(@group, 120, 120, 115, 15)
$MemberBox.BackColor=$Form.BackColor
$MemberBox.Enabled=0

; Action Frame
$ActionFrame = $Form.Frame("Akties",250,55,240,140)

$NewsRadioButton = $ActionFrame.RadioButton("Ontvangst Nieuws", 5, 15, 230, 15)
$TimeRadioButton = $ActionFrame.RadioButton("Tijd Instellen", 5, 30, 230, 15)
$SharesRadioButton = $ActionFrame.RadioButton("Verbinden met shares", 5, 45, 230, 15)
$StandardSettingsRadioButton = $ActionFrame.RadioButton("Standaard Settings", 5, 60, 230, 15)
$WriteLogFileRadioButton = $ActionFrame.RadioButton("Logfile wegschrijven", 5, 75, 230, 15)

; Logging Frame
$NewsFrame = $Form.Frame("Nieuwsbericht",5,195,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=350
$ProgressTextBox.Width=200
$ProgressTextBox.Height=20
$ProgressTextBox.Enable=0
$ProgressTextBox.BackColor = $Form.BackColor

$ProgressBar = $Form.ProgressBar
$ProgressBar.Left=210
$ProgressBar.Top=350
$ProgressBar.Width=220
$ProgressBar.Height=20
$ProgressBar.Style = 1

; Clock
$CurrentTime=@Time
$Clock = $Form.TextBox("",435,350,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 = 260
$DbgForm.Height = 500
$DbgForm.Left=1024 -260
$DbgFOrm.Top=768 - 550

$DbgTextBox=$DbgForm.TextBox()
$DbgTextBox.Left=5
$DbgTextBox.Top=5
$DbgTextBox.Width=245
$DbgTextBox.Height=465
$DbgTextBox.MultiLine=1
$DbgTextBox.Enable=0
$DbgTextBox.Text=""
$DbgTextBox.ScrollBars=2
$DbgTextBox.Wordwrap=1

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

EndFunction


Top
#141010 - 2005-06-06 02:24 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, nicely put.
your syntax is from version 3 but really nicely done script indeed.
you have done it all?

anyways... I'd suggest something like (I did something similar with my lates groupmapper before got fired ):
Code:

Function ConnectGroupDrives()
If not Exist($FileLocation + "\shares.ini") exit 1 endif
$AllGroups=split(readprofilestring($FileLocation + "\shares.ini","",""),chr(10))
For each $group in $AllGroups
If ingroup($group)
For $x = 1 to 10
$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", $group, "drive" + $x)
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Next
EndIf
Next
EndFunction



what I would also consider is to change your ini to something like:
[groupName]
S="\\server\share"

then you don't need that much splitting and editing the ini is easier for all.
also, the code can be simplified.
_________________________
!

download KiXnet

Top
#141011 - 2005-06-06 02:32 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, this code works with your current ini structure and if you decide to change, with the new one too.
if you change the ini structure, only the connectshare needs to be changed...
and parameter for $share added.

Code:

Function ConnectGroupDrives()
dim $AllGroups,$group,$AllShares,$share,$DriveDefinition
If not Exist($FileLocation + "\shares.ini") exit 1 endif
$AllGroups=split(readprofilestring($FileLocation + "\shares.ini","",""),chr(10))
For each $group in $AllGroups
If ingroup($group)
$AllShares=split(readprofilestring($FileLocation + "\shares.ini",$group,""),chr(10))
For each $share in $AllShares
if $share<>""
$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", $group, $share)
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Next
EndIf
Next
EndFunction

_________________________
!

download KiXnet

Top
#141012 - 2005-06-06 02:50 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
when I login I get an error:

Script Error: NEXT without FOR! NEXT

Top
#141013 - 2005-06-06 03:00 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
I've found the error you've forgot an EndIf

Thanks It's working

Greats Tim

Top
#141014 - 2005-06-06 03:08 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, didn't test it...
good to hear it's already in use
_________________________
!

download KiXnet

Top
#141015 - 2005-06-06 03:45 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
i've got a last question:

everything is working but when i've a group for example: SG Sales (admin) it don't work.

the problem is the ( ) i think.

any suggestions?

gr.

Tim

Top
#141016 - 2005-06-06 04:35 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nope...
should work...
you should add some debug output...
like display all retrieved group names and shares and so on as the script goes on to track possible errors /problems.
_________________________
!

download KiXnet

Top
#141017 - 2005-06-06 04:47 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
ok thanks i will try
Top
#141018 - 2005-06-07 03:00 AM Re: Loginscript
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
The DLLs are only needed for Windows 9x support.

See INGROUP and ENUMGROUP() in the Kixtart Manual and the UDF Forum for ways to enumerate group memberships.
_________________________
There are two types of vessels, submarines and targets.

Top
#141019 - 2005-06-07 09:46 AM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
Finaly it works

thanks for your help

Top
#141020 - 2005-06-07 02:36 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what was the issue?
_________________________
!

download KiXnet

Top
#141021 - 2005-06-07 03:38 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
the group didn't exist my misstake.

greats tim

Top
#141022 - 2005-06-08 12:02 AM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
tim, who's code this really is?
I see this another noob that has exactly the same base code as you.

you on some sorta class or something?
_________________________
!

download KiXnet

Top
#141023 - 2005-06-08 10:01 AM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
from kixforms why is that illegal
Top
#141024 - 2005-06-08 02:00 PM Re: Loginscript
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
who said anything is illegal?
non-functional.
and still, you both have something in common, same time of arrival with same script.
_________________________
!

download KiXnet

Top
#141025 - 2005-06-08 05:09 PM Re: Loginscript
astout Offline
Fresh Scripter

Registered: 2005-06-07
Posts: 16
yeah - pretty weird once i read through this post - it's the exact same code!

Anyway, thanks for the help - I'm going to try the above and see what happens....

Top
#141026 - 2005-06-14 04:06 PM Re: Loginscript
ThedigitalT Offline
Fresh Scripter

Registered: 2005-06-06
Posts: 10
hello,

i'm stuck, I try to merge the script with another script for Outlook 2003 configuratie but it doesn't work can anyone help me with the script
Code:

FUNCTION ConfigOutlook()
DIM $profile_remove,$deleteitems,$explorview,$editorpref,$prf,$serverloc,$exchangeserver,$ushefolders,$userwinkey,
$machinewinkey,$mofckey,$uofckey,$profilelocation,$scriptdir,$profiledir,$prffile,$ppru,$mses,$exe,$ver,$verchk,$idx,$keyname
$profile_remove='Yes' ; Remove All other Outlook profiles under current user
$deleteitems='No'; Empty Outlooks Deleted Items Folder on Exit
$explorview='Yes' ; Outlook Explorer View 'Yes' or Standard View 'No'
$editorpref='30001' ; Editor Preference 10001=Plain Text, 20001=HTML, and 30001=Rich Text
$prf='outlook.prf'
$serverloc=@lserver+'\Netlogon' ; Outlook Executables files location
$exchangeserver='mailsrvr-01' ; Main Exchange Server Location
$ushefolders='HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
$userwinkey='HKCU\Software\Microsoft\Windows'
$machinewinkey='HKLM\Software\Microsoft\Windows'
$mofckey='HKLM\Software\Microsoft\Office\'
$uofckey='HKCU\Software\Microsoft\Office\'
IF @inwin=1 ;Windows NT/2k/XP/2003
$profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
ELSE ;Windows 9x
$profilelocation=$userwinkey+' Messaging Subsystem\Profiles'
ENDIF

$scriptdir=split('%WINDIR%',':')[0]+':\Scripts'
$prffile=$scriptdir+'\'+$prf
$ppru=$profilelocation+'\'+@userid
$mses=$profilelocation+'\MS Exchange Settings'
$exe=ReadValue($machinewinkey+'\CurrentVersion\App Paths\OUTLOOK.EXE','')
$ver=GetFileVersion($exe)
$verchk=SPLIT($ver,'.')[0]

IF 0=Exist($scriptdir)
MD $scriptdir
ENDIF

IF KeyExist($ppru) OR KeyExist($mses)
RETURN
ELSE
COPY $serverloc+'\'+$prf $scriptdir

PRFSETTINGS($prffile,$exchangeserver,$deleteitems)

IF $profile_remove='YES'
$idx=0
$keyname=EnumKey($profilelocation,$idx)
WHILE @error=0
IF $keyname<>@userid $rc=DelTree($profilelocation+'\'+$keyname)
ENDIF
$idx=$icx+1
$keyname=EnumKey($profilelocation,$idx)
LOOP
ENDIF

SELECT
CASE
$verchk=8 or $verchk=9 ;(e.g. 8.5.5104.0)
OUTLOOK8AND9($verchk+'.0',$scriptdir,$prffile,$mofckey,$uofckey,$serverloc,$explorview,$profilelocation)
RETURN
CASE
$verchk=10 or $verchk=11 ;(e.g. 10.0.2627.1)
OUTLOOK10AND11($verchk+'.0',$uofckey,$prffile,$explorview)
RETURN
ENDSELECT
ENDIF
ENDFUNCTION

; -- OUTLOOK BRANCHOUT FOR OUTLOOK XP/2003 - ALL
FUNCTION OUTLOOK10AND11($vers,$uofckey,$prffile,$explorview)
DIM $rc,$expview
$rc=DelValue($uofckey+$vers+'\Outlook\Setup','First-Run')
$rc=WriteValue($uofckey+$vers+'\Outlook\Setup','ImportPRF',$prffile,'REG_SZ')
SLEEP 1
;If '196610'<>ReadValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference')
; $rc=WriteValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
;EndIf
;$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000'
;$pltextfont=$pltextfont+'0000000000201a493a38e9070001000000'
;$rc=WriteValue($uofckey+$vers+'\Outlook\Preferences','TextFontSimple',$pltextfont,'REG_BINARY')
IF $explorview='Yes'
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff2c0000002c00000084'
$expview=$expview+'020000dc01000001000000000000000100000000000000c0000000640000001800000003000000'
$rc=WriteValue($uofckey+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
ENDIF
IF $vers='10.0'
$rc=WriteValue($uofckey+$vers+'\Outlook\IM','Enabled',0,'REG_DWORD')
ENDIF
ENDFUNCTION

; -- OUTLOOK BRANCH OUT FOR OUTLOOK 98/2000
FUNCTION OUTLOOK8AND9($vers,$scriptdir,$prffile,$mofckey,$uofckey,$serverloc,$explorview,$profilelocation)
DIM $expview,$rc
IF 0=Exist ($scriptdir+'\Profgen.exe')
COPY $serverloc+'\Profgen.exe' $scriptdir
ENDIF
IF 0=Exist ($scriptdir+'\NEWPROF.EXE')
COPY $serverloc+'\NEWPROF.EXE' $scriptdir
ENDIF
IF @inwin=1
SHELL '%COMSPEC% /C '+$scriptdir+'\Profgen.exe '+$scriptdir+'\Newprof.exe -p '+$prffile+' -X -R -L > nul'
ELSE
SHELL '%COMSPEC% /C '+$scriptdir+'\Newprof.exe -p '+$scriptdir+' -X -R -L > nul'
ENDIF
IF @wksta<>ReadValue($uofckey+$vers+'\Outlook','Machine Name')
$rc=WriteValue($uofckey+$vers+'\Outlook','Machine Name',@wksta,'REG_SZ')
ENDIF
IF 1<>ReadValue($uofckey+$vers+'\Outlook','CheckInternetAccounts')
$rc=WriteValue($uofckey+$vers+'\Outlook','CheckInternetAccounts',1,'REG_DWORD')
ENDIF
IF 'False'<>ReadValue($uofckey+$vers+'\Outlook','FirstRunDialog')
$rc=WriteValue($uofckey+$vers+'\Outlook','FirstRunDialog','False','REG_SZ')
ENDIF
IF 1<>ReadValue($uofckey+$vers+'\Outlook\Setup','PrimaryClient')
$rc=WriteValue($uofckey+$vers+'\Outlook\Setup','PrimaryClient',1,'REG_DWORD')
ENDIF
IF 1<>ReadValue($mofckey+$vers+'\Outlook\Setup','MailSupport')
$rc=WriteValue($mofckey+$vers+'\Outlook\Setup','MailSupport',1,'REG_DWORD')
ENDIF
IF 1<>ReadValue($mofckey+$vers+'\Outlook\Setup','First-Run')
$rc=WriteValue($mofckey+$vers+'\Outlook\Setup','First-Run','df83b12adc9cd511b57c0002a57ce19c','REG_BINARY')
ENDIF
;If '196610'<>ReadValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference')
; $rc=WriteValue($uofckey+$vers+'\Outlook\Options\Mail','EditorPreference','196610','REG_DWORD')
;EndIf

IF $explorview='Yes'
$rc=WriteValue($profilelocation+@userid+'\0a0d020000000000c000000000000046','001e0360','','REG_SZ')
$expview='010000002c0000000200000003000000ffffffffffffffffffffffffffffffff62000000270000003'
$expview=$expview+'c030000ac02000001000000000000000100000000000000c00000006400000003000000'
$rc=WriteValue('HKCU\Software\Microsoft\Office\'+$vers+'\Outlook\Office Explorer','Frame',$expview,'REG_BINARY')
;$pltextfont='3c0000000f0000e800000040c80000000600000000000000002056657264616e6100020000000000000000'
;$pltextfont=$pltextfont+'0000000000201a493a38e9070001000000'
;$rc=WriteValue($uofckey+$vers+'\Outlook\Preferences','PlainTextFont',$pltextfont,'REG_BINARY')
ENDIF
ENDFUNCTION

; -- OUTLOOK PROFILE SETTINGS - ALL >> USED FOR OUTLOOK CONFIGURATION
FUNCTION PRFSETTINGS($prffile,$exchangeserver,$deleteitems)
DIM $rc
; Custom Profile Settings
IF @userid<>ReadProfileString($prffile,'General','ProfileName')
$rc=WriteProfileString($prffile,'General','ProfileName',@userid)
ENDIF
IF 'Yes'<>ReadProfileString($prffile,'General','DefaultProfile')
$rc=WriteProfileString($prffile,'General','DefaultProfile','Yes')
ENDIF
IF 'Yes'<>ReadProfileString($prffile,'General','OverwriteProfile')
$rc=WriteProfileString($prffile,'General','OverwriteProfile','Yes')
ENDIF
IF $exchangeserver<>ReadProfileString($prffile,'Service2','HomeServer')
$rc=WriteProfileString($prffile,'Service2','HomeServer',$exchangeserver)
ENDIF
IF @userid<>ReadProfileString($prffile,'Service2','MailboxName')
$rc=WriteProfileString($prffile,'Service2','MailboxName',@userid)
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','AutoNameCheck')
$rc=WriteProfileString($prffile,'Service1','AutoNameCheck','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','ConfirmOnDelete')
$rc=WriteProfileString($prffile,'Service1','ConfirmOnDelete','FALSE')
ENDIF
IF $deleteitems='YES'
IF 'TRUE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','TRUE')
ENDIF
ELSE
IF 'FALSE'<>ReadProfileString($prffile,'Service1','EmptyWastebasket')
$rc=WriteProfileString($prffile,'Service1','EmptyWastebasket','FALSE')
ENDIF
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','RemoveSchdPlus')
$rc=WriteProfileString($prffile,'Service1','RemoveSchdPlus','FALSE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','SelectEntireWord')
$rc=WriteProfileString($prffile,'Service1','SelectEntireWord','TRUE')
ENDIF
IF 'TRUE'<>ReadProfileString($prffile,'Service1','CloseOriginalMessage')
$rc=WriteProfileString($prffile,'Service1','CloseOriginalMessage','TRUE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenReadReceipt')
$rc=WriteProfileString($prffile,'Service1','GenReadReceipt','FALSE')
ENDIF
IF 'FALSE'<>ReadProfileString($prffile,'Service1','GenDeliveryReceipt')
$rc=WriteProfileString($prffile,'Service1','GenDeliveryReceipt','FALSE')
ENDIF
IF 'True'<>ReadProfileString($prffile,'Service1','SaveSentMail')
$rc=WriteProfileString($prffile,'Service1','SaveSentMail','True')
ENDIF
IF 'No'<>ReadProfileString($prffile,'General','BackupProfile')
$rc=WriteProfileString($prffile,'General','BackupProfile','No')
ENDIF
ENDFUNCTION



this is a script from this forum
thanks

Top
Page 1 of 2 12>


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

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.072 seconds in which 0.026 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