Showing posts with label lotus approach. Show all posts
Showing posts with label lotus approach. Show all posts
Friday, March 30, 2012
Create Lotus Notes views on fly
I'm wondering if somebody know how to use views that I created on fly, lets say we have document with embedded view which is not created yet. Before we open this document we create view (but simple triggering agent). However we can't use this view as embedded view on document till we reopen database. Anybody has any idea how we can avoid this problem?
Saturday, March 19, 2011
I've moved my applications to google code.
I've upload some of my small application to google code. There are couple reasons why I did it:
- backup.
- we can use SVN now as on some projects I work with another people, so now we can get benefits from that as well.
- I just feel that it is much much more correctly :)
If you wish to create project your own project on google code, just fill google code form. After that using SVN do checkout and
input as URL repository https://*******.googlecode.com/svn/trunk/
[Username] is your email
[password] is available on google code setting page.
So go on and do your first commit to google code
- backup.
- we can use SVN now as on some projects I work with another people, so now we can get benefits from that as well.
- I just feel that it is much much more correctly :)
If you wish to create project your own project on google code, just fill google code form. After that using SVN do checkout and
input as URL repository https://*******.googlecode.com/svn/trunk/
[Username] is your email
[password] is available on google code setting page.
So go on and do your first commit to google code
Friday, March 04, 2011
SVN plug-in problems
Hi guys, we are moving our Domino applications to SVN and everything going really well except one thing.
We are having problems with elements that really do not modified but during synchronization they get new values (look on image). It is major problem for us, because applications have many design elements and most of them often get news values (modified, noteid etc) and then we are not able to determine what elements were really changed.
We do have workaround: do 1 more step and apply XSLT approch on exported elements and just remove these Noteinfo, modified, lastaccessed etc tags, but that is not the really correct way.
Does anybody know solution for that? If you use SVN - how you live with that?
Friday, November 12, 2010
Dynamical counter in Lotus Notes client
Have you ever tried to show length of field (f.x. just below the field) ?
Let me show my example, I've a form, there I have couple fields I need to show length of it (because there is some validation of length for this field).
So when user input new char in Title field, Character count should increase to 1. Know how to do that? I believe many of you know, but anywhere I would like to share this approach.
There are actually 2 fields: 1 for input and another one is just below the Title of field (computed type).
What we need to do - use some simple JavaScript lines..
step 1.
go to JS Header even in form/subform and put there couple lines of JS (select Run: Client and JavaScript)
var f = document.forms[0];
var stopDynamicalCounter = 0;
function updateCharCounter(delay) {
if(stopDynamicalCounter == 0) return;
f.AlternateTitle_length.value = f.AlternateTitle.value.length;
setTimeout( 'updateCharCounter( ' + delay + ' )', delay);
}
step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
stopDynamicalCounter = 1;
updateCharCounter(100)
step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line
stopDynamicalCounter = 0;
That's all.
Let me show my example, I've a form, there I have couple fields I need to show length of it (because there is some validation of length for this field).
There are actually 2 fields: 1 for input and another one is just below the Title of field (computed type).
What we need to do - use some simple JavaScript lines..
step 1.
go to JS Header even in form/subform and put there couple lines of JS (select Run: Client and JavaScript)
var f = document.forms[0];
var stopDynamicalCounter = 0;
function updateCharCounter(delay) {
if(stopDynamicalCounter == 0) return;
f.AlternateTitle_length.value = f.AlternateTitle.value.length;
setTimeout( 'updateCharCounter( ' + delay + ' )', delay);
}
step 2.
select input-field, and go to onFocus event, select Run: Client and JavaScript and put there 2 lines
stopDynamicalCounter = 1;
updateCharCounter(100)
step 3.
select input-field, and go to onBlur event, select Run: Client and JavaScript and put there 1 line
stopDynamicalCounter = 0;
That's all.
Wednesday, June 09, 2010
Get temporary folder on PC/MAC
How often do you need to extract files to temporary folder, process them and import back? I do this from time to time, hope you are as well :).
Declare Function w32_OSGetSystemTempDirectory Lib "nnotes" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function mac_OSGetSystemTempDirectory Lib "NotesLib" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function linux_OSGetSystemTempDirectory Lib "libnotes.so" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Select Case session.Platform
Case "Linux"
s% = linux_OSGetSystemTempDirectory(d)
Case "Macintosh"
s% = mac_OSGetSystemTempDirectory(d)
Case "Windows/32"
s% = w32_OSGetSystemTempDirectory(d)
End Select
Let's say you have image attached to document and you would like to change it to 32x32 size (obviously you need to change width and height of image in case if it is to big) and attach back to document instead.
I would like to ask about place you usually use to export files. Yes, it is quite easy to extract files to "C:\", easy? right? but not correct, users for sure will not have right for creating files there. Of course I'm pretty sure 95% of you use Environ("Temp") and Environ("Tmp") to determine temporary folder so that's fine, that's I believe only one possible way.
but now question about MAC users, how we can determine their temporary folder? I always use hardcode (yea, shame on me :) ) with path \var\tmp and this approach works fine (at least till this day), but I still can't forget this hardcoded \var\tmp so if anybody know the right way please share it !
Update
here is great link that I was looking for (Thanks to Sasa). Actually main part we need from lss here
Declare Function w32_OSGetSystemTempDirectory Lib "nnotes" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function mac_OSGetSystemTempDirectory Lib "NotesLib" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function linux_OSGetSystemTempDirectory Lib "libnotes.so" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Select Case session.Platform
Case "Linux"
s% = linux_OSGetSystemTempDirectory(d)
Case "Macintosh"
s% = mac_OSGetSystemTempDirectory(d)
Case "Windows/32"
s% = w32_OSGetSystemTempDirectory(d)
End Select
Tuesday, April 06, 2010
Old staff: Switch tabs/rows programatically
It is known thing but not VERY VERY known :-] , so it can be useful to anybody.
If you use tabs/rows on your forms and want to switch tabs/rows programmatic don't think that it difficult, it is very easy, couple clicks and couple lines of code.
So let's start, 'go go go' as we say :) !
1) Go to the property of table, open 'Table Programming' tab (the last one) and give the name of the whole table (Name/ID tag), also please give the name to all rows you want to switch using your code (Row Tags, Name)
2) Now let's go to the property Table Rows and select "Switch rows programatically" (otherwise it will not work, even if you cast magic), also enable 'show the tabs so user can pick row'.
3) Add field to the form with name = Name/ID tag and add prefix $. (f.x. if you called your table MainTable, field should be $MainTable, the purpose of this field is to contain name of row we need to show).
4) Now do your code, here is example of button/event
FIELD $MainTable := "Content";
@Command([ViewRefreshFields])
That's all.
If you use tabs/rows on your forms and want to switch tabs/rows programmatic don't think that it difficult, it is very easy, couple clicks and couple lines of code.
So let's start, 'go go go' as we say :) !
1) Go to the property of table, open 'Table Programming' tab (the last one) and give the name of the whole table (Name/ID tag), also please give the name to all rows you want to switch using your code (Row Tags, Name)
2) Now let's go to the property Table Rows and select "Switch rows programatically" (otherwise it will not work, even if you cast magic), also enable 'show the tabs so user can pick row'.
3) Add field to the form with name = Name/ID tag and add prefix $. (f.x. if you called your table MainTable, field should be $MainTable, the purpose of this field is to contain name of row we need to show).
4) Now do your code, here is example of button/event
FIELD $MainTable := "Content";
@Command([ViewRefreshFields])
That's all.
Tuesday, February 23, 2010
Cannot create automation object when we use RunOnserver
I had situation where my agent1 (I run it on server like agent1.RunOnserver).
Agent1 create OLE object (WinHttp.WinHttpRequest or MSXML2.ServerXMLHTTP or it could be another OLE object without Quit/Exit method). As these objects do not have Quit/Exit method Domino continued to keep these objects in memory(?). So next time when I run agent I gave an error:
"Cannot create automation object"
I found workaround for this. It is strange, but it works.
I created new agent and called it on server instead of agent1 (f.x. agentNew.RunOnServer) This new agent called agent1 locally (f.x. Call agent1.Run). There is also article on IBM about solution for error Cannot create automation object
Funny, right?
Agent1 create OLE object (WinHttp.WinHttpRequest or MSXML2.ServerXMLHTTP or it could be another OLE object without Quit/Exit method). As these objects do not have Quit/Exit method Domino continued to keep these objects in memory(?). So next time when I run agent I gave an error:
"Cannot create automation object"
I found workaround for this. It is strange, but it works.
I created new agent and called it on server instead of agent1 (f.x. agentNew.RunOnServer) This new agent called agent1 locally (f.x. Call agent1.Run). There is also article on IBM about solution for error Cannot create automation object
Funny, right?
Sunday, January 31, 2010
Approach to fill word/excel documents without Office installed
I've had task where we need to fill our word/excel templates with data from notes documents on Server and get URL to users (our application for web uses only). All users have Office installed but Domino server does not have (and will not have installed it).
So after some research I decided to use the most simple way from my point of view.
Idea is next -> put predefined text (f.x. ##fieldName1##, ##fieldName2##) on word/excel documents and then save them as XML. I did not use bookmark because it is impossible (at least looks like impossible) to process them in XML.
So what do we have at this point? Document saved as XML with predefined text on it.
Then when we need to fill and show document to user we just take our XML template, take all content from it and do many replaces (we replace predefined text on our data from notes document), then don't forget to remove all predefined text that were not filled by some reasons, and then important point print it for web user like this:
Print {Content-Type:application/msword}
Print {Cache-Control: public, must-revalidate}
Print {Expires: Sat, 26 Jul 1997 05:00:00 GMT}
Print xml_output
So after some research I decided to use the most simple way from my point of view.
Idea is next -> put predefined text (f.x. ##fieldName1##, ##fieldName2##) on word/excel documents and then save them as XML. I did not use bookmark because it is impossible (at least looks like impossible) to process them in XML.
So what do we have at this point? Document saved as XML with predefined text on it.
Then when we need to fill and show document to user we just take our XML template, take all content from it and do many replaces (we replace predefined text on our data from notes document), then don't forget to remove all predefined text that were not filled by some reasons, and then important point print it for web user like this:
Print {Content-Type:application/msword}
Print {Cache-Control: public, must-revalidate}
Print {Expires: Sat, 26 Jul 1997 05:00:00 GMT}
Print xml_output
Monday, January 11, 2010
Open XFDF file in Browser using Abobe Reader
I was facing with one simple problem. I had XFDF file on our web suite. Users open that XFDF file as URL (http://database/view/doc/$File/fileName) but it did not open in Adobe Reader, but in Browser as XML. I looked around and found solution. Add these line before XFDF output and it will start to work.
Print {Content-Type:application/vnd.adobe.xfdf}
Print {Cache-Control: public, must-revalidate}
Print {Expires: Sat, 26 Jul 1997 05:00:00 GMT}
Print xml_output
Print {Content-Type:application/vnd.adobe.xfdf}
Print {Cache-Control: public, must-revalidate}
Print {Expires: Sat, 26 Jul 1997 05:00:00 GMT}
Print xml_output
Sunday, January 10, 2010
How to open XFDF file from IE in Adobe Reader?
I have really interesting problem. I have posted XFDF file on my site and planning that user will click on it and get PDF file opened. But the strange this is that each browser has different behavior:
on my PC I have set associated application for xfdf file - Adobe Reader.
1) IE opens my xfdf file in XML format, and that's all. that's the biggest pain,
2) FF opens it in good way, but anywhere it ask which application to use when open xfdf file.
3) Chrome, just download files without anything.
Any ideas? :) I will update my post later if I solve the problem
on my PC I have set associated application for xfdf file - Adobe Reader.
1) IE opens my xfdf file in XML format, and that's all. that's the biggest pain,
2) FF opens it in good way, but anywhere it ask which application to use when open xfdf file.
3) Chrome, just download files without anything.
Any ideas? :) I will update my post later if I solve the problem
Monday, December 28, 2009
DXL + XSL -> XFDF -> PDF
We started to use XFDF approach when create PDF file. I have to say that FDF is nothing, XFDF is power :). XFDF approach much easier to use and to debug.
For debugging I used Firefox plug-in XSL Results it works good.
So what steps you have to do if you want to use this approach.
1. get NotesDocumentCollection of document you want to export to PDF
2. export it using NotesDXLExporter to dxl file
3. get NotesXSLTransformer and use it :)
4. check result
you may have problem if you are not familiar with XSL. There are many good sites where you can read about it.
Here is an example on openntf
Here is my first example of XSL for generation XFDF file. It can help to somebody.

