First Run - Forum

Forum Navigation
Forum breadcrumbs - You are here:VisualNEO Support ForumGeneral: GeneralFirst Run
You need to log in to create posts and topics.

First Run

Is there an easy way to detect a first run of an app, the aim being that is a user has not yet set up their details the app will go to page x and if they have page y

... and while I'm here - recommended code for dialling a number and sending an sms - please

Hi @clueadventures,

If you are talking about VisualNEO Win, the easiest approach is just cheking for the existence of a file. If the file does not exists, then it's the first time. You can even use that file to save user setup details.

FileExists "[PubDir]thedata.dat" "[Result]"
If "[Result]" "=" "True"
    AlertBox "Status" "You have been here!"
    GotoPage "Welcomeback"
Else
    AlertBox "Status" "It's your first time here!"
    FileWrite "[PubDir]thedata.dat" "1" "Dummy data"
    GotoPage "Setup"
EndIf

In VisualNEO Web, you can do something similar but, as you can't save files for security reasons you should use Local Storage instead.

Yes I do mean in VisualNeo Web - I can't find an equivalent to

FileExists

in local storage - I thought about just using a variable to achieve the same idea but get an error as on the first run the variable would not exist.

In VisualNEO Web you can try this:

GetItem "firstTime" [value]
If [value] == "ok"
   AlertBox "Status" "You have been here" ""
Else
   AlertBox "Status" "This is your first time here" ""
   SetItem "firstTime" "ok"
EndIf

 

netsurf72 has reacted to this post.
netsurf72

jQuery.Deferred exception: Unable to get property 'getItem' of undefined or null reference
Unable to get property 'getItem' of undefined or null reference (jquery.min.js, 2)

Please use a modern web browser to test it instead of the "Run" button. Just click on the Chrome or FireFox button to test the App (F5 to reload it in both of them). The Run button uses Internet Explorer, although good enough for most situations it's not suitable for many HTML5 programming APIs.

This what what I originally tried, so good to know I was on the right lines

Yes it works fine in Chrome and Edge. So will it be fine when finalised as an App?

 

Yes, every modern browser support Local Storage.