#81791 - 2003-08-13 05:55 PM
Defining custom macro
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
Sometimes we have some variables that we define and use as macros, for example: $os = split(@ProductType)[1] $csd = val(right(@csd,1)) $admin = ingroup('@wksta\'+sidtoname('S-1-5-32-544'))-1+@INWIN
I'd like it if a variable could be defined as 'read only'... something like the SET command...
hmmm. perhaps that would be the simplest way to go. setl('csd = val(right(@csd,1))') ? %csd%
|
|
Top
|
|
|
|
#81795 - 2003-08-13 06:15 PM
Re: Defining custom macro
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
then this would be good for the Standards FAQ
Cool
|
|
Top
|
|
|
|
#81797 - 2003-08-15 04:32 PM
Re: Defining custom macro
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Rad,
Are there any others that need to be included?
Jens refers to the one used for KixForms. We don't need that extensive of one for regular KiXtart, correct?
Kent
|
|
Top
|
|
|
|
#81798 - 2003-08-15 05:11 PM
Re: Defining custom macro
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
dunno... did you get the one for $desktop and $startmenu
I use these all the time: $HKLMSMWCV $HKCUSMWCV $HKLMSMWNTCV $HKCUSMWNTCV
for AD I like: $oRootDSE = GetObject("LDAP://rootDSE") $oDefautNamingContext = $oRootDSE.Get("defaultNamingContext") $oRootDSE = 0 $ldap="LDAP://"+@domain+"/"+$oDefautNamingContext
code:
$nul =SpecialFolder("Desktop StartMenu Favorites AllUsersDesktop AllUsersStartMenu")
;**************************************************************************************************** Function SpecialFolder($folders) Dim $sAllFolders, $objWshShell, $Folder, $nul $sAllFolders= "AllUsersDesktop AllUsersStartMenu AllUsersPrograms AllUsersStartup AppData Desktop Favorites "+ "Fonts MyDocuments NetHood PrintHood Programs Recent SendTo StartMenu Startup Templates" $objWshShell = CreateObject("WScript.Shell") If @ERROR Exit(1) EndIf For Each $Folder in Split($Folders) if instr($folder, $sAllFolders) $nul=Execute("global $$folder") $nul=Execute("$"+$Folder+" = $$objWshShell.SpecialFolders($$Folder)") endif Next $objWshShell='' EndFunction
[ 15. August 2003, 17:12: Message edited by: Radimus ]
|
|
Top
|
|
|
|
#81800 - 2003-08-15 05:20 PM
Re: Defining custom macro
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
this works also...
$ldap="LDAP://"+@domain+"/"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
|
|
Top
|
|
|
|
#81801 - 2003-08-15 05:41 PM
Re: Defining custom macro
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
code:
$OS = split(@ProductType)[1] $CSD = val(right(@csd,1)) $ADMIN = ingroup('@wksta\'+sidtoname('S-1-5-32-544'))-1+@INWIN $HKLMSCCS ="HKLM\SYSTEM\CurrentControlSet" $HKCUSMWCV ="HKCU\Software\Microsoft\Windows\CurrentVersion" $HKLMSMWCV ="HKLM\Software\Microsoft\Windows\CurrentVersion" $HKLMSMWNTCV ="HKLM\Software\Microsoft\Windows NT\CurrentVersion" $HKCUSMWNTCV ="HKCU\Software\Microsoft\Windows NT\CurrentVersion" $Desktop =readvalue($HKCUSMWCV+"\Explorer\Shell Folders",'Desktop') $StartMenu =readvalue($HKCUSMWCV+"\Explorer\Shell Folders",'StartMenu') $Favorites =readvalue($HKCUSMWCV+"\Explorer\Shell Folders",'Favorites') $MyDocuments =readvalue($HKCUSMWCV+"\Explorer\Shell Folders",'MyDocuments') $alldesktop =expandenvironmentvars(readvalue($HKLMSMWCV+"\Explorer\User Shell Folders","Common Desktop")) $allstartmenu=expandenvironmentvars(readvalue($HKLMSMWCV+"\Explorer\User Shell Folders","Common Start Menu")) $LDAP ="LDAP://"+@domain+"/"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")
[ 15. August 2003, 17:53: Message edited by: Radimus ]
|
|
Top
|
|
|
|
#81803 - 2003-08-15 09:59 PM
Re: Defining custom macro
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
|
|
Top
|
|
|
|
Moderator: Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart
|
1 registered
(StuTheCoder)
and 798 anonymous users online.
|
|
|