• 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: How do I set an icon to a folder from Clipboard or png file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I set an icon to a folder from Clipboard or png file


  • Subject: Re: How do I set an icon to a folder from Clipboard or png file
  • From: KOENIG Yvan <email@hidden>
  • Date: Sun, 13 Apr 2008 15:39:20 +0200


Le 13 avr. 2008 à 14:17, Emile SCHWARZ a écrit :
Hi all,

at the end of a process (started with a home made application) that set file locations in the front window, I have to set an icon to that window.

at this moment, I have the icon as a 128 x 128 image in the Clipboard _AND_ as a png file (in the front window).

'till now, I set manually the icon (usually after a script that set the front window item locations; place the items on pre-determined locations in the window, set the background window image, etc.).

when you have to do that dozen of times, it start to be a bit boring and so I was wondering if it is possible - using AppleScript - to set the front window icon programatically FROM the clipboard or a png image file.

I know it is possible to do it using an icon family (if I read correctly the dictionary), but from an image...

Anyone, any help ?

TIA,

Emile

Salut Emile

Il me semble que je t'ai déjà envoyé le script joint qui répond à ton problème.

--[SCRIPT colle_icone]

property cApplication : missing value

to copyPaste(cv)
tell application "Finder"
activate
tell application "System Events"
tell process "Finder"
tell window 1
keystroke tab -- select icon button
keystroke (cv & "w") using command down -- (copy or paste) + close window
end tell -- window 1
end tell -- process Finder
end tell
end tell -- application System Events

end copyPaste


to CopyFinderIcon(sel)
	tell application "Finder"
		activate
		copy sel's item 1 to s
		open information window of (s as alias)
		my copyPaste("c")
	end tell -- Finder
end CopyFinderIcon

to PasteFinderIcon(sel)
	tell application "Finder"
		activate
		repeat with s in sel -- changed
			open information window of (s as alias) -- changed
			my copyPaste("v")
		end repeat
	end tell -- Finder
end PasteFinderIcon

on open (sel)

	-- copy current application to cApplication

	-- Comment and Uncomment these lines to test both functions.

	--CopyFinderIcon(sel)
	PasteFinderIcon(sel)

	-- ---------------------------------------------------------

	--tell application (name of cApplication) to activate

end open

--[/SCRIPT]

En fait il permet de faire plus mais tel quel certaines routines ne sont pas utilisées.
Ici, seule PasteFinderIcon est employée.


I apologize to other readers but I know Emile for years and don't resist to speak French with him ;-)

Yvan KOENIG (from FRANCE dimanche 13 avril 2008 15:39:10) _______________________________________________
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: 
 >How do I set an icon to a folder from Clipboard or png file (From: Emile SCHWARZ <email@hidden>)

  • Prev by Date: How do I set an icon to a folder from Clipboard or png file
  • Next by Date: read file subroutine fails every second time
  • Previous by thread: How do I set an icon to a folder from Clipboard or png file
  • Next by thread: read file subroutine fails every second time
  • Index(es):
    • Date
    • Thread