ddady
(Getting the hang of it)
2011-01-13 03:40 PM
Dynamic Outlook Signature from the Script Vault


I recieve the following message:
 Code:
Error opening template file: The system cannot find the path specified.


Link to the post here

Hope somone will know what i did wrong :-)


Mart
(KiX Supporter)
2011-01-13 03:51 PM
Re: Dynamic Outlook Signature from the Script Vault

Did you copy the template example from the post you linked to or not?

ddady
(Getting the hang of it)
2011-01-13 03:56 PM
Re: Dynamic Outlook Signature from the Script Vault

Yep!

I created an HTM file according to the template example and put it in the folder with the INI file


Glenn BarnasAdministrator
(KiX Supporter)
2011-01-13 05:10 PM
Re: Dynamic Outlook Signature from the Script Vault

Check the definition of $RootPath. It should point to the server\share where your script, config, and template files exist.

In the vault example, there are two declarations, one that points to the real location and a second that points to the current folder, used for debugging.
 Code:
$RootPath = '\\lgfileserver1\libgo\EMailSigs\'
; ====================================================================== 
$RootPath = '.\' ; for debugging 
You need to edit the first one to point to your network location and comment out the second one.

This, aside from defining the template and config file, is the only customization that should be needed.

Glenn



ddady
(Getting the hang of it)
2011-01-13 08:12 PM
Re: Dynamic Outlook Signature from the Script Vault

Thanks Glenn,

That was the problem, i should've comment out the second one :-)

It works perfectly.

Now, two more questions.

1)Is there a way to force this signature to be the default one?
2)Where i do the changes in order to arrange the signature structure?


Glenn BarnasAdministrator
(KiX Supporter)
2011-01-14 06:14 PM
Re: Dynamic Outlook Signature from the Script Vault

The set the default sig, look at the OutlookSignature UDF - the latest version is on my web site in the Kixtart Functions section. You can either use the Set Default logic or modify the script to use this function.

As for the signature structure, just move things around in the BODY section of the template file. Lines that have replacement macros for which there is no data are ignored, so something like "Cell: &CELLPHONE&" would display only if the user's AD account had a cell # defined. Further -

Office: &Phone&
Cell: &CellPhone&

would display as
Office: 201-555-1234 Cell: 201-555-9874
only if both the phone and cellphone values were defined, otherwise the word "Cell:" and the cell # would not display. Point is - you need to thing about how you want data to display, and what fields (and descriptions) might be optional.


FYI - we have a commercial version available for $50 that includes a management GUI. We've deployed that product at several sites with as few as 10 users to over 5000, with unique signatures for each of over 400 departments. PM me for details if you are interested.

Glenn


ddady
(Getting the hang of it)
2011-01-16 12:56 PM
Re: Dynamic Outlook Signature from the Script Vault

Thanks Glenn,

I have a new problem which i don't think can be solve.
Our main language is Hebrew.

I have managed to add the "RTL" in the html which moves everything to rhe right, but all the details are in English in the AD.
I have put for an example the CITY detail in Hebrew but i get in the signature not good even though i have put the Hebrew code in the html.

The only way i can think of that will solve that problem, is creating a Excel or any text file that will hold every user information in Hebrew.
When a user will login the script will go to the excel file and will retreview the data from it.

If such a thing can be done, or any other solution, i will be glad to get some guidance.


Glenn BarnasAdministrator
(KiX Supporter)
2011-01-16 01:59 PM
Re: Dynamic Outlook Signature from the Script Vault

Using Excel will significantly complicate your script. Consider an INI file to translate key fields, since INI processing is built-in to Kix. For example:
 Code:
$NewName = ReadProfileString('path\to\translate.ini', 'NAME', $UserID) ; read name translation
$Name = IIf($NewName, $NewName, $Name) ; replace Name if NewName is defined
The INI file would look like this:
 Code:
[NAME]
WThornton=Billy Bob Thornton
JSmith=Juli Smythe
Basically, right after you gather all of the data from AD, you use the UserID to replace selected fields from the lookup table. The table has sections for all critical data such as name, address, city, etc. You can likely do direct translations of City to NewCity to reduce the number of replacements, but user name replacements should be done on a userID to User Name basis to account for duplicates.

Using the IIF only replaces the AD data if replacement data exists.

Note that using INI file lookups during login can significantly impact login time over WAN connections, so keep the number of reads minimal. You might use a CSV record - UserID=name,address... - so only one read is required. Use the CSV UDF to break it into an array and use the IIF to replace specific fields. This method requires a full set of replacement data for every user but results in faster performance.

Glenn


ddady
(Getting the hang of it)
2011-01-16 07:07 PM
Re: Dynamic Outlook Signature from the Script Vault

