Page 1 of 1

copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 9:20 pm
by markhinnebusch
I have an interesting one. In my startup code, I copy an image from one stack to another. The script is

copy image "imgSplash" of stack "stkDetails" to this card

In the IDE on both Mac and Windows, it works. In a windows standalone it works fine. But in a Mac standalone (either 32 or 64 bit) it does not. If I wrap it in a try/catch, there is no catch.

Has me flummoxed. Any ideas?

thanks!
mark

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 9:33 pm
by Klaus
Hi Mark,

does it work if you proive the complete "address"?
...
copy image "imgSplash" of CARD "whatever" of stack "stkDetails" to this card
...

Best

Klaus

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 9:35 pm
by markhinnebusch
No, it doesn't make any difference.

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 9:43 pm
by Klaus
Maybe the result will give a clue?
...
copy image "imgSplash" of CARD "whatever" of stack "stkDetails" to this card
answer the result
...
Maybe not... :D

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 9:46 pm
by markhinnebusch
I added "answer it" after the copy and in the IDE, I get a dialog box with the long name of the image where it was copied, just like the documentation says. On the Mac standalone, I get an empty dialog box.

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 9:49 pm
by SparkOut
Also try "put the long id of <the image reference>" and/or "if there is an image <the image reference >" before you try to copy. You will hopefully get more clues as to what is wtong.
If it works in the IDE but not the standalone then it is most likely either a relative path issue or a standalone inclusions issue.

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 10:13 pm
by markhinnebusch
Well, I added

answer the long id of image "imgSplash" of stack "stkDetails"

and in the IDE it points to the correct place. However, in the Mac Standalone, it does not.

It says "/users/markhinnebusch/Jazz/MacOSX/Jazz.app/Contents/MacOS/stkDetails.livecode"

BUT

the actual standalone app that was created has the structure:

/users/markhinnebusch/Jazz/MacOSX/Jazz.app/Contents/MacOS contains just the jazz executable. All of the other stacks are in

/users/markhinnebusch/Jazz/MacOSX/Jazz.app/Contents/Resources/_MacOS/Externals

so it should be looking for

/users/markhinnebusch/Jazz/MacOSX/Jazz.app/Contents/Resources/_MacOS/Externals/stkDetails.livecode

I guess I should have mentioned that I am using the splash screen method for updating standalones, so the Jazz stack includes the other stacks, including stkDetails.livecode.

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 10:20 pm
by markhinnebusch
I just checked and this is the structure created for both 32 bit and 64 bit MacOS. Exactly the same results.

I am running Livecode Business 8.1.8

I tried to upgrade to 9 but the upgrade failed, so I just stayed on 8.1.8 but I can't believe that no one else has tried to do what I am doing.

Re: copying image acros stacks doesn't work on Mac

Posted: Wed Jun 20, 2018 11:06 pm
by SparkOut
Yes! Get used to specialFolderPath("resources") - this is where you will find all files and folders included in the standalone settings. It works on all architectures and is intended to reference "resource" files for this exact reason.
It is a read only location on most platforms. And loads of people do it this way.

Re: copying image acros stacks doesn't work on Mac

Posted: Thu Jun 21, 2018 10:43 am
by Klaus
Hi Mark,

if you added your stacks/files/whatever to your standalone via the "Copy files" tab in the "Standalone Application Settings", you will find it, as SparkOut mentioned, in your standalone here:
specialfolderpath("resources")

This pathname is very unlikely, unless you copied your stuff manually into the final application package.
/users/markhinnebusch/Jazz/MacOSX/Jazz.app/Contents/Resources/_MacOS/Externals
Best

Klaus

P.S.
The infos you provided after FIVE replies should have gone into your initial post. 8)

Re: copying image acros stacks doesn't work on Mac

Posted: Thu Jun 21, 2018 3:44 pm
by markhinnebusch
I put the other stacks, including stkDetails, under the Stacks tab in the standalone builder for Jazz.livecode. That seemed intuitive. I also tried putting them in copy files before coming to the forum but it still didn't see them.

So, I guess I'm quite confused. How would I use specialfolderpath("resources") in my code? I want to

copy image "imgSplash" of stack "stkDetails" to this card

Do I need to qualify stkDetails with specialfolderpath("resources")? I couldn't find any examples of doing that.

Re: copying image acros stacks doesn't work on Mac

Posted: Thu Jun 21, 2018 3:50 pm
by markhinnebusch
OH, wait. I think I got it. I use the stackFiles instruction in the openStack for jazz.livecode and put the references to all of the other stacks with their file names, using the SpecialFolder. Is that correct?

Re: copying image acros stacks doesn't work on Mac

Posted: Thu Jun 21, 2018 5:24 pm
by Klaus
Hi Mark,

since a file on disk can consist of one mainstack and zero to N substacks, "the stackfiles" is a list so LC knows what stack is saved in what FILE. The name of the stack does not have to match its filename!

So I would try this:

Code: Select all

...
put specialfolderpath("resources") & "/stkDetails.livecode" into tStack
copy image "imgSplash" of cd  X of stack tStack to this card
...
If the image is in a SUBSTACK of that stackfile:

Code: Select all

...
put specialfolderpath("resources") & "/stkDetails.livecode" into tStack
copy image "imgSplash" of cd  X of stack "name of your substack here..." of stack tStack to this card
...
Best

Klaus

Re: copying image acros stacks doesn't work on Mac

Posted: Fri Jun 22, 2018 3:31 pm
by markhinnebusch
Klaus,

Thank you so much. I wasn't aware that you could fully qualify the stack in that manner. It solves all of my problems (well, at least the ones that I know of).

-mark

Re: copying image acros stacks doesn't work on Mac

Posted: Fri Jun 22, 2018 3:51 pm
by Klaus
Glad I could help!