Re: File exists

2016-04-02 Thread JB
Thanks for the code and info, Kay.

JB



> On Apr 2, 2016, at 10:53 AM, Kay C Lan  wrote:
> 
> On Sat, Apr 2, 2016 at 4:48 PM, JB  wrote:
>> If I open a file for read or write and the file does
>> not exist it will be created.
> 
> Just to clarify, that statement is incorrect.
> 
> If you open a file for 'write' and the file does not exist, it will be 
> created.
> 
> if you open a file for 'read' and the file does not exist 'the result'
> will be "can't open that file" and NO file is created.
> 
> on mouseUp
>   set the defaultFolder to specialFolderPath("documents")
>   open file "this is a test.lcdoc" for read
>   if  (the result is "can't open that file") then
>  --check if a file was created
>  if (there is a file "this is a test.lcdoc") then
> answer "A file was created!"
>  else
> answer "The file was NOT created."
>  end if
>   else
>  answer "You can read from it now!"
>   end if
> end mouseUp
> 
> Please also note that Richmond's example is misleading. If you use
> 'read from file' without first using  'open file' then regardless of
> whether the file exists or not, 'it' will always be empty.
> 
> ___
> 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: File exists

2016-04-02 Thread RM



On 2.04.2016 20:53, Kay C Lan wrote:

On Sat, Apr 2, 2016 at 4:48 PM, JB  wrote:

If I open a file for read or write and the file does
not exist it will be created.

Just to clarify, that statement is incorrect.

If you open a file for 'write' and the file does not exist, it will be created.

if you open a file for 'read' and the file does not exist 'the result'
will be "can't open that file" and NO file is created.

on mouseUp
set the defaultFolder to specialFolderPath("documents")
open file "this is a test.lcdoc" for read
if  (the result is "can't open that file") then
   --check if a file was created
   if (there is a file "this is a test.lcdoc") then
  answer "A file was created!"
   else
  answer "The file was NOT created."
   end if
else
   answer "You can read from it now!"
end if
end mouseUp

Please also note that Richmond's example is misleading. If you use
'read from file' without first using  'open file' then regardless of
whether the file exists or not, 'it' will always be empty.


Whoops: sorry about that one.

Richmond.



___
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: File exists

2016-04-02 Thread Kay C Lan
On Sat, Apr 2, 2016 at 4:48 PM, JB  wrote:
> If I open a file for read or write and the file does
> not exist it will be created.

Just to clarify, that statement is incorrect.

If you open a file for 'write' and the file does not exist, it will be created.

if you open a file for 'read' and the file does not exist 'the result'
will be "can't open that file" and NO file is created.

on mouseUp
   set the defaultFolder to specialFolderPath("documents")
   open file "this is a test.lcdoc" for read
   if  (the result is "can't open that file") then
  --check if a file was created
  if (there is a file "this is a test.lcdoc") then
 answer "A file was created!"
  else
 answer "The file was NOT created."
  end if
   else
  answer "You can read from it now!"
   end if
end mouseUp

Please also note that Richmond's example is misleading. If you use
'read from file' without first using  'open file' then regardless of
whether the file exists or not, 'it' will always be empty.

___
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: File exists

2016-04-02 Thread JB
Thank you, Richmond!
Your help is always appreciated.

JB



> On Apr 2, 2016, at 2:03 AM, RM  wrote:
> 
> Richmond.

___
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: File exists

2016-04-02 Thread JB
I LIKE THAT!

thank you very much.

JB



> On Apr 2, 2016, at 2:00 AM, Thierry Douez  wrote:
> 
> Hi,
> 
> there is a file ".."
> 
> HTH,
> 
> Thierry
> 
> 
> 2016-04-02 10:48 GMT+02:00 JB :
> 
>> If I open a file for read or write and the file does
>> not exist it will be created.  Is there a way to see
>> if the file exists before opening it?  I do not want
>> a file to be created if it does not exist.  I guess I
>> could check the creation date and if it was just
>> created then delete it but I was wondering if there
>> is a better way.
>> 
>> JB
>> 
> -- 
> 
> Thierry Douez - http://sunny-tdz.com
> sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
> ___
> 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: File exists

2016-04-02 Thread RM

Naively I tried this in a button:

on mouseUp
   if exists(file "HereWeGo.txt") then
  open file "HereWeGo.txt" for write
   else
  put "no such file"
  end if
end mouseUp

AND the thing didn't work because 'exists' only works for objects within 
Livecode.


BUT this seems a reasonable way to check for a file's existence:

on mouseUp
  read from file "HereWeGo.txt" for 1 line
  if it is empty then
 put "no such file"
 end if
end mouseUp

Richmond.

On 2.04.2016 11:48, JB wrote:

If I open a file for read or write and the file does
not exist it will be created.  Is there a way to see
if the file exists before opening it?  I do not want
a file to be created if it does not exist.  I guess I
could check the creation date and if it was just
created then delete it but I was wondering if there
is a better way.

