I'm trying to build a standalone shell that will open a stack in the same folder on my computer.
This code does not seem to work.
put the longfilepath of me into ThisLoc
put (ThisLoc & "/" & "Classroom Control Center") into ThisWindow
Open stack ThisWindow
Am I missing something?
Max
Open a stack from a Standalone
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Open a stack from a Standalone
Hi Max,
Filename of a standalone is different filename of a stack because a standalone is a package and packages are different in OS X and WIndows.
You can use this function to get the path of the folder where is your stack or standalone.
You have to consider that some messages like preopenstack, openstack... are catched by the mainstack if they are not in the stack script.
Best regards
Jean-Marc
Filename of a standalone is different filename of a stack because a standalone is a package and packages are different in OS X and WIndows.
You can use this function to get the path of the folder where is your stack or standalone.
Code: Select all
function getMyStackFolderPath
put the effective filename of this stack into rMainStackFolder
put the platform into tPlatForm
put the environment into pEnv
put the itemdel into OID
set the itemdel to "/"
put the num of items of rMainStackFolder into nbF
if tPlatForm = "MacOS" then
if pEnv = "standalone application" then
delete item (nbF-3) to nbf of rMainStackFolder
end if
if pEnv = "development" then
delete last item of rMainStackFolder
end if
else
delete last item of rMainStackFolder
end if
set the itemdel to OID
return rMainStackFolder
end getMyStackFolderPath
Best regards
Jean-Marc
https://alternatic.ch
Re: Open a stack from a Standalone
Thanks Jean-Marc, Thanks for the function.
I got the function working. I know I have the correct pathame but the stack is not opening,
"Classroom Control Center" is the mainstack name, spelling is correct.
I wrote
on mouseUp
put getMyStackFolderPath(rMainStackFolder) into ThisWindow
put ( ThisWindow & "/" & "Classroom Control Center") into ThisWindow
Open Stack ThisWindow
end mouseUp
I also tried "Open ThisWindow" and "Open Window ThisWindow" I put the code into a button. Did I do something wron
I got the function working. I know I have the correct pathame but the stack is not opening,
"Classroom Control Center" is the mainstack name, spelling is correct.
I wrote
on mouseUp
put getMyStackFolderPath(rMainStackFolder) into ThisWindow
put ( ThisWindow & "/" & "Classroom Control Center") into ThisWindow
Open Stack ThisWindow
end mouseUp
I also tried "Open ThisWindow" and "Open Window ThisWindow" I put the code into a button. Did I do something wron
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Open a stack from a Standalone
Hi Max,
There is no param for getMyStackFolderPath function.
Please try this:
Jean-Marc
There is no param for getMyStackFolderPath function.
Please try this:
Code: Select all
on mouseUp
put getMyStackFolderPath() into tMyFolder
put "MyStackToOpen.livecode" into tNameStack -- You have a stack called "MyStackToOpen.livecode" in folder tMyFolder
put tMyFolder & "/" & tNameStack into tPathStack
Open Stack tPathStack
end mouseUp
https://alternatic.ch
Re: Open a stack from a Standalone
Thank you Jean- Marc
I forgot the the name of a stack can be different than the display name of a stack.
It opens now, as well as opening another can of worms.
Max
I forgot the the name of a stack can be different than the display name of a stack.
It opens now, as well as opening another can of worms.
Max