Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
NRS script to clear the description on the Save As dialog, enhanced mode....
Jime0726
hello all,
i'm looking for a script that can clear the description on the save as dialog in enhanced mode (matter centric) IF the description starts with a "(". for example, if an email is dragged from inbox to filesite and there is no subject on it, the description in the save as dialog will have the senders last and first name in parenthesis: (Smith, John), rather than just leaving the description blank.
is there a sript that can see what the first character of the description is and clear it out because of that value?
Thanks!
Find more posts tagged with
Comments
jny
I think this should do it:
filesave.nrs
===========================================
Option Explicit
Const nrDescription = 3
Sub IManFileSaveCmd_OnInitDialog(dlg)
dlg.SetAttributeValueByID nrDescription, "(Smith, John)", True
End Sub
===========================================
You should create a filesave.nrs script for this code example, then add it to the scripts folder under your WorkSite Client installed path, e.g. "C:\Program Files\Interwoven\WorkSite\scripts\filesave.nrs"
Jime0726
i tried it and it doesn't throw any errors but it also is not removing the description. when i tested, i did notice the description comes up as "E-mail(John Smith)" if the subject is blank.
should a clear or remove context script be added for it to remove the description?
Thanks for the help!
jny
Sorry, I think I must have misread the first time around. What you really wanted to do is have a blank description? If so, try this:
dlg.SetAttributeValueByID nrDescription, "", True
Jime0726
i actually just played around with it some more, took the "(smith, john)" out of the quotes and just left a space in the quotes: " ", and with that, it is removing the description but whether there is a subject or it's blank. it's pretty much changing the description to whatever is in the quotes whether there is a subject or not. what i need is to remove the description if it starts with "E-mail" or "(smith, John)".
can that be done?
jny
Gotcha. Try this:
Dim sDesc
sDesc = dlg.GetAttributeByID(nrDescription)
msgbox sDesc
' Todo: Check description starts with a "(".
' If it does, then call the line above to clear the description.
dlg.SetAttributeValueByID nrDescription, "", True
Jime0726
ok, making progress, i see the msg box, i keep the Todo rem'd out and it still clears the description. when i unrem it, it throws an error. how does the code need to be to check for the "("?
This is what I have:
Option Explicit
Const nrDescription = 3
Sub IManFileSaveCmd_OnInitDialog(dlg)
Dim sDesc
sDesc=dlg.GetAttributeByID(nrDescription)
msgbox sDesc
'Todo: Check description starts with a "E-mail"
dlg.SetAttributeValueByID nrDescription, " ", True
End Sub
when i remove the ' next to Todo, it throws the error.
thanks for the help!!
jny
The 'TODO... is a comment to let you know that you would need to parse the returned description to find out whether or not you need to clear the field.
You might need to use some VB functions, like instr or mid, etc.
Jime0726
ok, i had a feeling, i'm actually JUST starting to learn a little VB so this is really helping. do you know of a site where i could get a list of cmds that could possibly work with checking the description?
again, thanks so much for the help!
jny
No problem. This would be a good site to hit:
http://msdn2.microsoft.com/en-us/library/wybb344c.aspx
It has code examples and references on different string funcitons to help you out...specifically, look to instr, left, right, more mid.
Good luck!
I'd help you more if I had more time. Check back later if you have run into problems.
Jime0726
Not a problem...very glad that you got me this far!!
i'm researching on that site now but if you do have time to help me with that string, that would be great, or if anyone else would know, either way would be helpful.
thanks!
Jime0726
jny, thanks so much for your help....i found the below string did exactly what i needed.
If (InStr(1,Trim(dlg.GetAttributeByID(nrDescription)), "(", 1) = 1) then
dlg.SetAttributeValueByID nrDescription, " ", True
end if
seems the InStr cmd did the trick.
thanks!