Solved

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

Posted on 2006-11-12
7
285 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now