2013-03-08 96 views
2

我遇到了一個讓我頭疼的問題。我已經構建了一個VBScript簽名創建腳本來從AD獲取用戶信息並將其作爲我們所有用戶的簽名應用。它的作品非常漂亮,我對它很滿意。除了一個問題。我已經搜索並且 - 當我發現someone else with the same issue - 我一直沒能找到任何解決方案。objselection.font.name更改爲calibri


首先,一些背景有關腳本:

的腳本設置爲使用下列對象配置簽名,按照微軟的文章here

Word.Application.EmailOptions.EmailSignature.EmailSignatureEntries 

然後,在整個腳本中,我必須多次更改字體。要做到這一點我用這樣的臺詞:

objSelection.Font.Name = "Times New Roman" 

這只是正常的我和我們的大多數用戶。但是,我的一位技術人員之前曾將其默認字體更改爲Times New Roman。當我爲他運行腳本時,應該是TNR的線條將顯示爲Calibri。在我們運行Office 2007時,Word中的原始默認字體是Calibri。我測試了在我自己的PC和另一臺PC上更改默認字體,並且我能夠兩次複製問題。

我之前鏈接到的technet海報指出,原始文檔的所有字體都是正確的。只有當「EmailSignatureEntries」將其保存到RTF和HTML中才能用作字體混淆的簽名。

我真的很難過這個。任何幫助,將不勝感激! :)

回答

0

我偶然發現了同樣的問題,同時爲我的公司創建一個新的,自動填充AD的簽名。 從我在互聯網上找到的東西,以及還有建議,是當簽名使用與Word中的Normal.dot(m)相同的字體制作時發生問題。

例如; 我的公司希望將Arial 10作爲Word,Excel和Outlook中的默認字體。 所以當然我修改了所有需要的文件並安排了一個GPO來完成這個任務。 一切正常,Word等Arial作爲默認字體。

現在,當我運行我的signature.vbs腳本時,該腳本還聲明字體應該是Arial,結果總是會像Calibri一樣足夠奇怪。我在這裏玩了一下,注意到我可以使用除Arial以外的任何其他字體,除了Arial外,它可以工作。

這讓我瘋了2天,然後它打我; - 如果我在用戶配置文件中放置Temporary normal.dot(m)(以Calibri作爲默認字體),那麼使用VBS創建簽名,然後在配置文件中放置正確的Normal.dot(m)?

事實證明,這確實有竅門。 所以我拿出了Normal.dot(m)的文件放置GPO,並在我的批處理腳本中集成了臨時副本,運行vbs,final copy,這也激發了signature.vbs。

這是我的代碼,你可能需要適應自己的需求,但它提供了基本的想法。我已經添加了評論的英文翻譯,所以你不必學習荷蘭語:)

希望這可以幫助你和任何人仍然在尋找'解決方案'。

@echo off 
REM Verwijder alle default word templates in het userprofile (niet meer via GPO) 
REM Remove all default Word templates in the userprofile (no longer through GPO) 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Sjablonen\Normal.dotm 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Sjablonen\NormalEmail.dotm 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Templates\NormalEmail.dotm 

REM Check of het Handtekeningscript al gelopen heeft, zoja ga over tot plaatsen juiste normal.dotm 
REM Check if the signaturescript already ran, if so copy the proper normal.dotm 
IF EXIST %homeshare%\pvfsig.txt goto copynormal 

REM Plaats een tijdelijke Normal.dotm ivm een conversie issue als je default Arial hebt (wordt Calibri) 
REM Copy a temporary Normal.dotm in the profile so the conversion problem with the Default font won't occur. 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_met_calibri\Normal.dotm %userprofile%\AppData\Roaming\Microsoft\Sjablonen\Normal.dotm 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_met_calibri\Normal.dotm %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_met_calibri\NormalEmail.dotm %userprofile%\AppData\Roaming\Microsoft\Sjablonen\NormalEmail.dotm 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_met_calibri\NormalEmail.dotm %userprofile%\AppData\Roaming\Microsoft\Templates\NormalEmail.dotm 

REM Start Handtekening VBS script om de handtekening te genereren 
REM Start signature VBS script to generate the signature 
cscript \\pvf\netlogon\scripts\huisstijl\outlooksig_new.vbs 

REM Verwijder tijdelijke Normal.dotm bestanden 
REM Remove the temporary Normal.dotm files 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Sjablonen\Normal.dotm 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Sjablonen\NormalEmail.dotm 
DEL /F /Q %userprofile%\AppData\Roaming\Microsoft\Templates\NormalEmail.dotm 

REM Creeer een check bestand op de Homedirectory v/d gebruiker 
REM Create a checkfile in the users homedirectory 
echo pvf standaard handtekening is aangemaakt > %homeshare%\pvfsig.txt 

REM Kopieeren van juiste normal.dotm bestanden (met Arial) 
REM Copy the proper normal.dotm files into place 
:copynormal 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_pvf_huisstijl\Normal.dotm %userprofile%\AppData\Roaming\Microsoft\Sjablonen\Normal.dotm 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_pvf_huisstijl\Normal.dotm %userprofile%\AppData\Roaming\Microsoft\Templates\Normal.dotm 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_pvf_huisstijl\NormalEmail.dotm %userprofile%\AppData\Roaming\Microsoft\Sjablonen\NormalEmail.dotm 
COPY /Y /Z \\pvf\netlogon\Scripts\huisstijl\normal_pvf_huisstijl\NormalEmail.dotm %userprofile%\AppData\Roaming\Microsoft\Templates\NormalEmail.dotm 

:end 
EXIT