PDA

View Full Version : File Replacement on Memory Stick



LOUDWORLD
08-04-2009, 02:12 AM
I am distributing a project on Memory Stick that will include a safety manual that will be subject to quarterly updates. The users will be emailed an updated copy of the manual and I would like the autoplay to have the functionality of automatically overwriting the existing file (it'll be a PDF) with the new one, perhaps a hotspot on the appy that you drag the new file to.

As you can never underestimate the stupidity of people, especially in large groups, I can't just put out instructions for overwriting the file and expect the whole demographic to figure it out.

Speaking of stupidity, I have worked with AMS since 4.0 but lack the brains to figure out the coding, I have always used the Wizards, so please don't baffle me further with variables and strings and stuff cuz it's beyond me.

A friendly nudge in the right direction would be greatly appreciated. I wack o code with instructions for using it would be even better.

Thankx!
Lou

LOUDWORLD
08-04-2009, 03:32 AM
Further research within the Forums & the Help File has got me thus far. Please excuse my primitive coding, but we gotta start somewhere;

On preload the appy creates a folder in the user's 'My Documents' called HE UPDATES. When they are emailed a new version they will be instructed to save it to this folder. The update is attached for testing.

The desired behaviour is; when they 'Click to Update Manual' that file, which may or may not have the same file name, will overwrite the current 'Safety Manual' PDF in the docs folder.

Perhaps there needs to be a File.Rename in the middle there? The final action upon exit would be to delete the update in the My Documents\HE UPDATES folder so there is no confusion when the next update arrives, but not delete the folder.

Unfortunately when I run this I get the error message indicating the copy has failed.

Gentle Nudges and Smacks with Frying Pans are apreciated!
Lou

longedge
08-04-2009, 04:50 AM
Why not use File.GetAttributes and look at the .WriteDateISO element of the returned table. Always use the same file name and just overwrite if the one in the My Docs folder is newer.

I wouldn't leave it to the user to manually update I'd just do it as part of the application startup.