How to programmatically check for a certain file name among "recently installed files" or "recently downloaded files"...

Hi Experts, is there a way I can programmatically determine if a certain file name has been recently downloaded (or installed) on the target computer that my application is on? Is ths info saved somewhere in the registry, or in the "Documents and Settings" folder?

This is an idea I have for tracking my demo downloads/installations.

Thanks
    Shawn

P.S: I'm using Delphi 7
shawn857Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jimyXCommented:
> file name has been recently downloaded

As long as there are variations of browsers and downloading managers, I do not think that would be possible, probably if you target browsers that would be more promising.
For instance not all browsers log the downloaded files, also some use downloading managers where it becomes, almost, impossible to find within the OS log files.

Installed...
This might be possible through the Registry, by looking under:
HKEY_CLASSES_ROOT\
HKEY_CURRENT_USER\Software
HKEY_LOCAL_MACHINE\SOFTWARE

For a better track, if it is not too late, simple solution would be, adding a feature in your demo which writes to a log file in the Temp Folder. Use encryption and add all that you look for when trying to track your demo down.

Another option is to log data on-line when downloading or installation finishes.
Some applications, when installed, collect and send data to the developer's server. But this option has some privacy concerns so is not a desirable option for many users.
0
Sinisa VukSoftware architectCommented:
Most programs check for update on the web - and then send current version + some additional info's to products web page (where all data collects). This is quite good way to check frequency of usage, versions distribution, ...
0
shawn857Author Commented:
Thanks guys, let me give you some more big-picture details on what I'm trying to do: My plan (or maybe 'hope' is a better word), is to do some testing of different prices for my app (...a Windows stand-alone software). I'd like to build only the one demo version of my app, but make several different identical copies of it, only assigning a slightly different filename to each. Something like this:

MyAppDemo_xyz.exe
MyAppDemo_abc.exe
MyAppDemo_rst.exe
etc, etc

These filename differences would mean nothing to the demo user, but would be my means of tracking what demo user is going to get what price. I would create several "subdomains" off my main domain - matching the "xyz", "abc", "rst" found in my demo file name - they'd all be identical clones on my main website... only difference being the price on the Order page. As a way to 'automate' this all somewhat and make less work for me, I was hoping it would follow this sort of process:

(1) Via pay-per-click, I direct my user to one of these subdomain sites ... let's say "xyz.MyAppSite.com"
(2) There he reads about my software, and requests the demo download site from me through my autoresponder.
(3) My autoresponder is configured to detect what subdomain-site the request came from, and emails back the user with the proper demo exe file. In this case, the user would get a response back saying the download exe file is called "MyAppDemo_xyz.exe" (my autoresponder would automatically grab the "xyz" from the subdomain, and tack that onto the demo file name as a 'custom token').
(4) User installs the demo and plays with it. If he decides he wants to buy, there is a BUY button within the demo that he clicks on. Here is where I would somehow need to know what the full name of the demo file was that I sent him  (ie. MyAppDemo_xyz.exe). if I could get that info, then it would be a simple job for my demo to grab the last 3 characters of that demo file name, and direct Mr. User to the proper order page when he clicked my BUY button.
 (ie. xyz.MyAppSite.com/Order.htm)


Elaborate and convoluted, I know... but I've been wracking my brain trying to come up with some sort of means to test multiple prices in some sort of semi-automated setting where I wouldn't have to be manually keeping track of a million things.

So that's the big picture behind my original question guys...

Thanks
    Shawn
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

jimyXCommented:
It is clear, but you made the process to be dependent on variable factor (i.e relying on the file name.) which is going to be problematic (even if it would be at a tiny ratio).

What happens when the user renames the file?

