Re: Problem saving image for file

2018-07-28 Thread Stephen MacLean via use-livecode
Thanks Mike, I like your code, cleaner, smaller and easier to understand.

And thanks for the explanation… I get it:)

Again, thanks to all who responded!


> On Jul 28, 2018, at 11:02 PM, Mike Bonner via use-livecode 
>  wrote:
> 
> It's just how file systems work.  If the beginning character is / that
> means it starts at the root of the file system.  Since you had already set
> the defaultfolder, and wanted to go relative to there, you would just
> specify the folder name/filename.  Or as I said, pre-pend a dot.   In fact,
> 2 dots .. stands for the next folder towards the root so you can do weird
> things like dir ../../..  which will list the contents of a folder 3 levels
> above the current.
> 
> You also don't need to actually set the defaultfolder, you could do as in
> your example...
> 
> set the itemDelimiter to slash
> get the effective filename of this stack
> put tTempCrop into URL "binfile:" & item 1 to - 2 of it &
> "/tempMedia/testimage.jpg"
> 
> In the case of the above you DO need the slash before tempMedia because
> there is no trailing slash when you get item 1 to -2 of it.  But, item 1 to
> -2 of it is a path starting from the root so you end up with an absolute
> path rather than a relative path.  IE it would be something like
> /home/username/desktop/mystackfolder/tempMedia/testimage.jpg
> 
> 
> 
> On Sat, Jul 28, 2018 at 8:45 PM Stephen MacLean via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> Thank you to all who replied!
>> 
>> Adding the “.” solved the problem and the file saved where it was supposed
>> to.
>> 
>> Confusing, because you would think that setting the defaultFolder would
>> allow you to specify the next sub folder like I did… and it’s not
>> mentioned, that I saw, in the docs.
>> 
>> Thanks again!
>> 
>> Steve
>> 
>>> On Jul 28, 2018, at 5:52 PM, Mike Bonner via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> 
>>> If you use the path /tempMedia that forces it to the root of the
>>> filesystem and if there isn't a folder /tempmedia, it'll fail.  Either
>>> leave off the preceding slash, or prepend it with a . <--(a dot) which
>>> designates the current directory.
>>> 
>>> On Sat, Jul 28, 2018 at 3:40 PM Peter Bogdanoff via use-livecode <
>>> use-livecode@lists.runrev.com> wrote:
>>> 
 That is (or use variables for the filename):
> export image "testimage.jpg"  to file "/tempMedia/testimage.jpg" as
>> JPEG
 
 
 
 
> On Jul 28, 2018, at 2:37 PM, Peter Bogdanoff via use-livecode <
 use-livecode@lists.runrev.com> wrote:
> 
> Hi,
> 
> Try using this syntax:
> export image "tImage"  to file "/tempMedia/testimage.jpg" as JPEG
> 
> I think you need binfile to read but not to write.
> Peter
> 
> 
>> On Jul 28, 2018, at 1:41 PM, Stephen MacLean via use-livecode <
 use-livecode@lists.runrev.com> wrote:
>> 
>> Hi All,
>> 
>> Been a long time since I’ve done file work with LC, but I’m having an
 issue saving an image to a file:
>> 
>> # set the defaultFolder to the folder containing the stackfile
>> 
>> set the itemDelimiter to slash
>> 
>> get the effective filename of this stack
>> 
>> set the defaultFolder to item 1 to -2 of it
>> 
>> put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
>> 
>> 
>> results in a “Can’t open file” error.
>> 
>> Trying to save to a folder called “tempMedia” that is in the same
 directory as the stack.
>> 
>> Mac OS 10.12.6, 9.01 RC1 Business.
>> 
>> TIA,
>> 
>> Steve MacLean
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> 

Re: Problem saving image for file

2018-07-28 Thread Mike Bonner via use-livecode
It's just how file systems work.  If the beginning character is / that
means it starts at the root of the file system.  Since you had already set
the defaultfolder, and wanted to go relative to there, you would just
specify the folder name/filename.  Or as I said, pre-pend a dot.   In fact,
2 dots .. stands for the next folder towards the root so you can do weird
things like dir ../../..  which will list the contents of a folder 3 levels
above the current.

You also don't need to actually set the defaultfolder, you could do as in
your example...

set the itemDelimiter to slash
get the effective filename of this stack
put tTempCrop into URL "binfile:" & item 1 to - 2 of it &
"/tempMedia/testimage.jpg"

In the case of the above you DO need the slash before tempMedia because
there is no trailing slash when you get item 1 to -2 of it.  But, item 1 to
-2 of it is a path starting from the root so you end up with an absolute
path rather than a relative path.  IE it would be something like
/home/username/desktop/mystackfolder/tempMedia/testimage.jpg



