Open Documents - Hyperlink

5 posts / 0 new
Last post
will.bader@us.gt.com
Offline
Joined: 10/18/2013 - 10:44
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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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
Offline
Joined: 06/19/2014 - 09:04

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's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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
Offline
Joined: 09/26/2017 - 17:00

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.