Creating a installer

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

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

Re: Creating a installer

Post by bogs » Thu Feb 28, 2019 8:49 pm

ID-10-T, PEBCAK, I know them all after going on 8 years in that job.

You know, before I worked at that job, I used to get (what I thought were) funny emails from some of my friends that talked about doing tech support. They were always good for a laugh because, I guess, you never think of people being any better or worse than yourself.

After I worked at that job, though, for some reason the emails that *used* to make me laugh the hardest made me wince in commiseration :P

Shockingly, I did not loose the job over that incident. The gentlemen I was helping actually wound up apologizing to me during the call. My supervisor sure got a laugh out of it :D
Image

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Wed Mar 13, 2019 6:25 am

Too lazy to bump the thread, but anyway....

Onto the License agreement, is there a way to disable the button until a user clicks on the "agree to the license agreement"?

here's the code:

Code: Select all

on card
   if "I DO NOT agree with the License Agreement" is selected then disable this button "Next"
end card

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Creating a installer

Post by mrcoollion » Wed Mar 13, 2019 10:28 am

You could use a free installer.. or even make it a portable with a portable app installer.
See links under chapter Packaging :
https://portableapps.com/apps/development
or
https://helpdeskgeek.com/free-tools-rev ... -packages/

Regards,

Paul

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Wed Mar 13, 2019 10:40 am

mrcoollion wrote:
Wed Mar 13, 2019 10:28 am
You could use a free installer.. or even make it a portable with a portable app installer.
Sorry, but these are only for windows, if I want something cross-platform and at a lower pricing point, this is the only way I go. LiveCode does have a ability of becoming a standalone application

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Creating a installer

Post by jmburnod » Wed Mar 13, 2019 11:49 am

Hi Mickey,
Onto the License agreement, is there a way to disable the button until a user clicks on the "agree to the license agreement"?
Yes :D

You may use a preopencard handler to do that

Code: Select all

--checkbox script
on mouseup
   doAcceptOrNot
end mouseup

--cd script
on preopencard
   doAcceptOrNot
end preopencard

on doAcceptOrNot
   set the enabled of btn "bInstall" to the hilite of btn "bAccept"
end doAcceptOrNot
You have to consider that a standalone remain the same. Properties of yours controls too, but if you forget to check this then preopencard handler check it for you :D

Best regards
Jean-Marc
https://alternatic.ch

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

Re: Creating a installer

Post by jacque » Wed Mar 13, 2019 4:34 pm

Sorry, but these are only for windows, if I want something cross-platform
Well, like we said, Macs don't generally use installers. Linux has its own methods. So almost all the installers you find will be for Windows.

For the license agreement, just open the card with no radio button selected and the Next button disabled. If the user selects the Agree button, enable Next.

If your reason for writing a Mac installer is to provide the license agreement, you can do this when your app first launches.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Wed Mar 13, 2019 10:07 pm

jmburnod wrote:
Wed Mar 13, 2019 11:49 am
Hi Mickey,
Yes :D

You may use a preopencard handler to do that

Code: Select all

--checkbox script
on mouseup
   doAcceptOrNot
end mouseup

--cd script
on preopencard
   doAcceptOrNot
end preopencard

on doAcceptOrNot
   set the enabled of btn "bInstall" to the hilite of btn "bAccept"
end doAcceptOrNot
You have to consider that a standalone remain the same. Properties of yours controls too, but if you forget to check this then preopencard handler check it for you :D

Best regards
Jean-Marc
That worked, but apparently, in the start of the installation, because the "Next" button is tied to all other cards, the button will remain disabled until a user clicks accept and the installation goes on. If a user doesn't click on the "accept" checkbox, as the button is disabled, as if a user goes back to the "WelcomePage", then the button is still disabled. Is there a way to ONLY enable the button in the "WelcomePage" by code?

All I did was this:

Code: Select all

on WelcomePage
  enable btn "bNext"
end WelcomePage

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Creating a installer

Post by jmburnod » Wed Mar 13, 2019 11:13 pm

Is there a way to ONLY enable the button in the "WelcomePage" by code?
Yes again :D

on preopencard
if the short name of this cd = "WelcomePage" then enable btn "bNext"
end preopencard

Jean-Marc
https://alternatic.ch

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Thu Mar 14, 2019 6:18 am

Thank you. So here's where the next part comes....
Snipaste_2019-03-13_21-45-33.jpg
Snipaste_2019-03-13_21-45-33.jpg (22.9 KiB) Viewed 7123 times
Now if you're familiar with this, before you ask "why make a installation with a serial number validation? Is it for commercial use?", this is for testing use only. Once I make the installation and everything else, I will remove the card.

