Check standalone version?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 222
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Check standalone version?

Post by thatkeith » Thu Nov 30, 2017 7:16 pm

When I build a stand-alone I set the app version. Is there a way to check the version of a standalone (my app’s own version, not the version of the underlying engine) by script?
I’d like my app to make a simple check for a newer version of itself (by checking for a bit of data in an online file) so it can prompt the user to go get the latest build. Nothing fancy, no auto-update, just ‘is the app version of me a lower numeric value than x’

Any thoughts?

K
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

Klaus
Posts: 10171
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Check standalone version?

Post by Klaus » Thu Nov 30, 2017 7:32 pm

Hi Keith,

since stacks do not have a version number or something, you will need to roll your own!
Simply create a custom property of your stack and put your version number into it.

Set CP:
...
set the cVersion of stack "your stack here..." to "1.00"
...
Get CP:
...
put the cVersion of stack "your stack here..." into tCurrentVersion
...
Then you can compare this one with your little "online file".


Best

Klaus

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 222
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Check standalone version?

Post by thatkeith » Thu Nov 30, 2017 7:44 pm

Heh. Good workaround! Also easy to use while in stack development mode. But is there no way for a *standalone* to find out its own version number? Given that it’s something stored internally in a plist (in a Mac app at least), it seems quite inelegant to have to roll my own. :-/
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

Klaus
Posts: 10171
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Check standalone version?

Post by Klaus » Thu Nov 30, 2017 7:49 pm

Hi Keith,

looks like I misunderstood you, you mean the infos you entered in the "Standalone builder settings", right?

They are stored in a custom property set in your stack -> cRevStandaloneSettings
Check what is in there and then you can use e.g.:
...
put the cRevStandaloneSettings["OSX,shortVersion"] of stack "your stack here" into tCurrentVersion
...

Best

Klaus

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 222
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Check standalone version?

Post by thatkeith » Thu Nov 30, 2017 7:56 pm

Fantastic! I’ll check that out, it sounds perfect.
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6044
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Check standalone version?

Post by FourthWorld » Thu Nov 30, 2017 8:06 pm

Klaus wrote:
Thu Nov 30, 2017 7:49 pm
Hi Keith,

looks like I misunderstood you, you mean the infos you entered in the "Standalone builder settings", right?

They are stored in a custom property set in your stack -> cRevStandaloneSettings
Check what is in there and then you can use e.g.:
...
put the cRevStandaloneSettings["OSX,shortVersion"] of stack "your stack here" into tCurrentVersion
...
Unless something has changed, I believe the IDE's standalone settings are removed from the stack in the resulting build.

I use a custom prop for version info.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

bogs
Posts: 1925
Joined: Sat Feb 25, 2017 10:45 pm

Re: Check standalone version?

Post by bogs » Thu Nov 30, 2017 9:07 pm

I think they are talking about these settings, Richard -

Image

Although I wouldn't mind being sure where to find the info you put there myself, as well as having it auto-increment the version for me :twisted: I think for ease on my part I'd also use a cprop for this, and setup a script to auto-increment it, possibly on save.

Of course, I'm usually far too lazy for that, I just wait till release and count up the number of 'built' folders :roll:
Image

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6044
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Check standalone version?

Post by FourthWorld » Fri Dec 01, 2017 12:44 am

bogs wrote:
Thu Nov 30, 2017 9:07 pm
I think they are talking about these settings, Richard -

Image
Yep, those are the ones. The IDE uses them to build standalones. Last time I check those properties are not present in the standalones built.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

bogs
Posts: 1925
Joined: Sat Feb 25, 2017 10:45 pm

Re: Check standalone version?

Post by bogs » Fri Dec 01, 2017 4:37 am

FourthWorld wrote:
Fri Dec 01, 2017 12:44 am
Yep, those are the ones. The IDE uses them to build standalones. Last time I check those properties are not present in the standalones built.
Hmm. I dunno, when I look at the standalone made (for mac, as that pictures settings showed), those settings are going into the plist, so the xml should be able to be parsed to retrieve the info you put in in standalone settings.
Image
I wonder if it might actually be storing this info in the standalone somewhere. The win standalone looks like a similar (but monolithic) structure -
Image
I didn't bother trying to sort through that mess :wink:

Whether it does or no, at least for the mac, you could pull that information from the plist file, thatkeith. But if you want consistency thats easy to code, either of Klaus's and Richard's answers, (cprop, anyway) work easier.
Image

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 222
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Check standalone version?

Post by thatkeith » Fri Dec 01, 2017 12:10 pm

Klaus wrote:
Thu Nov 30, 2017 7:49 pm
put the cRevStandaloneSettings["OSX,shortVersion"] of stack "your stack here" into tCurrentVersion
Bingo! Thanks Klaus, that's it. I won't have to remember to keep my own custom record of the standalone version in sync with reality, I can check against the value stored in the standalone automatically.

k
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4510
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Check standalone version?

Post by jacque » Fri Dec 01, 2017 6:21 pm

@Keith, what Richard said is true. The standalone settings are used to build the standalone (and to create the plist file) but are not included in the standalone itself. The info you want will return empty in the app.

I also use a custom property to store the current version, which does get saved into the standalone. Or you could read the plist file. I have used the standalone settings in a "savingStandalone" handler sometimes to automatically update the version property during a build.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 222
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Check standalone version?

Post by thatkeith » Fri Dec 01, 2017 7:31 pm

Ah, thanks everyone. I'm now using a custom prop as advised.
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

Post Reply

Return to “Talking LiveCode”