• 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: Script Editor bug - any workaround?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script Editor bug - any workaround?


  • Subject: Re: Script Editor bug - any workaround?
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 01 Feb 2016 16:21:09 +0100


Le 2016/02/01 à 16:04, Phil Stokes <email@hidden> a écrit :

On 1 Feb 2016, at 21:55, Yvan KOENIG <email@hidden> wrote:

On my side I keep a clean copy of the preferences files and every morning when I switch my mac on a script copy the clean copy in the Preferences folder. This way I never see spurious prefs change.



Hmm, right. I just came across this from red_menace on ASC:

https://discussions.apple.com/thread/7155960?start=0&tstart=0

Is that more or less what you’re doing, then?


No, it's not what I do.

In the referenced thread the author use default write to write a value in a preferences file.
On my side I replace the entire file by a clean copy.

#(SCRIPT keep_clean_prefs.app]
(*
To keep clean preferences files.
In your userAccount's Preferences folder,
create a subfolder named "safe_Prefs"

Store in this folder clean duplicates of the preferences files subject to corruption.
Save this script as an Application Bundle where you want.
Why not in your Applications folder?

Open the System Preferences Pane "Account"
Click on the "Login" tab.
Drag and drop the script's icon onto the window to add it to the list of login items.
On every boot process, the script will be run so it will install the clean prefs.
Of course, if you change something to the prefs and know that the file is clean,
duplicate the new version to the safe_prefs folder.

Yvan KOENIG 
2008/05/26
2012/10/14 rebuilt
*)
on run
run mon_script
end run

script mon_script


set p2prefs to path to preferences from user domain as text
set p2Safe to p2prefs & "safe_Prefs:"
--if p2Safe does not end with ":" then set p2Safe to p2Safe & ":"
set prefNames to {"com.apple.applescript.plist"}
tell application "System Events"
repeat with aName in prefNames
try
delete disk item (p2prefs & aName)
end try
end repeat
exists folder p2Safe
end tell
if result then
try
do shell script "cp -R " & (quoted form of POSIX path of p2Safe) & space & quoted form of POSIX path of p2prefs
end try
end if # result
end script
#[/SCRIPT]

My scheme works as AppleScript Editor is not already loaded when the script is triggered.
So, when the editor will be called, it will load the newly installed preferences file.

Yvan KOENIG (VALLAURIS, France) lundi 1 février 2016 16:19:04



 _______________________________________________
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

  • Follow-Ups:
    • Re: Script Editor bug - any workaround?
      • From: Phil Stokes <email@hidden>
References: 
 >Script Editor bug - any workaround? (From: Phil Stokes <email@hidden>)
 >Re: Script Editor bug - any workaround? (From: Phil Stokes <email@hidden>)

  • Prev by Date: Re: Script Editor bug - any workaround?
  • Next by Date: Re: Script Editor bug - any workaround?
  • Previous by thread: Re: Script Editor bug - any workaround?
  • Next by thread: Re: Script Editor bug - any workaround?
  • Index(es):
    • Date
    • Thread