• 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
problem to make file with System Events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem to make file with System Events


  • Subject: problem to make file with System Events
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 15 Oct 2010 18:29:57 +0200

Hello

I got an annoying behavior .

Under 10.4.11, I used a handler which behaved flawlessly.
Now, as my G5 died, I'm running 10.6.4 on my imac.

The handler fails.

Here it is :

--[SCRIPT]

my zipIt(("" & (path to desktop folder) & "azertyk.pages:") as alias)

--=====

on zipIt(fichier) (* fichier is an alias *)
local Nom, ext, dossier, nomZip, source, dest
tell application "System Events" to tell disk item (fichier as Unicode text)
set Nom to name
--> "azertyk.pages"
set ext to name extension
--> "pages"
set dossier to path of container
--> "Macintosh HD:Users:yvankoenig:Desktop:"
end tell
set Nom to text 1 thru -(2 + (count of ext)) of Nom
log Nom
set nomZip to Nom & (do shell script "date " & quote & "+_%Y%m%d-%H%M%S" & quote) & "." & ext & ".zip"
--> "azertyk_20101015-162446.pages.zip"
set source to quoted form of POSIX path of (fichier)
--> '/Users/yvankoenig/Desktop/azertyk.pages/'
set dest to dossier & nomZip
--> "Macintosh HD:Users:yvankoenig:Desktop:azertyk_20101015-162446.pages.zip"
tell application "System Events"
if exists disk item dest then delete disk item dest
(* worked under 10.4.11 bu fails under 10.6.4 *)
--make new file at end of folder dossier with properties {name:nomZip, kind:"ZIP archive"}
(* under 10.6.4, I tried this syntax but it faills too *)
--make new file at end of folder dossier with properties {name:nomZip, type identifier:"public.zip-archive"}
--> error "Erreur dans System Events : Le gestionnaire AppleEvent a échoué." number -10000
(* Happily, this one does the trick *)
make new file at end of folder dossier with properties {name:nomZip}
end tell

set dest to quoted form of POSIX path of dest
do shell script "ditto -ck " & source & " " & dest
end zipIt

--=====
--[/SCRIPT]

Happily, I may use the version which doesn't define the file kind. The system will behave flawlessly without it.
But I'm wondering why the instruction setting the type identifier fails with the "new" system.

I hope that some one here may bring some light.

Thanks in advance.

Yvan KOENIG (VALLAURIS, France) vendredi 15 octobre 2010 16:50:36





 _______________________________________________
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: problem to make file with System Events
      • From: Shane Stanley <email@hidden>
    • Re: problem to make file with System Events
      • From: Stan Cleveland <email@hidden>
  • Prev by Date: Re: script won't run on an older iMac.
  • Next by Date: Re: problem to make file with System Events
  • Previous by thread: Re: script won't run on an older iMac.
  • Next by thread: Re: problem to make file with System Events
  • Index(es):
    • Date
    • Thread