No need to rely on anything at the users side (including file name, that's user controlled factor).

You can have your main domain (autoresponder) handles the different requests coming from different demo types and redirect the requests to either sub-domains or directly serving the requests with different target files as per each classification.

So what you need to do is providing the different demos each featured with a built-in flag that identifies the type of demo (xyz, abc, rst,...etc) and upon receiving the request from users (click on buy button) your demo would supply the flag (keyword) that identifies which bundle this user is under, even you could handle redirecting the user to sub-domain from the main domain based on that flag.

If you can't stand the overhead of creating and maintaining many different demos (that each holds a specific flag), then you could make use of application properties (under details tab of any executable file), where there is File Description, Type, File Version, ...etc, so you use another application (along with the autoresponder) on the server, if possible of course, to stamp the demos instead of changing the file names. The stamp will be including the flag or the name (xyz, abc, rst...etc) and other info such as version number, if you want, on the exe before sending to the users.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sinisa VukSoftware architectCommented:
Use conditional directive to compile app ...
{$DEFINE DEMO1}
{.$DEFINE DEMO2} //remove point for this one
{.$DEFINE DEMO3}
....
sDemoVer: String;
...
{$IFDEF DEMO1}
sDemoVer := 'xyz';
{$ENDIF}

{$IFDEF DEMO2}
sDemoVer := 'abc';
{$ENDIF}

{$IFDEF DEMO3}
sDemoVer := 'rst';
{$ENDIF}
..
//use sDemoVer somewhere ....

Open in new window

0
shawn857Author Commented:
Jimy and Sinisa - very good suggestions about using the filename "properties" and conditional directives, respectively! That will work! I think the filename "properties" may work a little better and easier for me. Jimy, may I ask how would I read these properties fields programmatically from my Delphi app?

Thanks!
    Shawn
0
jimyXCommented:
> "how would I read these properties fields programmatically from my Delphi app?"

Attached please find a sample, you can apply to your "autoresponder" if you find useful/applicable.

To make it work, you should enable the Application Version for your demo first (under Delphi menu -> Project -> Options... -> "Version info." -> Check "Include version information in project"). That's it up to this point, you can leave it to default '0.0.0.0'.

Now you have four elements that you can utilize as instrument of controlling, to which category this demo is under:
Major, Minor, Release and Build

You can leave the Major & Minor to define your application version, if you want, and use Release and Build to identify the category/bundle type (in lieu of xyz, abc, rst...etc), or you can use all of them, that's up to you.

You can make a code of identification like "0.0.0.1" for xyz:
Major: 0
Minor: 0
Release: 0
Build: 1

"0.0.0.2" for abc:
Major: 0
Minor: 0
Release: 0
Build: 2

"0.0.43.301" for rst:
Major: 0
Minor: 0
Release: 43
Build: 301

And so on, there is no limit to how you can do it.

You can figure out how you want to make your secret combination.

PS: You can't set the info while the exe is running but you can read it.
D7-Get-Version-Info.zip
0
shawn857Author Commented:
OK yeah, that would work, but I was thinking more along the lines of one of those items under the Properties|Summary tab, like Title, Subject, Author, Category, Keywords. Couldn't I just type my "xyz" string in any of those and that then have my app read that field?

Thanks!
    Shawn
0
Sinisa VukSoftware architectCommented:
Put this xyz in field InternalName and access it with win api functions. More details in this article or here. You coud have as many prj files as you wan with same source in it. Projects prj define exe name too (app_name_xyz.prj)
0
shawn857Author Commented:
Thanks Sinisa... I kind of don't get it though, I don't think we're on the same page here. When I right-click an EXE file and view its "properties", I see this screen under the "Summary" tab (attached screenshot). It has fields - Title, Subject, Author, Category, Keywords. I don't see "InternalName" anywhere. Maybe we're getting our lines crossed a bit - I would like to be able to "set" my xyz value manually just by typing it into a field somewhere in this Properties|Summary screen... and then be able to retrieve that value later programmatically.

Thanks
    Shawn
FileProperties.PNG
0
Sinisa VukSoftware architectCommented:
in delphi - go to Project - Options - Version info - find InternalFilename field .... set xyz (for each project different) ... and check it with code.
0
shawn857Author Commented:
Thanks Sinisa, but in that way I'd have to compile and create several different exe's. I'd prefer to create just one EXE, then manually type in my 'xyz' code into one of the exe filename's properties - like Title, Subject, Author, Category, Keywords. This is not possible?

Thanks
   Shawn
0
Sinisa VukSoftware architectCommented:
This is how I do: In Project Manager - there are project group on top - just save it with your own name for later. Then add to that project group all projects (.dpr) - but all of these projects are linked to same source files (.pas, .dfm). In Menu - Project - is item Build all projects - so - one click to build all ....
In Project Manager - double click - activate one project at time - then set for each project in Project/Options - Version info ... Try it ....
-----

It is possible to change exes info for InternalName using some Resource editor ... but this soud be done each time you compile ...
some info how to do with some script:
http://www.heaventools.com/rtconsole-update-version-info.htm
http://www.autoitscript.com/forum/topic/125873-file-version-info-editor/
0
Sinisa VukSoftware architectCommented:
second thought ... I make ver_xyz.rc file with contents:
VS_VERSION_INFO VERSIONINFO
    FILEVERSION    1,0,0,0
    PRODUCTVERSION 1,0,0,0
{
    BLOCK "StringFileInfo"
    {
        BLOCK "040904b0"
        {
            VALUE "CompanyName",        "Firm Inc.\0"
            VALUE "FileDescription",    "ProgXYZ\0"
            VALUE "FileVersion",        "1.0.0.0\0"
            VALUE "LegalCopyright",     "© 2015 Firm Inc. All Rights Reserved\0"
            VALUE "OriginalFilename",   "ProgXYZ.exe\0"
            VALUE "ProductName",        "ProgXYZ\0"
            VALUE "ProductVersion",     "1.0.0.0\0"
            VALUE "InternalName",        "xyz\0"
        }
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x409, 1200
    }
}

Open in new window


build rc (into .res file) with (put in .bat file):
"C:\Program Files\Borland\Delphi7\Bin\BRCC32.exe" ver_xyz.rc

Open in new window


... ver.res file can be added/replaced in exe .... using Resource Hacker:
ResHacker -add ProgXYZ.exe, ProgXYZ_xyz.exe, ver_xyz.res,,,

Open in new window

...
and for other ...
ResHacker -add ProgXYZ.exe, ProgXYZ_abc.exe, ver_abc.res,,,

Open in new window

0
jimyXCommented:
> but I was thinking more along the lines of one of those items under the Properties|Summary tab, like Title, Subject, Author, Category, Keywords.

Not directly possible, it needs sometime to research.

Another idea by employing the Version Info. (Major, Minor, Release and Build), is to convert "xyz" to Hex and then to Decimal and store in the Version Info. under "Build", and when reading, reverse the conversion.
How is that?
0
shawn857Author Commented:
Thank you guys!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.