Solved

How to run Delphi program with arguments from a pdf document?

Posted on 2006-11-12
7
292 Views
Last Modified: 2007-12-19
I made a .pdf document with several links to my delphi program. The problem is, that each of these links requires different action from my program. So, I am wandering is there any way to run my program with some arguments (integer, string or some other data type) which will help my program to know what to do. And how to run that program with arguments from link?

Is this posibble?

Thank you.
0
Comment
Question by:UrosVidojevic
  • 3
  • 2
  • 2
7 Comments
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 17926914
Do you mean run your delphi application via a desktop shortcut with extra commands? If so then yes.

You can pass parameters to your application via a shortcut, then decode them on main form create by looping through them ( they will be separated by a space in the shortcut and the application knows that each is individual).

for i := 1 to paramcount do
begin

end
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 17926918
Note that parameters passed in double quotes will be treated as a single parameter without quotes:
myprog.exe "test string" param2
ParamStr(1)='test string'
ParamStr(2)='param2'

You can then convert to other variable types on load, ie integer
0
 
LVL 7

Author Comment

by:UrosVidojevic
ID: 17926944
I have several hyperlinks in pdf file (which I got by converting doc file with openoffice), these links should contain name of my program and parameters. Each time user clicks on some of links my program should be run with arguments which I gave in hyperlink.

For example:

Link 1 <myprogram.exe, param = "user choosed link 1">

Some text....

Link N <my program.exe, param = "user choosed link n">
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 7

Author Comment

by:UrosVidojevic
ID: 17927179
Ok, now I can make N shortcuts to my program, each containing some parameter, and then point N links in my document to them, but I need better solution:

How to embed information about parameters in hyperlink?
So, each hyperlink should contain name of exe file and parameters.
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 500 total points
ID: 17938398
In the PDF, you can use Adobe's javascript to do that. You have to have the full Acrobat in order to
build your PDF with the javascript assigned to the hyperlinks.
0
 
LVL 7

Author Comment

by:UrosVidojevic
ID: 17939744
Yes I have full Acrobat 7, can you give me the javascript code to run program MyProgram.exe with some string parameter, and explain briefly how to do that (make that hyperlink)?

Thank you.

U.V.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 17939850
No, I don't have Acrobat installed. I just know it exists however, let me check the documentation to see if
it realyl can be done and how.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question