On Sat, Jul 28, 2018 at 8:45 PM Stephen MacLean via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Thank you to all who replied!
>
> Adding the “.” solved the problem and the file saved where it was supposed
> to.
>
> Confusing, because you would think that setting the defaultFolder would
> allow you to specify the next sub folder like I did… and it’s not
> mentioned, that I saw, in the docs.
>
> Thanks again!
>
> Steve
>
> > On Jul 28, 2018, at 5:52 PM, Mike Bonner via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > If you use the path /tempMedia that forces it to the root of the
> > filesystem and if there isn't a folder /tempmedia, it'll fail.  Either
> > leave off the preceding slash, or prepend it with a . <--(a dot) which
> > designates the current directory.
> >
> > On Sat, Jul 28, 2018 at 3:40 PM Peter Bogdanoff via use-livecode <
> > use-livecode@lists.runrev.com> wrote:
> >
> >> That is (or use variables for the filename):
> >>> export image "testimage.jpg"  to file "/tempMedia/testimage.jpg" as
> JPEG
> >>
> >>
> >>
> >>
> >>> On Jul 28, 2018, at 2:37 PM, Peter Bogdanoff via use-livecode <
> >> use-livecode@lists.runrev.com> wrote:
> >>>
> >>> Hi,
> >>>
> >>> Try using this syntax:
> >>> export image "tImage"  to file "/tempMedia/testimage.jpg" as JPEG
> >>>
> >>> I think you need binfile to read but not to write.
> >>> Peter
> >>>
> >>>
>  On Jul 28, 2018, at 1:41 PM, Stephen MacLean via use-livecode <
> >> use-livecode@lists.runrev.com> wrote:
> 
>  Hi All,
> 
>  Been a long time since I’ve done file work with LC, but I’m having an
> >> issue saving an image to a file:
> 
>  # set the defaultFolder to the folder containing the stackfile
> 
>  set the itemDelimiter to slash
> 
>  get the effective filename of this stack
> 
>  set the defaultFolder to item 1 to -2 of it
> 
>  put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
> 
> 
>  results in a “Can’t open file” error.
> 
>  Trying to save to a folder called “tempMedia” that is in the same
> >> directory as the stack.
> 
>  Mac OS 10.12.6, 9.01 RC1 Business.
> 
>  TIA,
> 
>  Steve MacLean
>  ___
>  use-livecode mailing list
>  use-livecode@lists.runrev.com
>  Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
>  http://lists.runrev.com/mailman/listinfo/use-livecode
> >>>
> >>> ___
> >>> use-livecode mailing list
> >>> use-livecode@lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Problem saving image for file

2018-07-28 Thread Stephen MacLean via use-livecode
Thank you to all who replied! 

Adding the “.” solved the problem and the file saved where it was supposed to.

Confusing, because you would think that setting the defaultFolder would allow 
you to specify the next sub folder like I did… and it’s not mentioned, that I 
saw, in the docs.

Thanks again!

Steve

> On Jul 28, 2018, at 5:52 PM, Mike Bonner via use-livecode 
>  wrote:
> 
> If you use the path /tempMedia that forces it to the root of the
> filesystem and if there isn't a folder /tempmedia, it'll fail.  Either
> leave off the preceding slash, or prepend it with a . <--(a dot) which
> designates the current directory.
> 
> On Sat, Jul 28, 2018 at 3:40 PM Peter Bogdanoff via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> 
>> That is (or use variables for the filename):
>>> export image "testimage.jpg"  to file "/tempMedia/testimage.jpg" as JPEG
>> 
>> 
>> 
>> 
>>> On Jul 28, 2018, at 2:37 PM, Peter Bogdanoff via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
>>> 
>>> Hi,
>>> 
>>> Try using this syntax:
>>> export image "tImage"  to file "/tempMedia/testimage.jpg" as JPEG
>>> 
>>> I think you need binfile to read but not to write.
>>> Peter
>>> 
>>> 
 On Jul 28, 2018, at 1:41 PM, Stephen MacLean via use-livecode <
>> use-livecode@lists.runrev.com> wrote:
 
 Hi All,
 
 Been a long time since I’ve done file work with LC, but I’m having an
>> issue saving an image to a file:
 
 # set the defaultFolder to the folder containing the stackfile
 
 set the itemDelimiter to slash
 
 get the effective filename of this stack
 
 set the defaultFolder to item 1 to -2 of it
 
 put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
 
 
 results in a “Can’t open file” error.
 
 Trying to save to a folder called “tempMedia” that is in the same
>> directory as the stack.
 
 Mac OS 10.12.6, 9.01 RC1 Business.
 
 TIA,
 
 Steve MacLean
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
>>> 
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Problem saving image for file

2018-07-28 Thread Pi Digital via use-livecode
Hi Steve

First, a quick way to the stack or standalone folder is 
specialfolderpath(“resources”). 

Check that your folders permissions are ok. 

export snapshot from rect 0,0,100,100 of this card to url 
("binfile:"("resources")&"/Pic.jpg") as JPEG

See if this helps when using your put tTempCrop into url(). 

> On 28 Jul 2018, at 21:41, Stephen MacLean via use-livecode 
>  wrote:
> 
> Hi All,
> 
> Been a long time since I’ve done file work with LC, but I’m having an issue 
> saving an image to a file:
> 
> # set the defaultFolder to the folder containing the stackfile
> 
> set the itemDelimiter to slash
> 
> get the effective filename of this stack
> 
> set the defaultFolder to item 1 to -2 of it
> 
> put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
> 
> 
> results in a “Can’t open file” error.
> 
> Trying to save to a folder called “tempMedia” that is in the same directory 
> as the stack.
> 
> Mac OS 10.12.6, 9.01 RC1 Business.
> 
> TIA,
> 
> Steve MacLean
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Problem saving image for file