For debugging I used Firefox plug-in XSL Results it works good.
So what steps you have to do if you want to use this approach.
1. get NotesDocumentCollection of document you want to export to PDF
2. export it using NotesDXLExporter to dxl file
3. get NotesXSLTransformer and use it :)
4. check result
you may have problem if you are not familiar with XSL. There are many good sites where you can read about it.
Here is an example on openntf
Here is my first example of XSL for generation XFDF file. It can help to somebody.

Thursday, December 24, 2009
Use XFDF approach insted of FDF when create PDF file
My fellow just shown me that my approach that I posted on my blog couple weeks ago
how to create PDF using FDF is old one :)
It is shame for me :) that I did not find XFDF approach.
Anywhere from now I would recommend to use XFDF approach when you want to generate PDF file. The idea is similar to FDF but done via real XML. It is much easy to work with it and it is readable :)
Here is simple XFDF file, it demonstrate how it looks.

As you see it is really simple XML file and it will use http://ip/pdf_form.pdf file to show data from XFDF file.
Now I am looking for 'opposite way'. Let's say I'm opened PDF file using XFDF approach and add some values to this PDF file. How I can get export this data back then to XFDF file? Does anybody have such experience?
how to create PDF using FDF is old one :)
It is shame for me :) that I did not find XFDF approach.
Anywhere from now I would recommend to use XFDF approach when you want to generate PDF file. The idea is similar to FDF but done via real XML. It is much easy to work with it and it is readable :)
Here is simple XFDF file, it demonstrate how it looks.

