Skip to main content

Open Documents - Hyperlink

I have a long list on transactions and a pdf copy of an invoice for each on my computer.  
Is there  way for me to define an action field such that I can click on the document number field in IDEA, and automatically open the correct document on my computer?
The helpdesk said it is possible using a script, but I haven't had much luck.   
Thanks,
Will

Brian Element Wed, 03/04/2015 - 12:52

Hi Will,

In IDEA you first create an action field and then select run an IDEAScript and choose the file that contains the code to open your pdf.  You then select the field that contains the information.  The information is transfered to the script using arg1, arg2, arg3 and arg4 as you can have up to 4 variables sent to a script.  In the script I have created a variable to hold the filename.  I then combine the information from IDEA with .pdf to create a proper pdf filename.  I then have used the shell object to open the file.  You will have to change the "C:\data\" to the location of your pdfs.  Hope this helps.

Option Explicit

Sub Main
	Dim filename As String
	
	filename = arg1 & ".pdf"
	
	MsgBox filename 

	Dim myShell As Object
	Set myShell =  CreateObject("WScript.Shell")
		myShell.Run "C:\data\" & filename, 1, true
	Set myShell = Nothing
	
End Sub

 

donsenilo Mon, 03/09/2015 - 11:14

Hi
works fine but apparently there is a limit in idea:
max 128 characters are transfered with arg1, arg2 ... (using IDEA 8.05.243)
 
this limit can be reached easily when using the filename with the path-string in a single field.
you have to restrict the string-length, split it into 2 fields or split it to arg1, arg2 ...
 
i have modified the very usefull script "Import Multiple Files" so that the checkbox "include filename in import" transfered path and name of the imported files.
after the imports are done i create an action field with the script above for the field "ORIG_FILENAME".
 
nice feature if you have to import hundreds of pdf and want to look for further information in the original files ...
regards
Gert
 
P.S.:
excellent work and website. Thank you very much

Brian Element Mon, 03/09/2015 - 12:26

Hi Gert,

It is nice to hear how the scripts are helping you out and how you have modified them for your particular purposes. 

It wouldn't suprise me if there is a limit on the arg1 values, 128 would make sense, glad to hear you were able to work around these limitations.

Glad to hear you enjoy the site, thanks.

Brian

edhong Thu, 01/28/2021 - 14:23

Nice little script Brian.  When I use it with a pdf that has spaces in the filename, I get a "path not found" error. I replaced the spaces with underscore to no avail.