Anyway, I have no serial validation servers, instead, I use Gumroad's serial validation. Once if a user enters the key, clicks next, it'll send a HTTP POST data (using 'TsNetPost' to Gumroad's server, and if it comes out a "success", it'll move on with the installation. If not, then it'll pop a error that'll say "Serial Invalid! Try again".

now I did download a sample out of LiveCode's official step-by-step guide "How to use tsNetPost to perform a HTTP POST with callbacks", tried it out and I got a error that says "button "Send POSTs": execution error at line 26 (Function: error in function handler) near "tsNetPost", char 11"

Here's the code from the sample:

Code: Select all

on mouseUp
   local tPostData, tHeaders, tError, tUrl
   put empty into sRequest
   put empty into sResponse
   put empty into sError
   put 0 into sAsyncCount
   
   put "[WHY NO URL LINK ALLOWED]" into tUrl
   
   put "item=item1" into sRequest[1]
   put "item=item2" into sRequest[2]
   put "item=item3" into sRequest[3]
   put "item=item4" into sRequest[4]
   
   -- Set a counter of how many requests are to be sent
   put the number of lines of (the keys of sRequest) into sAsyncCount
   
   -- Loop through each request 
   repeat for each key tKey in sRequest
      -- Build the POST data
      put sRequest[tKey] into tPostData
      
      -- Send the request
      put tsNetPost(tKey,tUrl,tHeaders,tPostData,"postResponse") into tError
   end repeat
end mouseUp

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

Re: Creating a installer

Post by jacque » Thu Mar 14, 2019 6:40 pm

It's much simpler than that. Create key-value pairs as a web browser would do: key1=x&key2=y&key3=z

Then:

Code: Select all

post tValues to URL tURL 
put the result into tErr
put it into tResponse
You won't get both, either the result will be empty (success) and the "it" variable will have the server response, or the other way around.

If you're using the Community edition, POST uses libURL, otherwise it uses TSNet. That's automatic.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Thu Mar 14, 2019 6:46 pm

jacque wrote:
Thu Mar 14, 2019 6:40 pm
It's much simpler than that. Create key-value pairs as a web browser would do: key1=x&key2=y&key3=z

Then:

Code: Select all

post tValues to URL tURL 
put the result into tErr
put it into tResponse
You won't get both, either the result will be empty (success) and the "it" variable will have the server response, or the other way around.

If you're using the Community edition, POST uses libURL, otherwise it uses TSNet. That's automatic.
Is there a example code for libURL?

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

Re: Creating a installer

Post by Klaus » Thu Mar 14, 2019 6:57 pm

mikey186 wrote:
Thu Mar 14, 2019 6:46 pm
Is there a example code for libURL?
As Jaques wrote, libURL or tsNet, LC does this automatically, and the syntax is identical.
Check "post" in the dictionary, and maybe also "liburlformdata"

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

Re: Creating a installer

Post by jacque » Thu Mar 14, 2019 7:09 pm

Klaus is right, that is the example code. Three lines.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Thu Mar 14, 2019 8:35 pm

Thank you. I did a test stack using that same example, using RequestBin to see the data posting, and it works even it supports HTTPS, YES!!!! (I didn't know LiveCode Wiki was a thing, I thought it was only the documentation :evil: )

So now, once the POST is made, how do I make a response back? So like this, Once if a user enters the key, clicks next, it'll send a HTTP POST data (using 'libURL' to Gumroad's server), and if the result comes out a "success", it'll move on with the installation. If not, then it'll pop a error that'll say "Serial Invalid! Try again".

I made a diagram to give you a idea
Untitled Diagram (2).jpg

mikey186
Posts: 14
Joined: Wed Feb 27, 2019 9:18 am

Re: Creating a installer

Post by mikey186 » Sun Mar 17, 2019 6:29 am

Ok so I managed to look into the Wiki, and tried some experiments, and FINALLY found a solution to this! So now, how do I make the code ONLY work on one card when a user clicks on "next" as, again, the button is tied to all other cards. I use the 'preopencard' varible?

here's the code from the button

Code: Select all

on mouseUp
   put "[GUMROAD PRODUCT CODE]" into tProductCode
put field "SerialKeyField" into tMessage
get libURLFormData("product_permalink", tProductCode,"license_key", tMessage)
post it to url "[BUNGIE DID THIS URL LINK]"

if URLresponse contains "true" then
  go next card
else
  answer "INVALID!"
end if
end mouseUp

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”