Need Simple Variable Help! Please :D

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

Alex_CTZ
Posts: 21
Joined: Fri Jan 10, 2014 11:38 pm

Re: Need Simple Variable Help! Please :D

Post by Alex_CTZ » Thu Apr 17, 2014 2:18 am

magice wrote:
Alex_CTZ wrote:
Ahhh I love you! haha.

I did this:

Code: Select all

on mouseUp
   global serverLocation
   answer file "What is the server path?"
   put it into serverLocation
end mouseUp
and button 2

Code: Select all

on mouseUp
   global serverLocation
put serverLocation into variableserver
put "start " & variableserver into myShell
replace "'" with quote in myShell
get shell(myShell) 
end mouseUp
It works now :D Thank you so much, I now kind of understand the whole global and local variables :D

One more question,say I wanted to make a installer for something. How would I include a file so it could be put on the computer when installed? Can this be done?
Good job. However, using globals is a bad habit to get into, especially when you get into larger projects. To answer your other question, look at the menu bar under file for "Import as a control"

your homework:
Do some searching on this forum. there are several threads on using custom properties to store variables. also play around with the script local variables by declaring them local outside of handlers.
Thank you again so much. Will do ;)Hopefully ill come across you soon on the forums as you've been hugely helpful ;) Until then ;)

magice
Posts: 457
Joined: Wed Mar 18, 2009 12:57 am

Re: Need Simple Variable Help! Please :D

Post by magice » Thu Apr 17, 2014 2:41 am

Actually I should give you a better answer on the "including a file" question. The method I mentioned is very limited and my memory just caught up with the question. To import a file use this code (In a temporary button) to make it a custom property of the stack.

Code: Select all

on mouseUp
   set the cMyPropertyName of stack "MyStackName" to url("binfile:myFilePath")
end mouseUp
Now to extract it back out

Code: Select all

 put the cMyPropertyName of stack "MyStackName" into url("binfile:MyNewFilePath")

Post Reply