As you see it is really simple XML file and it will use http://ip/pdf_form.pdf file to show data from XFDF file.
Now I am looking for 'opposite way'. Let's say I'm opened PDF file using XFDF approach and add some values to this PDF file. How I can get export this data back then to XFDF file? Does anybody have such experience?
Sunday, December 13, 2009
Create PDF / FDF in Lotus Notes using LS
I had task where I should create PDF file from template and fill fields by values from documents
So what did I do?
I spoke with my brother :-) he recommended to use FDF Toolkit For Windows, instead of iText approach that I used before, and I have to say that it is very cool approach, it is much better at least for me. Instead of generation new PDF file we just export data to FDF file and link it with PDF template and that's all, so our FDF will show data using PDF form/template. -> No Java required and now no non-supported libraries.
Here is a small instruction how to do this:
1) register FDFACX.DLL (for this I copied FdfTk.dll and FDFACX.DLL to windows\system32, but I believe there is better way)
regsvr32 C:\WINDOWS\system32\FDFACX.dll
2) example of code now (it is from Adobe)
USING THE FDF TOOLKIT IN LOTUSSCRIPT
Option Public
Sub Initialize
'
' Set up for using the FDF Toolkit for ActiveX
'
Dim FdfAcX As Variant
Dim outputFDF As Variant
Dim sPdfFileName As String, sFdfFileName As String, sFilePath As String
Set FdfAcX = CreateObject("FdfApp.FdfApp")
Set outputFDF = FdfAcX.FDFCreate()
'
' % REM
'
' Change these paths to reflect your server environment
' Ideally, you could use a Lotus Notes profile document to store this
' information.
'
' Below are the three options for storing the PDF that was discussed in
' the documentation for this application.
'
' Option 1 : UNC Directory Share
' This option oddly asks if you would like to save on close.
'
' sPdfFileName = "\\Mage\domdata\domino\html\pdf\panarama.pdf"
'
' Option 2 : Store in a Lotus Notes Page element
'
sPdfFileName = "http://mage/pdf/panarama.nsf/PDFs/$file/panarama.pdf"
'
' Option 3 : Store in the Domino HTML directory
'
' REM %
'
' sPdfFileName = "http://mage/pdf/panarama.pdf"
sFilePath = "d:\domdata\domino\html\pdf\tmp\"
'
' Set up for getting Lotus Notes information
'
Dim session As New NotesSession
Dim contextDoc As NotesDocument
Dim dateTime As NotesDateTime
Dim tempNumber As Single
Dim rounded As Integer
Dim fileName As String
Set contextDoc = session.documentContext
'
8 Integrating Adobe Acrobat FDF
with Lotus Domino
' This will create a random number between 0 and 100.
' The number will give
' us a good chance of not temporarily having the same file name in the tmp
' directory at the same time. The file will briefly be in the tmp
' directory,
' attached to the Notes document and then deleted.
'
Randomize
temp = Rnd
rounded = Round((temp * 100), 0)
fileName = Cstr(rounded)
sFdfFileName = sFilePath & fileName & ".fdf"
'
' FDFSetValue will set the value you pass it. See page 139 of the
' FDF Toolkit Overview and Reference.
'
outputFDF.FDFSetValue "FirstName", contextDoc.FirstName(0), False
outputFDF.FDFSetValue "MidInit", contextDoc.MidInit(0), False
outputFDF.FDFSetValue "LastName", contextDoc.LastName(0), False
'
' Get the value of the date fields. The DateOnly property
' returns a string.
'
Set dateTime = New NotesDateTime( contextDoc.HireDate(0) )
outputFDF.FDFSetValue "HireDate", dateTime.DateOnly, False
Set dateTime = New NotesDateTime( contextDoc.ModDate(0) )
outputFDF.FDFSetValue "ModDate", dateTime.DateOnly, False
'
outputFDF.FDFSetValue "Address1", contextDoc.Address1(0), False
outputFDF.FDFSetValue "Address2", contextDoc.Address2(0), False
outputFDF.FDFSetValue "City", contextDoc.City(0), False
outputFDF.FDFSetValue "State", contextDoc.State(0), False
outputFDF.FDFSetValue "ZipCode", contextDoc.ZipCode(0), False
outputFDF.FDFSetValue "Country", contextDoc.Country(0), False
'
outputFDF.FDFSetValue "MAddress1", contextDoc.MAddress1(0), False
outputFDF.FDFSetValue "MAddress2", contextDoc.MAddress2(0), False
outputFDF.FDFSetValue "MCity", contextDoc.MCity(0), False
outputFDF.FDFSetValue "MState", contextDoc.MState(0), False
outputFDF.FDFSetValue "MZipCode", contextDoc.MZipCode(0), False
'
outputFDF.FDFSetValue "HomePhone", contextDoc.HomePhone(0), False
outputFDF.FDFSetValue "WorkPhone", contextDoc.WorkPhone(0), False
'
outputFDF.FDFSetValue "Emer1Contact", contextDoc.Emer1Contact(0), False
outputFDF.FDFSetValue "Emer1Phone", contextDoc.Emer1Phone(0), False
outputFDF.FDFSetValue "Emer2Contact", contextDoc.Emer2Contact(0), False
outputFDF.FDFSetValue "Emer2Phone", contextDoc.Emer2Phone(0), False
'
' Tell it which file we're writing to and do a save.
'
outputFDF.FDFSetFile sPdfFileName
outputFDF.FDFSaveToFile sFdfFileName
'
' Always close your open FDF files.
'
outputFDF.FDFClose
ADOBE FDF TOOLKIT
User Guide
9
'
' This will attach the FDF file we just closed to our Notes document
' and then delete it from the tmp directory.
'
Call MoveFdfToAttachment(contextDoc, sFdfFileName)
End Sub
Public Function MoveFdfToAttachment(doc As NotesDocument, fileName As
String) As Integer
'// move each attachment to a rich text field.
Dim attachItem As New NotesRichTextItem(doc, "fdfAttachment")
Dim attachObj As notesEmbeddedObject, newObjName As String
Call attachItem.EmbedObject(EMBED_ATTACHMENT, "", fileName, "")
Kill fileName
MoveFdfToAttachment = True
End Function
So what did I do?
I spoke with my brother :-) he recommended to use FDF Toolkit For Windows, instead of iText approach that I used before, and I have to say that it is very cool approach, it is much better at least for me. Instead of generation new PDF file we just export data to FDF file and link it with PDF template and that's all, so our FDF will show data using PDF form/template. -> No Java required and now no non-supported libraries.
Here is a small instruction how to do this:
1) register FDFACX.DLL (for this I copied FdfTk.dll and FDFACX.DLL to windows\system32, but I believe there is better way)
regsvr32 C:\WINDOWS\system32\FDFACX.dll
2) example of code now (it is from Adobe)
USING THE FDF TOOLKIT IN LOTUSSCRIPT
Option Public
Sub Initialize
'
' Set up for using the FDF Toolkit for ActiveX
'
Dim FdfAcX As Variant
Dim outputFDF As Variant
Dim sPdfFileName As String, sFdfFileName As String, sFilePath As String
Set FdfAcX = CreateObject("FdfApp.FdfApp")
Set outputFDF = FdfAcX.FDFCreate()
'
' % REM
'
' Change these paths to reflect your server environment
' Ideally, you could use a Lotus Notes profile document to store this
' information.
'
' Below are the three options for storing the PDF that was discussed in
' the documentation for this application.
'
' Option 1 : UNC Directory Share
' This option oddly asks if you would like to save on close.
'
' sPdfFileName = "\\Mage\domdata\domino\html\pdf\panarama.pdf"
'
' Option 2 : Store in a Lotus Notes Page element
'
sPdfFileName = "http://mage/pdf/panarama.nsf/PDFs/$file/panarama.pdf"
'
' Option 3 : Store in the Domino HTML directory
'
' REM %
'
' sPdfFileName = "http://mage/pdf/panarama.pdf"
sFilePath = "d:\domdata\domino\html\pdf\tmp\"
'
' Set up for getting Lotus Notes information
'
Dim session As New NotesSession
Dim contextDoc As NotesDocument
Dim dateTime As NotesDateTime
Dim tempNumber As Single
Dim rounded As Integer
Dim fileName As String
Set contextDoc = session.documentContext
'
8 Integrating Adobe Acrobat FDF
with Lotus Domino
' This will create a random number between 0 and 100.
' The number will give
' us a good chance of not temporarily having the same file name in the tmp
' directory at the same time. The file will briefly be in the tmp
' directory,
' attached to the Notes document and then deleted.
'
Randomize
temp = Rnd
rounded = Round((temp * 100), 0)
fileName = Cstr(rounded)
sFdfFileName = sFilePath & fileName & ".fdf"
'
' FDFSetValue will set the value you pass it. See page 139 of the
' FDF Toolkit Overview and Reference.
'
outputFDF.FDFSetValue "FirstName", contextDoc.FirstName(0), False
outputFDF.FDFSetValue "MidInit", contextDoc.MidInit(0), False
outputFDF.FDFSetValue "LastName", contextDoc.LastName(0), False
'
' Get the value of the date fields. The DateOnly property
' returns a string.
'
Set dateTime = New NotesDateTime( contextDoc.HireDate(0) )
outputFDF.FDFSetValue "HireDate", dateTime.DateOnly, False
Set dateTime = New NotesDateTime( contextDoc.ModDate(0) )
outputFDF.FDFSetValue "ModDate", dateTime.DateOnly, False
'
outputFDF.FDFSetValue "Address1", contextDoc.Address1(0), False
outputFDF.FDFSetValue "Address2", contextDoc.Address2(0), False
outputFDF.FDFSetValue "City", contextDoc.City(0), False
outputFDF.FDFSetValue "State", contextDoc.State(0), False
outputFDF.FDFSetValue "ZipCode", contextDoc.ZipCode(0), False
outputFDF.FDFSetValue "Country", contextDoc.Country(0), False
'
outputFDF.FDFSetValue "MAddress1", contextDoc.MAddress1(0), False
outputFDF.FDFSetValue "MAddress2", contextDoc.MAddress2(0), False
outputFDF.FDFSetValue "MCity", contextDoc.MCity(0), False
outputFDF.FDFSetValue "MState", contextDoc.MState(0), False
outputFDF.FDFSetValue "MZipCode", contextDoc.MZipCode(0), False
'
outputFDF.FDFSetValue "HomePhone", contextDoc.HomePhone(0), False
outputFDF.FDFSetValue "WorkPhone", contextDoc.WorkPhone(0), False
'
outputFDF.FDFSetValue "Emer1Contact", contextDoc.Emer1Contact(0), False
outputFDF.FDFSetValue "Emer1Phone", contextDoc.Emer1Phone(0), False
outputFDF.FDFSetValue "Emer2Contact", contextDoc.Emer2Contact(0), False
outputFDF.FDFSetValue "Emer2Phone", contextDoc.Emer2Phone(0), False
'
' Tell it which file we're writing to and do a save.
'
outputFDF.FDFSetFile sPdfFileName
outputFDF.FDFSaveToFile sFdfFileName
'
' Always close your open FDF files.
'
outputFDF.FDFClose
ADOBE FDF TOOLKIT
User Guide
9
'
' This will attach the FDF file we just closed to our Notes document
' and then delete it from the tmp directory.
'
Call MoveFdfToAttachment(contextDoc, sFdfFileName)
End Sub
Public Function MoveFdfToAttachment(doc As NotesDocument, fileName As
String) As Integer
'// move each attachment to a rich text field.
Dim attachItem As New NotesRichTextItem(doc, "fdfAttachment")
Dim attachObj As notesEmbeddedObject, newObjName As String
Call attachItem.EmbedObject(EMBED_ATTACHMENT, "", fileName, "")
Kill fileName
MoveFdfToAttachment = True
End Function
Thursday, December 03, 2009
Online JS validator
I have never used JS validator before (just because I did not think about it previously) . Today I decided to use one of them. I looked around and found JSLint. It is really good tools for validation of JS. I like it ! I recomend to use it to everybody, it gives very good results.
http://www.jslint.com/
http://www.jslint.com/
Wednesday, December 02, 2009
Re-open document using @Formula
Need to update document using re-open approach?
here is easy way:
...
@Command([FileSave]);
@Command([SwitchForm]; currentForm)
I like this approach, especially because I've never thought about such way.
here is easy way:
...
@Command([FileSave]);
@Command([SwitchForm]; currentForm)
I like this approach, especially because I've never thought about such way.
Tuesday, November 03, 2009
How @UserAccess can determine No Access level?
One my fellow asked me how to determine that user don't have access to database using only @formula. So I want to share how it can be done.
We should just check it on @IsError(@UserAccess(..)) and it will return 1 for cases if you don't have access to database at all.
Monday, November 02, 2009
How to show image in LN using HTML
I had trouble with displaying image using html in LN. I did everything correctly, but the image did not appear. So I looked around and found that there is a special field
$DelayedImagesOK = "ok"
So when I added this field (CFD) on the form it started to worked fine.
But then I found if we click on place where the image should display (I meant on that icon) using right click and then click on show image the image would appear and field $DelayedImagesOK with value "ok" would be added.
Tuesday, July 14, 2009
how to kill process from LN
I found this approach as very good for my purposes. It works at least . I suppose that there are another couple even better appraoch, so if you know them share please.
Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szexeFile As String * 260
End Type
'-------------------------------------------------------
Declare Function OpenProcess Lib "kernel32.dll" (Byval dwDesiredAccess As Long, Byval blnheritHandle As Long, Byval dwAppProcessId As Long) As Long
Declare Function ProcessFirst Lib "kernel32.dll" Alias "Process32First" (Byval hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function ProcessNext Lib "kernel32.dll" Alias "Process32Next" (Byval hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function CreateToolhelpSnapshot Lib "kernel32.dll" Alias "CreateToolhelp32Snapshot" (Byval lFlags As Long, lProcessID As Long) As Long
Declare Function TerminateProcess Lib "kernel32.dll" (Byval ApphProcess As Long, Byval uExitCode As Long) As Long
Declare Function CloseHandle Lib "kernel32.dll" (Byval hObject As Long) As Long
Public Sub KillProcess(NameProcess As String)
Const PROCESS_ALL_ACCESS = &H1F0FFF
Const TH32CS_SNAPPROCESS = 2&
Dim uProcess As PROCESSENTRY32
Dim RProcessFound As Long
Dim hSnapshot As Long
Dim SzExename As String
Dim ExitCode As Long
Dim MyProcess As Long
Dim AppKill As Boolean
Dim AppCount As Integer
Dim i As Integer
Dim WinDirEnv As String
If NameProcess <> "" Then
AppCount = 0
uProcess.dwSize = Len(uProcess)
hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
RProcessFound = ProcessFirst(hSnapshot, uProcess)
Do
i = Instr(1, uProcess.szexeFile, Chr(0))
SzExename = Lcase$(Left$(uProcess.szexeFile, i - 1))
WinDirEnv = Environ("Windir") + "\"
WinDirEnv = Lcase$(WinDirEnv)
If Right$(SzExename, Len(NameProcess)) = Lcase$(NameProcess) Then
AppCount = AppCount + 1
MyProcess = OpenProcess(PROCESS_ALL_ACCESS, False, uProcess.th32ProcessID)
AppKill = TerminateProcess(MyProcess, ExitCode)
Call CloseHandle(MyProcess)
End If
RProcessFound = ProcessNext(hSnapshot, uProcess)
Loop While RProcessFound
Call CloseHandle(hSnapshot)
End If
End Sub
Type PROCESSENTRY32
dwSize As Long
cntUsage As Long
th32ProcessID As Long
th32DefaultHeapID As Long
th32ModuleID As Long
cntThreads As Long
th32ParentProcessID As Long
pcPriClassBase As Long
dwFlags As Long
szexeFile As String * 260
End Type
'-------------------------------------------------------
Declare Function OpenProcess Lib "kernel32.dll" (Byval dwDesiredAccess As Long, Byval blnheritHandle As Long, Byval dwAppProcessId As Long) As Long
Declare Function ProcessFirst Lib "kernel32.dll" Alias "Process32First" (Byval hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function ProcessNext Lib "kernel32.dll" Alias "Process32Next" (Byval hSnapshot As Long, uProcess As PROCESSENTRY32) As Long
Declare Function CreateToolhelpSnapshot Lib "kernel32.dll" Alias "CreateToolhelp32Snapshot" (Byval lFlags As Long, lProcessID As Long) As Long
Declare Function TerminateProcess Lib "kernel32.dll" (Byval ApphProcess As Long, Byval uExitCode As Long) As Long
Declare Function CloseHandle Lib "kernel32.dll" (Byval hObject As Long) As Long
Public Sub KillProcess(NameProcess As String)
Const PROCESS_ALL_ACCESS = &H1F0FFF
Const TH32CS_SNAPPROCESS = 2&
Dim uProcess As PROCESSENTRY32
Dim RProcessFound As Long
Dim hSnapshot As Long
Dim SzExename As String
Dim ExitCode As Long
Dim MyProcess As Long
Dim AppKill As Boolean
Dim AppCount As Integer
Dim i As Integer
Dim WinDirEnv As String
If NameProcess <> "" Then
AppCount = 0
uProcess.dwSize = Len(uProcess)
hSnapshot = CreateToolhelpSnapshot(TH32CS_SNAPPROCESS, 0&)
RProcessFound = ProcessFirst(hSnapshot, uProcess)
Do
i = Instr(1, uProcess.szexeFile, Chr(0))
SzExename = Lcase$(Left$(uProcess.szexeFile, i - 1))
WinDirEnv = Environ("Windir") + "\"
WinDirEnv = Lcase$(WinDirEnv)
If Right$(SzExename, Len(NameProcess)) = Lcase$(NameProcess) Then
AppCount = AppCount + 1
MyProcess = OpenProcess(PROCESS_ALL_ACCESS, False, uProcess.th32ProcessID)
AppKill = TerminateProcess(MyProcess, ExitCode)
Call CloseHandle(MyProcess)
End If
RProcessFound = ProcessNext(hSnapshot, uProcess)
Loop While RProcessFound
Call CloseHandle(hSnapshot)
End If
End Sub
Thursday, February 12, 2009
overload of methods/functions in Lotus Script
I make overload for any methods/functions using next approach. It is quite simple and useful from my point of view
Sub new(key As Variant)
Select Case Typename(key)
Case "STRING":
call newForString(key) or do code
Case "NOTESDOCUMENT
call newForNotesDocument(key) or do code
Case "EMPTY
call newForEmpty(key) or do code
End Select
Sub new(key As Variant)
Select Case Typename(key)
Case "STRING":
call newForString(key) or do code
Case "NOTESDOCUMENT
call newForNotesDocument(key) or do code
Case "EMPTY
call newForEmpty(key) or do code
End Select
EncryptOnSend, how can we send encrypted email even if "aim-user" does not have a key to read it?
I was facing with interesting problem, have to send encrypted email to user even if user does not have a key to open/read encrypted email. Let's say in case if I user does not have the key to read/open encrypted email I would like to send him just a message with confirmation that he received an email that was encrypted by userA. So, my main point is to catch users which do not have key to read/open encrypted emails in moment when I send these emails.
Right now Domino automatically UNencrypt emails for users which do not have a key to read/open them.
From help: EncryptOnSend property
To encrypt a document when mailed, this method looks for the public key of each recipient in the Domino Directory. If it cannot find a recipient's public key, the method sends an unencrypted copy of the document to that recipient. All other recipients receive an encrypted copy of the document.
Right now Domino automatically UNencrypt emails for users which do not have a key to read/open them.
From help: EncryptOnSend property
To encrypt a document when mailed, this method looks for the public key of each recipient in the Domino Directory. If it cannot find a recipient's public key, the method sends an unencrypted copy of the document to that recipient. All other recipients receive an encrypted copy of the document.
Subscribe to:
Posts (Atom)