Re: Creating 'read only' text files

2023-05-02 Thread doc hawk via use-livecode
And just to avoid the brainfreeeze that I’d probably absentmindedly implement:

You have to create the file and do all of your writing, and then *change* the 
file to read only . . .

Uihm, err, i never really make mistakes like that, or applying bus voltage to a 
whole bank of toggle switches, or . . .



___
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: Creating 'read only' text files

2023-05-02 Thread David Glasgow via use-livecode
Perfect.  Thanks, Paul.

> On 30 Apr 2023, at 1:43 pm, Paul Dupuis via use-livecode 
>  wrote:
> 
> I don't know of a Livecode syntax per se to do this (i.e some syntax like: 
> set the permissions of file tFile to read-only)
> 
> You can do this in Livecode using the shell() function (see the dictionary) 
> to issue applicable mac or win command lines. For eample a Google search 
> shows the command line to change a file's permissions on Windows is:
> 
> attrib +r file.txt
> 
> so you could code something like (not tested):
> 
> switch platform()
>   case "Win32"
> set the hideConsoleWindows to true -- prevents windows console window 
> from appears when the shell command executes
>put "attrib +r " & quote & tFile & quote into tCommand -- were tFile is 
> the file (path and name with native \ delimiters) you want to make read-only
>put shell(tCommand) into tResult
>break
>   case "MacOS"
> -- use chmod 744 apple.txt for you to have full access and everyone else 
> read-only OR
> -- use chmod 444 apple.txt for everyone, you included, to be read-only
>put "chmod 444 " & quote & tFile & quote into tCommand -- were tFile is 
> the file (path and name) you want to make read-only
>put shell(tCommand) into tResult
>break
> end switch
> 
> This code may need some tweaking but I think this is the general approach to 
> do what you want.
> 
> On 4/30/2023 7:35 AM, David V Glasgow via use-livecode wrote:
>> Hi folks,
>> 
>> Really simple question that I can’t see having been asked before, so here 
>> goes…
>> 
>> I have a stack that outputs small text files.  Each includes a hash value 
>> referencing part of itself that can be checked subsequently, so any change 
>> to the text can be flagged.
>> 
>> Is there a way I can easily create read-only files (Mac & Win) to discourage 
>> accidental user changes?  No need for encryption or hiding information 
>> anywhere, I just want to deter casual oopsies.
>> 
>> Thanks in anticipation...
>> 
>> Best Wishes,
>> 
>> David Glasgow
>> Honorary Professor, Nottingham Trent University
>> Sexual Offences, Crime and Misconduct Research Unit
>> Consultant Forensic & Clinical Psychologist
>> Carlton Glasgow Partnership
>> Director, Child & Family Training, York
>> 
>> 
>> LinkedIn > >
>> ___
>> 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: Creating 'read only' text files

2023-04-30 Thread Paul Dupuis via use-livecode
I don't know of a Livecode syntax per se to do this (i.e some syntax 
like: set the permissions of file tFile to read-only)


You can do this in Livecode using the shell() function (see the 
dictionary) to issue applicable mac or win command lines. For eample a 
Google search shows the command line to change a file's permissions on 
Windows is:


attrib +r file.txt

so you could code something like (not tested):

switch platform()
  case "Win32"
    set the hideConsoleWindows to true -- prevents windows console 
window from appears when the shell command executes
   put "attrib +r " & quote & tFile & quote into tCommand -- were tFile 
is the file (path and name with native \ delimiters) you want to make 
read-only

   put shell(tCommand) into tResult
   break
  case "MacOS"
    -- use chmod 744 apple.txt for you to have full access and everyone 
else read-only OR

    -- use chmod 444 apple.txt for everyone, you included, to be read-only
   put "chmod 444 " & quote & tFile & quote into tCommand -- were tFile 
is the file (path and name) you want to make read-only

   put shell(tCommand) into tResult
   break
end switch

This code may need some tweaking but I think this is the general 
approach to do what you want.


On 4/30/2023 7:35 AM, David V Glasgow via use-livecode wrote:

Hi folks,

Really simple question that I can’t see having been asked before, so here goes…

I have a stack that outputs small text files.  Each includes a hash value 
referencing part of itself that can be checked subsequently, so any change to 
the text can be flagged.

Is there a way I can easily create read-only files (Mac & Win) to discourage 
accidental user changes?  No need for encryption or hiding information anywhere, I 
just want to deter casual oopsies.

Thanks in anticipation...

Best Wishes,

David Glasgow
Honorary Professor, Nottingham Trent University
Sexual Offences, Crime and Misconduct Research Unit
Consultant Forensic & Clinical Psychologist
Carlton Glasgow Partnership
Director, Child & Family Training, York


LinkedIn 
___
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


Creating 'read only' text files

2023-04-30 Thread David V Glasgow via use-livecode
Hi folks,

Really simple question that I can’t see having been asked before, so here goes…

I have a stack that outputs small text files.  Each includes a hash value 
referencing part of itself that can be checked subsequently, so any change to 
the text can be flagged.  

Is there a way I can easily create read-only files (Mac & Win) to discourage 
accidental user changes?  No need for encryption or hiding information 
anywhere, I just want to deter casual oopsies.

Thanks in anticipation...

Best Wishes,

David Glasgow
Honorary Professor, Nottingham Trent University
Sexual Offences, Crime and Misconduct Research Unit
Consultant Forensic & Clinical Psychologist
Carlton Glasgow Partnership
Director, Child & Family Training, York


LinkedIn 
___
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