Re: need some help
Re: need some help
- Subject: Re: need some help
- From: Axel Luttgens <email@hidden>
- Date: Sat, 19 Feb 2011 09:52:25 +0100
Le 19 févr. 2011 à 06:59, louie a écrit :
> Hi all,
> Could you fix the below to not use shell script?
> Thank you for any help.
>
> set onOff to do shell script "cat ~/.recording"
> if onOff is "on" then
> do shell script "echo \"off\" > ~/.recording"
> else
> do shell script "echo \"on\" > ~/.recording"
> end if
> say onOff
> louie
Hello Louie,
Here is an attempt to mimic as close as possible above code with the help of Standard Additions' file Read/Write commands:
set fRef to open for access file ((path to home folder as text) & "testtest") with write permission
try
set onOff to read fRef
on error
set onOff to ""
end try
set eof fRef to 0
if onOff is "on" then
write "off" to fRef
else
write "on" to fRef
end if
close access fRef
say onOff
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden