Subject: links to file (again)
this is an modified solution I’ve found on OpenNTF:
- Create a field, where the user can specify the file (like ‘txMyPath’). You can create a hotspot-button ‘Choose File’ to let the user select the file:
@SetField(“txMyPath”;@Prompt([LocalBrowse];“Choose a file”;“”))
Add an additional hotspot button ‘Open File’ and place the following script into into declatation:
'<–from here into Declaration →
Const SEE_MASK_NOCLOSEPROCESS = &H40
Const SEE_MASK_FLAG_NO_UI = &H400
Private Type SHELLEXECUTEINFO
cbSize As Long
fMask As Long
hwnd As Long
lpVerb As String
lpFile As String
lpParameters As String
lpDirectory As String
nShow As Long
hInstApp As Long
lpIDList As Long
lpClass As String
hkeyClass As Long
dwHotKey As Long
hIcon As Long
hProcess As Long
End Type
Declare Function ShellExecuteEx Lib “shell32.dll”_
Alias “ShellExecuteEx” (SEI As SHELLEXECUTEINFO) As Long
Declare Function TerminateProcess Lib “kernel32”_
Alias “TerminateProcess” (Byval hProcess As Long, Byval uExitCode As Long) As Long
'<-- until here into declaration →
and now put the following code into ‘Click’
'<-- from here into Click →
Dim nws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim SEI As SHELLEXECUTEINFO
Set doc = nws.CurrentDocument.Document
SEI.cbSize = Len(SEI)
SEI.fMask = SEE_MASK_NOCLOSEPROCESS Or SEE_MASK_FLAG_NO_UI
SEI.lpVerb = "open"
SEI.lpFile = doc.txMyPath(0) 'the full path must be specified!!!
SEI.nShow = 1
SEI.hInstApp = 0
SEI.lpIDList = 0
Call ShellExecuteEx(SEI)
'if it should be closed, unrem the following 2 lines
'Messagebox "Application opened."+Chr$(13) + "Click 'OK' to close the application", 0, "Success"
'Call TerminateProcess(SEI.hProcess, 0)
'<-- until here into Click →
If you followed my instructions, you should be able to set a path into a text field and open the specified file
Have fun!