JB





___
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: File exists

2016-04-02 Thread Thierry Douez
Hi,

there is a file ".."

HTH,

Thierry


2016-04-02 10:48 GMT+02:00 JB :

> If I open a file for read or write and the file does
> not exist it will be created.  Is there a way to see
> if the file exists before opening it?  I do not want
> a file to be created if it does not exist.  I guess I
> could check the creation date and if it was just
> created then delete it but I was wondering if there
> is a better way.
>
> JB
>
-- 

Thierry Douez - http://sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
___
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: File exists

2016-04-02 Thread -=>JB<=-
Files will do it;
I forget so easily.

JB



> On Apr 2, 2016, at 1:48 AM, JB  wrote:
> 
> If I open a file for read or write and the file does
> not exist it will be created.  Is there a way to see
> if the file exists before opening it?  I do not want
> a file to be created if it does not exist.  I guess I
> could check the creation date and if it was just
> created then delete it but I was wondering if there
> is a better way.
> 
> JB
> 
> ___
> 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


File exists

2016-04-02 Thread JB
If I open a file for read or write and the file does
not exist it will be created.  Is there a way to see
if the file exists before opening it?  I do not want
a file to be created if it does not exist.  I guess I
could check the creation date and if it was just
created then delete it but I was wondering if there
is a better way.

JB

___
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: [BEGINER] How can I check the local machine to see if a file exists

2013-05-18 Thread Shawn Blc
Got delete working too.  Now I need to spice it up a bit.


On Sat, May 18, 2013 at 12:00 AM, Shawn Blc  wrote:

> Thank you Mr. Eller.  How about delete file from remote server?
>
> I have this, but not working.  Can't find anything on nabble.
>
> *delete* URL ("http://someSubDomain.on-rev.com/test.txt";)
>
>
> On Fri, May 17, 2013 at 11:12 PM, Roger Eller  > wrote:
>
>> You need to know the path, but it's as easy as:
>>
>> if there is a file "c:/test.txt" then
>>answer "file exists"
>> else
>>answer" file doesn't exist"
>> end if
>>
>> ~Roger
>> On May 17, 2013 11:54 PM, "Shawn Blc"  wrote:
>>
>> > How can I check the local machine to see if a file exists?
>> > ___
>> > 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: [BEGINER] How can I check the local machine to see if a file exists

2013-05-17 Thread Shawn Blc
Thank you Mr. Eller.  How about delete file from remote server?

I have this, but not working.  Can't find anything on nabble.

*delete* URL ("http://someSubDomain.on-rev.com/test.txt";)


On Fri, May 17, 2013 at 11:12 PM, Roger Eller
wrote:

> You need to know the path, but it's as easy as:
>
> if there is a file "c:/test.txt" then
>answer "file exists"
> else
>answer" file doesn't exist"
> end if
>
> ~Roger
> On May 17, 2013 11:54 PM, "Shawn Blc"  wrote:
>
> > How can I check the local machine to see if a file exists?
> > ___
> > 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: [BEGINER] How can I check the local machine to see if a file exists

2013-05-17 Thread Roger Eller
You need to know the path, but it's as easy as:

if there is a file "c:/test.txt" then
   answer "file exists"
else
   answer" file doesn't exist"
end if

~Roger
On May 17, 2013 11:54 PM, "Shawn Blc"  wrote:

> How can I check the local machine to see if a file exists?
> ___
> 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


[BEGINER] How can I check the local machine to see if a file exists

2013-05-17 Thread Shawn Blc
How can I check the local machine to see if a file exists?
___
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: Checking if file exists in a Windows system directory

2012-09-24 Thread Bob Sneidar
There can be. First, if the enclosing folder does not have at least read 
permission, you will see nothing in the folder. Also, even under XP, certain 
folders contents were hidden, even to an administrator, until you told Windows 
you did in fact want to see the files in that folder. (Silly I know. What admin 
is going to decline to see the files in a folder he is trying to open??) 

Then there are more granular permissions, like list folder / read data, 
traverse folder / execute file, read attributes, read extended attributes, etc. 
Most of these are not generally used or altered from the norm, but far be it 
from me to assume anything about your environment. 

Bob


On Sep 24, 2012, at 2:47 PM, Magicgate Software - Skip Kimpel wrote:

> Are there permission limitations to see if a file exists within a
> Windows system directory (c:\windows\system32\myfile.dll)?
> 
> For some reason I am not getting results returned and my code is being 
> ignored.
> 
> Thanks!
> 
> ___
> 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


Checking if file exists in a Windows system directory

2012-09-24 Thread Magicgate Software - Skip Kimpel
Are there permission limitations to see if a file exists within a
Windows system directory (c:\windows\system32\myfile.dll)?

For some reason I am not getting results returned and my code is being ignored.

Thanks!

___
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