copying image acros stacks doesn't work on Mac

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: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

copying image acros stacks doesn't work on Mac

Post by markhinnebusch » Wed Jun 20, 2018 9:20 pm

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

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

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

Post by Klaus » Wed Jun 20, 2018 9:33 pm

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

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Wed Jun 20, 2018 9:35 pm

No, it doesn't make any difference.

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

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

Post by Klaus » Wed Jun 20, 2018 9:43 pm

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

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Wed Jun 20, 2018 9:46 pm

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.

SparkOut
Posts: 1809
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Wed Jun 20, 2018 9:49 pm

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.

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Wed Jun 20, 2018 10:13 pm

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.

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Wed Jun 20, 2018 10:20 pm

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.

SparkOut
Posts: 1809
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Wed Jun 20, 2018 11:06 pm

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.

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

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

Post by Klaus » Thu Jun 21, 2018 10:43 am

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)

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Thu Jun 21, 2018 3:44 pm

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.

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Thu Jun 21, 2018 3:50 pm

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?

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

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

Post by Klaus » Thu Jun 21, 2018 5:24 pm

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

markhinnebusch
Posts: 29
Joined: Thu May 17, 2018 7:32 pm
Location: Florida, USA

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

Post by markhinnebusch » Fri Jun 22, 2018 3:31 pm

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

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

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

Post by Klaus » Fri Jun 22, 2018 3:51 pm

Glad I could help!

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”