Program counter  
Author Message
Ducoltd





PostPosted: 2006-5-3 22:03:00 Top

java-programmer, Program counter I'm a newbie at programming and I'm trying to write a program that
allows me to count the number of times a program is accessed with the
result to increment a log file. I can get it to work(ish) with vbs if
the user opens up the program first and then opens the file, but as
you can imagine most users open up the file by double clicking in
explorer or via shortcuts. Has anyone got any advice or can point me in
the right direction

Anyway thanks in advance!

 
Jeffrey Schwab





PostPosted: 2006-5-3 23:49:00 Top

java-programmer >> Program counter email***@***.com wrote:
> I'm a newbie at programming and I'm trying to write a program that
> allows me to count the number of times a program is accessed with the
> result to increment a log file. I can get it to work(ish) with vbs if
> the user opens up the program first and then opens the file, but as
> you can imagine most users open up the file by double clicking in
> explorer or via shortcuts. Has anyone got any advice or can point me in
> the right direction

What program is used to open the file when the user double-clicks its icon?
 
Ducoltd





PostPosted: 2006-5-4 16:17:00 Top

java-programmer >> Program counter I created a .exe from vbs script (i tried this language first as like i
said im new to programming) and assoitiated the .exe with all pdf's the
problem was that my script only includes the command to run adobe and
not pass the selected file info

 
 
Jeffrey Schwab





PostPosted: 2006-5-4 23:49:00 Top

java-programmer >> Program counter email***@***.com wrote:

> Jeffrey Schwab <email***@***.com> wrote:
>
>> email***@***.com wrote:
>>
>>> I'm a newbie at programming and I'm trying to write a program that
>>> allows me to count the number of times a program is accessed with
>>> the result to increment a log file. I can get it to work(ish) with
>>> vbs if the user opens up the program first and then opens the file,
>>> but as you can imagine most users open up the file by double
>>> clicking in explorer or via shortcuts. Has anyone got any advice or
>>> can point me in the right direction
>>
>> What program is used to open the file when the user double-clicks its
>> icon?

When you reply, please include enough context so that someone can read
the post from top to bottom and follow the conversation.

> I created a .exe from vbs script (i tried this language first as like
> i said im new to programming) and assoitiated the .exe with all pdf's
> the problem was that my script only includes the command to run adobe
> and not pass the selected file info

Since this is a Java news group, I can't really help with the actual
code here unless you want to try solving the problem in Java. If you
really want to stick with VB, try posting your code in a VB-related news
group.

It sounds like your program is getting invoked whenever the user opens a
relevant file (PDF), so your program can do whatever it likes when that
happens. In order to keep a count of the number of times the program
has been invoked, your program might include the following steps:

- try to open a config file for read/write, e.g.
%HomeDrive%%HomePath%\_yourProgramRC
- read the count from the file if it is present, else initialize
the count to zero
- overwrite the file contents with the new count, i.e. the old
count plus one
- run adobe, passing it the relevant command-line arguments and
process environment

The current count will always be stored in the config file.