So basically if i understood correct, the code will look something like this:

 Code:
$NewName = ReadProfileString ('path\to\translate.ini', 'NAME', $UserID)
$NewCity = ReadProfileString ('path\to\translate.ini', 'CITY', $UserID)

and so on for every detail...

And the INI file will look like this:

 Code:
[NAME]
JDavid=James David
CTony=Cool Tony

[CITY]
JDavid=Tel-Aviv
CTony=Jerusalem

And so on with the rest of the details...


I didn't quite understand the IIF code line.
I understand what it does but that only in a case where there is no data at the required field, correct?
If that so, i only have to make sure that all the necessary fields in the AD are filled.


Glenn BarnasAdministrator
(KiX Supporter)
2011-01-16 10:19 PM
Re: Dynamic Outlook Signature from the Script Vault

Yup - the IIF basically says "if there is NEW data, use it, otherwise use the original AD data. This way, you only have to define what needs to be changed in the INI file.

Glenn


ddady
(Getting the hang of it)
2011-01-25 08:29 AM
Re: Dynamic Outlook Signature from the Script Vault

Sorry for my late response.

I have created a new INI file (translate.ini) and just for the test i put this code in it:

 Code:
[NAME]
dady=Full Name name in Hebrew

[CITY]
dady=City name in Hebrew




i re-configured the kix file for the test, only 2 lines, i left the rest intact:

 Code:
; Get the remaining user info
$sName = ReadProfileString ("\\crystal\netlogon\sig\translate.ini", "NAME",$UserDN)
$sCity = ReadProfileString ("\\crystal\netlogon\sig\translate.ini", "CITY",$UserDN)


When i run the script i get nothing. I see the the signature file is created but it's empty.

What am i doing wrong??


ChristopheM
(Hey THIS is FUN)
2011-01-25 12:56 PM
Re: Dynamic Outlook Signature from the Script Vault

what contains $UserDN ?

may be you can use @UserID instead of $userDN.
userDN seems to be u user distinguished name and the classical form is CN=xxxx, OU=xxxx, dc=xxxx, dc=xxxx

this is not the form of the keyword in you ini file.


ddady
(Getting the hang of it)
2011-01-25 01:08 PM
Re: Dynamic Outlook Signature from the Script Vault

 Originally Posted By: ChristopheM
what contains $UserDN ?

may be you can use @UserID instead of $userDN.
userDN seems to be u user distinguished name and the classical form is CN=xxxx, OU=xxxx, dc=xxxx, dc=xxxx

this is not the form of the keyword in you ini file.


I used the this script from the forum Scrip Vault. When i have tried to replace it to $UserID i get error about it.


Glenn BarnasAdministrator
(KiX Supporter)
2011-01-25 06:00 PM
Re: Dynamic Outlook Signature from the Script Vault

Please read the entire article and not just the script. The information describes the logic of the script to (hopefully) make it easier to modify.

ChristopheM is correct - $UserDN is the LDAP DN String, not a user ID. You cannot simply replace a "ADSIUserInfo($UserDN, 'ObjectID')" function call with a ReadProfileString() function.

I would allow the script to complete the creation of the variables from the many ADSIUserInfo() calls, and THEN use the various values to determine IF a replacement value exists, then use it (my earlier IIF() example). Also, creating a lookup of values by userid creates many duplicates. Use a single "REPLACEMENTS" section so you only list things like City, State(Region) and names once.

Glenn


ShaneEP
(MM club member)
2011-01-25 10:17 PM
Re: Dynamic Outlook Signature from the Script Vault

 Originally Posted By: ddady
When i have tried to replace it to $UserID i get error about it.


I think he was referring to @UserID (built in kix macro,@ not $), and not a variable $UserID.


ddady
(Getting the hang of it)
2011-01-26 09:58 AM
Re: Dynamic Outlook Signature from the Script Vault

 Originally Posted By: CitrixMan
 Originally Posted By: ddady
When i have tried to replace it to $UserID i get error about it.


I think he was referring to @UserID (built in kix macro,@ not $), and not a variable $UserID.


That's correct :-)

Any how, i have found a solution to my problem.
I use the Full name as a parameter in my INI file.
I prefer to use the @UserID macro since the user name is unique.
If anyone can direct me how to do it, i will be most appreciate.


ddady
(Getting the hang of it)
2011-01-27 02:54 PM
Re: Dynamic Outlook Signature from the Script Vault

OK, i mange to work it out with the @UserID macro.

Now my last question regarding this matter is:

Let say for an example users have their own signatures which they made by themselves.
Is there a way i can force the signature from the script to be the default one?