Check and then delete a local file?


#1

Hi all,

Is it possible for Axure to check whether or not a particular file (eg a dummy text.txt file) exists in a local directory, and also if there is an option to delete it from Axure?

What I really want to do is be able to disable my Axure prototype after a certain date, and I don’t want the user to simply change the computer’s system date to reenable the prototype.

Any ideas?


#2

Hmm, Axure RP doesn’t have functionality for deleting files that are saved to your local machine; this would have to be done manually by you on the machine where the file is saved.

As far as prototypes published to Axure Share, if you want to disable the published prototype after a certain date this can be done manually by logging in to Axure Share in the web browser and then either deleting the prototype to completely remove it, or adding/changing the password on the prototype to prevent users who have the URL from being able to see the content. Does that help a bit?


#3

Hi Alyssa,

Thanks for your reply, but we cannot use Axure Share as the prototype must be stored on the client’s laptop with no internet available.

Any other ideas on how to achieve this goal? Could you please ask around your technical team too please?


#4

Bump. Anyone with ideas on how to do this?


#5

Hi dav123456,

I’ll bite. You have an Axure prototype running locally on a client’s machine’s web browsers. If you want to prototype deleting a file, that’s easy enough, but you won’t be working with real files and you shouldn’t want to.

You can show a file or an entire list of files in the prototype, and then your Axure prototype can allow those items to be “deleted” with some user action or button, then showing whatever sort of confirmation dialog you wish, a ‘deleting the file’ animation, a completion message and then an updated list of files.

However, the files are artificial constructs in an Axure repeater, not real files on an actual hard drive. Prototypes are never supposed to access the local file system, but that doesn’t stop you from working out the entire user flow. The point of prototypes is to quickly work out all the look and feel and usability issues before devs build the real thing.

Let me know if I have outlined a way you can move forward.

-Bill


#6

Thanks for your reply. I really appreciate it.

Just to be clear as I may have confused the matter by suggesting a possible solution to achieve my goal… what I really want to do is be able to disable my Axure prototype after a certain date, and I don’t want the user to simply change the computer’s system date to reenable the prototype. Once the date is reached, then the Axure prototype stood working and there is no way for it to be reenabled.

My original idea was to have a dummy file stored locally that is deleted after the set date and that the prototype checks for its existence before starting each time.

Does anyone have a way that this can be achieved?


#7

Off the top of my head it doesn’t look like there’s a way to do what you’re hoping for using Axure RP’s native functionality. As Bill pointed out, Axure RP doesn’t touch or modify files on the local file system and wouldn’t be able to delete/disable the prototype, or delete the dummy file. The closest native solution that I can think of would be to use an OnPageLoad event to check the current day’s date, and then use conditional logic to fire a “Close Current Window” event if the current day is past the date that you’ve chosen. This would in theory cause the prototype pages to just close themselves if the user tries to launch them after the specified date.


#8

I’m not sure, but I think I actually figured this out a while back. If you can bear with me a day or so, I should have a way to do it without accessing the local file system.

-Bill


#9

Yes please Bill.
No rush but if you can find it you would be a life saver!


#10

Here is an example. It uses HTML5 webstorage to know if something has expired or not.

On AxShare: https://9v4bqk.axshare.com/#g=1&p=axure_persistent_data_store

The RP File.persistent data store.rp (1.4 MB)

Cheers,

-Bill


#11

Thanks Bill, this is exactly what the doctor ordered! Wow! Thank you! It’s true that I have spent over an hour going through your demo and have learnt a lot. I still don’t understand why you check for the time component of the date… but I’ll work it out.

More importantly for me, and since you have mastered the injection of javascript from within Axure, I am wondering if you have ever managed to connect to an external database like MySQL (or even just a flat file stored on a server) to send and receive data from variables within Axure? I have been trying this for a long time now with no success, even trying to connect to Google-charts.

Ideally I would like to have a number of variables within Axure (eg X1, X2, X3, X4, … X10) that can be saved to a database and retrieved from the same database at will. I was thinking that I would need to set up a PHP file on the server and then interact with it via javascript from within Axure. But I’m not sure how. Once I have got that working, I would like to do it with larger data sets that I could then inject into a js chart within Axure… but that is down the track and would greatly lift the bar of what I can achieve with Axure as my main workhorse.

Is there any chance that you have done something like this and have an example you could share with me?


#12

Since this is on the clients computer and they have complete access to everything in the prototype, they could circumvent this if they wanted to. It’s only a question of how hard you make it and how hard they’re willing to try.

If you need something truly secure, Axure probably won’t do.


#13

Hi nkrisc, of course everything is hackable… however this is an EXCELLENT solution to store persistent data locally from within Axure. And more importantly it perfectly solved the problem I posed when most would consider it to be impossible.


#14

Sure, just pointing it out as well as for any people who find this thread in the future and might not realize that.


#15

Hi nkrisc. Interesting point. However, I think this is pretty good for simple persistent data storage or this specific use case: having a client try a prototype offline on their own PC and then expire at some point.

Here’s the way I would send it to a client:
Generate the prototype as HTML, zip it up and then send it to the client to use on their PC. In this way, the client doesn’t have access to the axure file itself and all the date/javascript can be hidden away. However, a determined client could open the browser’s devtools and tinker with everything, but that’s pretty far down the rabbit hole outside the use case.

-Bill


#16

Hi dav123456,

You are most welcome :slight_smile: The reason I check for the time component of the date (# of seconds since the epoch date), is that it allows a simple math comparison of whether one date is > than another.

Yes, I have accessed data from a MySQL database. It’s quite a bit more complex, but once you’re injecting javascript, ajax calls to PHP isn’t that bad. However, before doing anything like that, you’d want to set up a server and a MySQL database populated with data, then write php files to get/set database data, and then test it from a client side html page with javascript. If you already had all that working, then merely injecting the javascript into an axure page is quite easy and I can provide a sample of that.

The only difference is that you’d want to append an entire block of javascript to the head section of the html. That allows you to have javascript functions so that the ajax callbacks work. I try to avoid using external mySQL/PHP because it makes a prototype fragile (dependent on an external site’s php and database).

To keep my focus on design and not coding, I find it’s easier to fake a database with a hidden repeater within the Axure file, or by having a whole bunch of variables that are stored using webstorage as shown in this sample. You can store lots of variables (up to 5Mb) in webstorage, but of course, that is local to one user’s machine, not shared between users like a real external DB.

-Bill


#17

Hi Bill, this is exactly what I would like to achieve. Yes please I would love to have a sample of what you have done.

And once I achieve what you already done, then later I can start working on populating different js charts from an R data engine in near real time. A pet project for me.

Looking forward to your sample, and if possible a copy of the PHP file if you don’t mind.

Regards,
David


#18

Hi David,

That’s going to take me a bit longer. I have to pull apart some proprietary work for a client and scrub it.

So that I don’t forget when I can get to it, please start another topic with a clear title, such as ‘How to access MySQL DB from Axure?’ and reference me (SifuDynamic) in the text, and it will show up in my list of stuff.

Also, the clear title will help other users find and reference the question and answer in the future. :grinning:

-Bill


closed #19

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.