;============================================================
; KIXTART.KIX
;
; By Michael Rychter - Ashpoint Pty Limited Ph: 0418 229 934
;
; First created on 21 December 1999
;============================================================
SETTIME "\\HOPEWOODSBS"
SETCONSOLE("HIDE")
DIM $_Pr, $RC, $UserID, $HomeServer, $CoGroup, $SQLDrive, $NetWorkDrive, $CDDrive, $SQLShare, $NetWorkShare, $CDShare
$UserId=@userid
$HomeServer="HOPEWOODSBS"
;*********************** BgInfo *************************************
$RC = "BgInfo.exe"
IF EXIST(%WinDir% + "\" + $RC) = 0
COPY @LSERVER + "\Netlogon\" + $RC %WinDir% + "\" + $RC
ENDIF
$RC = "Ashpoint.bgi"
IF EXIST(%WinDir% + "\" +$RC) = 0
COPY @LSERVER + "\Netlogon\" + $RC %WinDir% + "\" + $RC
ENDIF
RUN %WinDir% + "\BGInfo.exe " + %WinDir% + "\Ashpoint.bgi /taskbar /NoLicPrompt"
;********************************************************************
$SQLDrive = "S:"
$NetWorkDrive = "Z:"
$CDDrive = "Y:"
$SQLShare = "\\$HomeServer\SQLBackups"
$NetWorkShare = "\\$HomeServer\NetWork"
$CDShare = "\\$HomeServer\CD"
USE $SQLDrive /DELETE
USE $NetWorkDrive /DELETE
USE $CDDrive /DELETE
USE $NetWorkDrive $NetWorkShare
USE $CDDrive $CDShare
IF $UserID = "SBeavon"
USE $SQLDrive $SQLShare
ENDIF
;=================== Printer Settings =================================
$_Pr = "\\HOPEWOODSBS\HP4100"
PrintMaker($_Pr)
$_Pr = "\\HOPEWOODSBS\HP4250"
PrintMaker($_Pr)
$_Pr = "\\HOPEWOODSBS\HP4250_Spare"
PrintMaker($_Pr)
$_Pr = "\\HOPEWOODSBS\ShopLaser"
PrintMaker($_Pr)
$_Pr = "\\HOPEWOODSBS\ServerFax"
PrintMaker($_Pr)
IF @WKSta<>"HP_June08_01)
$_Pr = "\\HP_June08_01\HL2040"
PrintMaker($_Pr)
ENDIF
;$Nul = ADDPRINTERCONNECTION("\\HOPEWOODSBS\HP4100")
;$Nul = ADDPRINTERCONNECTION("\\HOPEWOODSBS\HP4250")
;$Nul = ADDPRINTERCONNECTION("\\HOPEWOODSBS\HP4250_Spare")
;$Nul = ADDPRINTERCONNECTION("\\HOPEWOODSBS\ShopLaser")
;$Nul = ADDPRINTERCONNECTION("\\HOPEWOODSBS\ServerFax")
;SETDEFAULTPRINTER("HP4250")
;=================== Printer Announcements =============================
$Key = "HKCU\Printers\Settings"
$RK= KeyExist($Key)
IF @ERROR <> 0
ADDKEY($Key)
WriteValue($Key,"EnableBalloonNotificationsLocal","0","REG_DWORD")
WriteValue($Key,"EnableBalloonNotificationsRemote","0","REG_DWORD")
ENDIF
COOKIE1
:end
EXIT 0
;============================ FUNCTION PriMapState ========================
;FUNCTION PriMapState
;
;AUTHOR Lonkero (Jooel.Nieminen@gwspikval.com)
;
;ACTION Checks for existent networkprinter connection
;
;VERSION 1.1.1
;
;CHANGES 1.1.1 - 01. november 2003
; Fixed buggie descriped in:
; http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=1;t=008079
; 1.1 - 02. July 2002
; added support for win9x
; 1.0 - 01. July 2002
; initial release
;
;SYNTAX PriMapState(PRINTER)
;
;PARAMETERS PRINTER
; to be checked Printer's name
;
;RETURNS 1 if printer connected
; 2 if printer is default
; nothing if not connected
;
;REMARKS code for w9x adapted from BrianTX
;
;DEPENDENCIES none
;
;EXAMPLE
; if not PriMapState('\\server\printer1')
; "printer1 not connected!"
; endif
;
;CODE
function PriMapState($_Pri)
if @inwin=1
if len(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Devices",$_Pri))
if split(readvalue("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows","Device"),",")[0]=$_Pri
$PriMapState=2
else
$PriMapState=1
endif
endif
else
dim $_Root,$_C,$_C2 $_Root="HKLM\System\CurrentControlSet\control\Print\Printers"
for $_C=0 to 259
$_C2=enumkey($_Root,$_C)
If instr(READVALUE($_Root+"\"+$_C2,"Port"),$_Pri)
If instr(READPROFILESTRING("%windir%\win.ini","windows","device"),$_Pri)
$PriMapState = 2
Else
$PriMapState = 1
Endif
Endif
if $_C2=259 $_C=$_C2 endif
next
endif
endfunction
;============================ FUNCTION PrintMaker ============================
FUNCTION PrintMaker($_pr)
IF PriMapState($_pr) = 0
$null = ADDPRINTERCONNECTION($_Pr)
ENDIF
ENDFUNCTION
;============================ FUNCTION EnumProcess ===========================
;DO NOT change anything below this line!! This UDF is ready for use as it is.
Function EnumProcess($exe, optional $terminate, optional $Computer)
Dim $winmgmts, $ExecQuery, $Process, $id
If NOT $computer
$computer=@wksta
EndIf
$winmgmts="winmgmts:{impersonationLevel=impersonate}!//$COMPUTER"
Select
Case Val($exe)>0
$ExecQuery="select * from Win32_Process where ProcessId='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate
$=$Process.Terminate
EndIf
$EnumProcess = $Process.name
Next
$GetObject=''
Case VarType($exe)=8
$ExecQuery="select * from Win32_Process where Name='$exe'"
$GetObject=GetObject($winmgmts).ExecQuery($ExecQuery)
For Each $Process in $GetObject
If $terminate
$=$Process.Terminate
EndIf
$id=$Process.ProcessId
$EnumProcess = "$Id" + "|" + "$EnumProcess"
Next
$EnumProcess=Left($EnumProcess,Len($EnumProcess)-1)
$GetObject=''
Case 1
Exit 1
EndSelect
EndFunction
;============================ FUNCTION Screen Resolution ===========================
Function GetScreenRes()
Dim $Dev,$Idx,$RKey,$ScreenXRes,$ScreenYRes,$SType
$GetScreenRes = ''
If @InWin = 1
If Split(@ProductType)[1] <> "NT"
$Dev = Split('' + WMIQuery("VideoModeDescription","Win32_VideoController"))
If UBound($Dev) > 1
$GetScreenRes = $Dev[0] + "," + $Dev[2]
EndIf
Else
$RKey="HKLM\SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services"
$Dev = "\Device0"
If KeyExist($RKey)
$Idx = 0
Do
$SType = EnumKey($RKey,$Idx)
If @Error = 0 And $SType <> "VgaSave"
$ScreenXRes = '' + ReadValue($RKey + "\" + $SType + $Dev,"DefaultSettings.XResolution")
$ScreenYRes = '' + ReadValue($RKey + "\" + $SType + $Dev,"DefaultSettings.YResolution")
Else
$Idx = $Idx + 1
EndIf
Until @Error Or $ScreenXRes
If $ScreenXRes
$GetScreenRes = $ScreenXRes + ',' + $ScreenYRes
EndIf
EndIf
EndIf
Else
$RKey="HKLM\Config\0001\Display\Settings"
If KeyExist($RKey)
$GetScreenRes = ReadValue($RKey,"Resolution")
EndIf
EndIf
EndFunction
; For easier cut'n paste, here is the code stolen from Radimus
; Explanation for WMIQuery(): Look in the link under dependencies
FUNCTION WMIQuery($what,$where, optional $computer)
dim $strQuery, $objEnumerator, $value
if not $computer $computer="@WKSTA" endif
$strQuery = "Select $what From $where"
$SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//$computer")
$objEnumerator = $SystemSet.ExecQuery($strQuery)
For Each $objInstance in $objEnumerator
If @Error = 0 and $objInstance <> ""
$=execute("$$value = $$objInstance.$what")
$WMIQuery="$value"+"|"+"$WMIQuery"
EndIf
Next
$WMIQuery=left($WMIQuery,len($WMIQuery)-1)
exit @error
ENDFUNCTION