• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: need some help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >need some help (From: louie <email@hidden>)

  • Prev by Date: need some help
  • Next by Date: Re: need some help
  • Previous by thread: need some help
  • Next by thread: Re: need some help
  • Index(es):
    • Date
    • Thread