Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Program counter

Thread view: 
Ducoltd@googlemail.com - 03 May 2006 15:02 GMT
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 - 03 May 2006 16:48 GMT
> 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
[quoted text clipped - 3 lines]
> 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@googlemail.com - 04 May 2006 09:17 GMT
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 - 04 May 2006 16:49 GMT
>>> 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
[quoted text clipped - 6 lines]
>> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.