Application Build Number

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Jason1234
Posts: 42
Joined: Sat Jun 18, 2011 9:20 am

Application Build Number

Post by Jason1234 » Fri Dec 30, 2011 8:45 am

I am sorry if this is obvious but after searching the Forum, Google, Dictionary and the Tutorials I have been unable to find the answer.

Actually this is a common problem due to the mass of information and hence the use of this excellent Forum again.

I need to retrieve and use the Build Number of the completed application at runtime to display the current version to the user. I can easily retrieve the Livecode development version but this is of little use to the end user.

Any help would be appreciated.

Thanks

Jason
Windows / MAC / IOS / Android - Deployment
Build 5.5.4 / & Community Version 6.1

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

Re: Application Build Number

Post by FourthWorld » Fri Dec 30, 2011 3:12 pm

You can use "the buildnumber" global property, but if the engine's version won't matter to your users how will the build number matter?

If you're looking for your own version info, you can store that in a custom property of the stack for display in your app's About box.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Jason1234
Posts: 42
Joined: Sat Jun 18, 2011 9:20 am

Re: Application Build Number

Post by Jason1234 » Fri Dec 30, 2011 9:51 pm

Thank you for responding.

I am sorry as I had described what I was looking for incorrectly. I need to retrieve the File Version / Product Version number as set in the application build settings. The end user of the completed application will not care what the version number of the livecode development tool I used but the version number of his application....

I will try and deduce how I extract that variable for use as it is not described in any of the help files.. hence my initital post.

Regards

Jason
Windows / MAC / IOS / Android - Deployment
Build 5.5.4 / & Community Version 6.1

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

Re: Application Build Number

Post by jacque » Fri Dec 30, 2011 10:16 pm

The easiest way is just to store it yourself in a custom property. I think most of us do that.

But if you really do want to read the standalone builder properties, they are stored as a custom property set of the stack. If you turn on "LiveCode UI elements in lists" in the View menu you can see them. Once that's on, open the stack property inspector, go to the custom properties pane, change the custom property set to "cRevStandaloneSettings" and they all appear. To refer to any of them, use array notation:

get the cRevStandaloneSettings["iOS,bundle version"]
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Jason1234
Posts: 42
Joined: Sat Jun 18, 2011 9:20 am

Re: Application Build Number

Post by Jason1234 » Fri Dec 30, 2011 11:22 pm

Thank you for your help.

I will do that.

Regards

Jason
Windows / MAC / IOS / Android - Deployment
Build 5.5.4 / & Community Version 6.1

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Application Build Number

Post by marksmithhfx » Fri Nov 27, 2020 9:54 pm

jacque wrote:
Fri Dec 30, 2011 10:16 pm
The easiest way is just to store it yourself in a custom property. I think most of us do that.

But if you really do want to read the standalone builder properties, they are stored as a custom property set of the stack. If you turn on "LiveCode UI elements in lists" in the View menu you can see them. Once that's on, open the stack property inspector, go to the custom properties pane, change the custom property set to "cRevStandaloneSettings" and they all appear. To refer to any of them, use array notation:

get the cRevStandaloneSettings["iOS,bundle version"]
I thought I might combine these two ideas but apparently I am doing it wrong...

on mobileStandaloneSaved
set the appVersion of this stack to the cRevStandaloneSettings["ios,bundle version"] of this stack
end mobileStandaloneSaved

and later... in the mobile standalone

on preOpenCard
put the appVersion of this stack into fld "Version"
end preOpenCard

But I'm not seeing anything in the field?

Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: Application Build Number

Post by jacque » Fri Nov 27, 2020 10:51 pm

The mobileStandaloneSaved is sent after the standalone has been built. You probably want "savingMobileStandalone" which is sent immediately before the build.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Application Build Number

Post by marksmithhfx » Fri Nov 27, 2020 11:04 pm

jacque wrote:
Fri Nov 27, 2020 10:51 pm
The mobileStandaloneSaved is sent after the standalone has been built. You probably want "savingMobileStandalone" which is sent immediately before the build.
I've been fooling around and this is what I have learned...

Code: Select all

on SavingMobileStandalone
   -- put the cRevStandaloneSettings["iOS,bundle version"] of this stack after msg -- is empty
   put the cRevStandaloneSettings["ios,bundle version"] of this stack into tVersion
   put tVersion into msg -- tVersion is empty
   put "1.0.0" into tVersion 
   put tVersion into msg -- correct
   set the appVersion of this stack to tVersion -- works
   save this stack -- necessary
end SavingMobileStandalone
So I have the whole processing working correctly now, only -- cRevStandaloneSettings["iOS,bundle version"] -- doesn't appear to return anything.

Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: Application Build Number

Post by jacque » Sat Nov 28, 2020 10:08 pm

Something odd is going on. I tried it in LC 9.6.1 and got empty like you did. So I tried it in 9.6.0 and it worked. Then I went back to 9.6.1 and pasted the command I'd used in 9.6.0 into the message box, and it worked. Then I made a short test handler in the card script and it worked too. Naturally I'd be inclined to think I made a typo the first time, but checking the message box history that wasn't so.

My simple handler:

Code: Select all