2018-07-28 Thread Mike Bonner via use-livecode
If you use the path /tempMedia that forces it to the root of the
filesystem and if there isn't a folder /tempmedia, it'll fail.  Either
leave off the preceding slash, or prepend it with a . <--(a dot) which
designates the current directory.

On Sat, Jul 28, 2018 at 3:40 PM Peter Bogdanoff via use-livecode <
use-livecode@lists.runrev.com> wrote:

> That is (or use variables for the filename):
> > export image "testimage.jpg"  to file "/tempMedia/testimage.jpg" as JPEG
>
>
>
>
> > On Jul 28, 2018, at 2:37 PM, Peter Bogdanoff via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >
> > Hi,
> >
> > Try using this syntax:
> > export image "tImage"  to file "/tempMedia/testimage.jpg" as JPEG
> >
> > I think you need binfile to read but not to write.
> > Peter
> >
> >
> >> On Jul 28, 2018, at 1:41 PM, Stephen MacLean via use-livecode <
> use-livecode@lists.runrev.com> wrote:
> >>
> >> Hi All,
> >>
> >> Been a long time since I’ve done file work with LC, but I’m having an
> issue saving an image to a file:
> >>
> >> # set the defaultFolder to the folder containing the stackfile
> >>
> >> set the itemDelimiter to slash
> >>
> >> get the effective filename of this stack
> >>
> >> set the defaultFolder to item 1 to -2 of it
> >>
> >> put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
> >>
> >>
> >> results in a “Can’t open file” error.
> >>
> >> Trying to save to a folder called “tempMedia” that is in the same
> directory as the stack.
> >>
> >> Mac OS 10.12.6, 9.01 RC1 Business.
> >>
> >> TIA,
> >>
> >> Steve MacLean
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Problem saving image for file

2018-07-28 Thread Peter Bogdanoff via use-livecode
That is (or use variables for the filename):
> export image "testimage.jpg"  to file "/tempMedia/testimage.jpg" as JPEG




> On Jul 28, 2018, at 2:37 PM, Peter Bogdanoff via use-livecode 
>  wrote:
> 
> Hi,
> 
> Try using this syntax:
> export image "tImage"  to file "/tempMedia/testimage.jpg" as JPEG
> 
> I think you need binfile to read but not to write.
> Peter
> 
> 
>> On Jul 28, 2018, at 1:41 PM, Stephen MacLean via use-livecode 
>>  wrote:
>> 
>> Hi All,
>> 
>> Been a long time since I’ve done file work with LC, but I’m having an issue 
>> saving an image to a file:
>> 
>> # set the defaultFolder to the folder containing the stackfile
>> 
>> set the itemDelimiter to slash
>> 
>> get the effective filename of this stack
>> 
>> set the defaultFolder to item 1 to -2 of it
>> 
>> put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
>> 
>> 
>> results in a “Can’t open file” error.
>> 
>> Trying to save to a folder called “tempMedia” that is in the same directory 
>> as the stack.
>> 
>> Mac OS 10.12.6, 9.01 RC1 Business.
>> 
>> TIA,
>> 
>> Steve MacLean
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription 
>> preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Problem saving image for file

2018-07-28 Thread Peter Bogdanoff via use-livecode
Hi,

Try using this syntax:
export image "tImage"  to file "/tempMedia/testimage.jpg" as JPEG

I think you need binfile to read but not to write.
Peter


> On Jul 28, 2018, at 1:41 PM, Stephen MacLean via use-livecode 
>  wrote:
> 
> Hi All,
> 
> Been a long time since I’ve done file work with LC, but I’m having an issue 
> saving an image to a file:
> 
> # set the defaultFolder to the folder containing the stackfile
> 
> set the itemDelimiter to slash
> 
> get the effective filename of this stack
> 
> set the defaultFolder to item 1 to -2 of it
> 
> put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"
> 
> 
> results in a “Can’t open file” error.
> 
> Trying to save to a folder called “tempMedia” that is in the same directory 
> as the stack.
> 
> Mac OS 10.12.6, 9.01 RC1 Business.
> 
> TIA,
> 
> Steve MacLean
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Problem saving image for file

2018-07-28 Thread Stephen MacLean via use-livecode
Hi All,

Been a long time since I’ve done file work with LC, but I’m having an issue 
saving an image to a file:

# set the defaultFolder to the folder containing the stackfile

set the itemDelimiter to slash

get the effective filename of this stack

set the defaultFolder to item 1 to -2 of it

put tTempCrop into URL "binfile:/tempMedia/testimage.jpg"


results in a “Can’t open file” error.

Trying to save to a folder called “tempMedia” that is in the same directory as 
the stack.

Mac OS 10.12.6, 9.01 RC1 Business.

TIA,

Steve MacLean
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode