sko
Joined: 20 Jul 2005 Posts: 1
|
Posted: Wed Jul 20, 2005 10:21 pm Post subject: Add links in Office places bar based on groupmembership |
|
|
This script will add links in the the MS Office places bar based on the groupmembership or username in Active Directory, it is tested in office 2000 but will probably work in office XP/2003
The only thing that needs to be done is adding a entry in a ini-file, furthermore it can enable/disable the standard links in the places-bar, make the links big or small and change the sorting method.
[begin script]
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win2000/XP
; Author: Nico Schuijff
; Licence: GNU/GPL
; Script Function:
; Add links in office places-bar based on groupmembership or username.
;
filedelete,%temp%\membership.txt
ifnotexist,places.ini,goto,bye
;Global Options
Iniread,iconsize,places.ini,Global,iconsize,0
Iniread,officeversion,places.ini,Global,officeversion,9.0
Iniread,desktop,places.ini,Global,desktop,1
Iniread,MyDocuments,places.ini,Global,Mydocuments,1
Iniread,publishing,places.ini,Global,publishing,1
Iniread,favorites,places.ini,Global,favorites,1
Iniread,recent,places.ini,Global,recent,1
Iniread,SortAscending,places.ini,Global,SortAscending,1
Iniread,Index,places.ini,Global,Index,0
;disable/enable standard places
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\StandardPlaces\Publishing,Show,%desktop%
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\StandardPlaces\Favorites,Show,%MyDocuments%
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\StandardPlaces\Publishing,Show,%publishing%
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\StandardPlaces\Favorites,Show,%favorites%
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\StandardPlaces\Recent,Show,%recent%
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places,ItemSize,%iconsize%
;IniRead, OutputVar, Filename, Section, Key [, Default]
sectionnum=1
placebar=1
runwait,%comspec% /c %A_Windir%\system32\net.exe user %username% /domain > %temp%\membership.txt,,min
ifnotexist,%temp%\membership.txt
{
msgbox,0,Error.., could not write to %temp%\
goto,bye
}
fileread,membership,%temp%\membership.txt
; Search for groupmemberships
search:
;IniRead, OutputVar, Filename, Section, Key [, Default]
Iniread,groupname,places.ini,share%sectionnum%,groupname,nogroup
Iniread,department,places.ini,share%sectionnum%,department,nodepartment
Iniread,showname,places.ini,share%sectionnum%,showname,noshowname
Iniread,share,places.ini,share%sectionnum%,share,noshare
IfInString,membership,%groupname%
{
Gosub,makereg
}
sectionnum++
ifnotequal,groupname,nogroup,goto,search
else exitapp
;begin of registrywrite
makereg:
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\UserDefinedPlaces\Place%placebar%,Index,%Index%
Regwrite,REG_DWORD,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\UserDefinedPlaces\Place%placebar%,SortAscending,%SortAscending%
Regwrite,REG_SZ,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\UserDefinedPlaces\Place%placebar%,Path,%share%
Regwrite,REG_SZ,HKCU,Software\Microsoft\Office\%officeversion%\Common\Open Find\Places\UserDefinedPlaces\Place%placebar%,Name,%showname%
placebar++
return
;end of departmentpart
bye:
filedelete,%temp%\membership.txt
exit
[end script]
[begin places.ini ini-file]
; places.ini is the ini file of office-places.exe
; office-places.exe is written by Nico Schuijff
; it will create links in the Places-bar in office 2000 en up (probably:) ) based on groupmembership in Active Directory/local computer
; How to create the links
;[SectionName] = it has to be [shareX], where x is a number and it has the following number in the list
;department= The department or the user for which the quicklink is being made (not parsed in the script)
;groupname= the name of the group where the user is a member of, this can also be the username if he/she is the only one who wants the link in office
;showname= the name which will be shown in the Places bar in office
;share= the share to which the link points to, this can be a mapping or a UNC-path.
;
[Global]
iconsize=1 ;0=small,1=big
officeversion=9.0 ;office2000=9.0 officeXP=10.0
;show standard links, 0=no,1=yes
MyDocuments=1
desktop=1
publishing=0
favorites=0
recent=0
;sorting
SortAscending=1 ; sort 1=yes,0=no if index=1
Index=0
;the link section
[share1]
department= just a name..
groupname=
showname=
share=
[share2]
department=
groupname=
showname=
share=
[share3]
[end places.ini ini-file]
this could be handy to let it run in the logon.bat. it will save the users a lot of browsing in office to find their documents. |
|