on TEST
  put the cRevStandaloneSettings["ios,bundle version"] of this stack into tVers
  put tVers
end TEST
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Application Build Number

Post by marksmithhfx » Sun Nov 29, 2020 6:14 pm

jacque wrote:
Sat Nov 28, 2020 10:08 pm
Something odd is going on. I tried it in LC 9.6.1 and got empty like you did. So I tried it in 9.6.0 and it worked. Then I went back to 9.6.1 and pasted the command I'd used in 9.6.0 into the message box, and it worked. Then I made a short test handler in the card script and it worked too. Naturally I'd be inclined to think I made a typo the first time, but checking the message box history that wasn't so.

My simple handler:

Code: Select all

on TEST
  put the cRevStandaloneSettings["ios,bundle version"] of this stack into tVers
  put tVers
end TEST
Hi Jacque,

I put that in my stack script, modified it to read ... put "Mark:" tVers and only saw "Mark:" in the msg box (called the handler from SavingMobileStandalone) . I also have 9.6.0 but do not (for space reasons) have Xcode 11.4 configured so wasn't able to test that. I'll send it to the mothership.

Thanks for checking.
M
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: Application Build Number

Post by jacque » Sun Nov 29, 2020 11:00 pm

My theory about the empty response I got in the message box is that the wrong stack was being queried (I had several open.) I've seen this happen frequently. Even if the message box says the correct stack is the target, some other stack receives the message/command.

Have you double-checked standalone settings to make sure the version number is still there? Maybe it got removed somehow?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Application Build Number

Post by marksmithhfx » Mon Nov 30, 2020 12:50 am

jacque wrote:
Sun Nov 29, 2020 11:00 pm
Have you double-checked standalone settings to make sure the version number is still there? Maybe it got removed somehow?
I thought of that, but it's still there.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: Application Build Number

Post by jacque » Mon Nov 30, 2020 10:36 pm

Did you try the command from the message box? If it works there but doesn't work in SavingMobileStandalone then I'd think there's something wrong with SavingMobileStandalone. The engine strips out the standalone settings before doing the build, so they may have already been removed by the time that message is sent. That's what it looks like.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: Application Build Number

Post by marksmithhfx » Tue Dec 01, 2020 2:58 pm

jacque wrote:
Mon Nov 30, 2020 10:36 pm
Did you try the command from the message box? If it works there but doesn't work in SavingMobileStandalone then I'd think there's something wrong with SavingMobileStandalone. The engine strips out the standalone settings before doing the build, so they may have already been removed by the time that message is sent. That's what it looks like.
Hi Jacque, yes I had tried it from both places, and neither worked. Elanor and I have been discussing, and she sent me a stack. Here is the result of my playing with that.
Thanks Elanor. Short answer: I got it working.

Now for the long answer (where weird things are discovered)…

When I looked at your stack I realized you were reading it directly from the custom property set cRevStandaloneSettings (and this worked both in the IDE and when I compiled your app as a standalone).

I had been led to believe from this ancient thread (viewtopic.php?t=19253) and others like it that the StandaloneSettings were not stored in the standalone. Hence all the rigamarole to read it during the build process (on SaveMobileStandalone etc) into a cp. Silly me :)

So I had a line in my stack:
put "Version " & the cAppVersion of this stack into fld “Version” (which of course, as indicated previously, worked when I hard coded cAppVersion, but not when attempting to read/save the standalone settings during build)

So I replaced it with this line from your stack:
put the cRevStandaloneSettings["ios,bundle version"] of this stack into fld "Version"

And the result was: NOTHING. Nada, Zip. Now I had already tried your stack previously in both the IDE and on the iPhone so I knew it should work.

So I go to Standalone settings to see if the iOS version number is still there. It is, 1.0.0. I change it to 1.2.3 (the number you used)

Now, I don’t recall if I then saved and reopened the stack, I might have, but in any event IT WORKED. There it was. I rushed back to the standalone settings and changed it back to 1.0.0 and that worked too!! In both the IDE and as a standalone.

All of a sudden this was all working and I have no idea why, or what changed, but something did. Mysterious.

Ok, now that I know (I think) that the standalone cps is saved with the standalone I’ll just use the line above and I’ve completely commented out my “on SavingMobileStandAlone” handler.

Thank you so much, once again you have come to the rescue!!!

Final comment. It’s incredibly hard to find any documentation on this and the StandAloneSettings entry in the dictionary (or the Livecode lesson of the same name) does not discuss it at all. Most of what I did find was in the forums, is hugely out of date and I think widely misunderstood.

But I thank you, and I am really grateful. You have sorted out so many issues for me, big and small. I guess this is a small one but it’s just nice to have the build number included visibly in each app, especially when it starts leaving the nest (no time soon, but thinking of eventualities). So this small thing, could one day be important.

Regards, Mark
Last edited by marksmithhfx on Tue Dec 01, 2020 10:29 pm, edited 1 time in total.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

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

Re: Application Build Number

Post by jacque » Tue Dec 01, 2020 7:15 pm

Interesting, we were all under the same delusion. It's also interesting that your first attempt failed and the second one didn't, which is what I saw too in my test.

This will change my workflow like it did yours.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”