Custom Desktop Folders

Scott Morrow scott at elementarysoftware.com
Thu Apr 16 02:20:45 EDT 2015


Hello Ray,
I believe I had success setting custom folder icons from LiveCode using the Xcode tool SetFile. I can’t remember who pointed me at it… probably Ken Ray. In order for this to work I needed to store the SetFile tool in a customProp of my app and temporarily write it to the user’s drive.  (There may be a legal issue here. In this particular case, I covered my ears while singing “La, la, la”) It has been several years since I last used this but seem to recall that it worked.
--
Scott Morrow

Elementary Software
(Now with 20% less chalk dust!)
web       http://elementarysoftware.com/
email     scott at elementarysoftware.com
office     1-800-615-0867


—| -------------------------------------------------------------
—| set the custom icon bit in the Finder info flags
—| this will tell the Finder to use the custom "icon\r" file to display a custom folder icon 
—| install the Developer Tools and look inside the /Developer/Tools/ directory for a CLI program called SetFile.
—| This sets file bits. Specifically, you want to take note of the -a option to set attributes. 
—| Run the program without arguments and it will show you a table of things to set. 
—| We're looking for the C attribute in upper case because we want to set it on.
—| To turn it off, you use lower case.
—| then run this:   tPathToSetFile -a C tFolderPath
—| in order to run the Command Line Tool "SetFile" from the shell() we will need to install it temporarily
—| suck it up and store it in the customProp —> the uSetFileDevTool  of stack "MyCoolStack"
-->   --  /Developer/usr/bin/SetFile -a C /Applications/My\ App\ Name
—| -------------------------------------------------------------
on FolderIconFlag tFolderPath
   -- determine if the SetFile command line tool has already been installed to a temp folder
  put specialfolderpath(temporary) &"/SetFile" into tSetFilePath  -- build the path of a temp location to install into
  if not (the uSetFileIsInstalled of stack “MyCoolStack") then
    -- install SetFile app
    put (decompress(the uSetFileDevTool of stack "MyCoolStack")) into URL ("binfile:" & tSetFilePath)
    put the result into tResult
    if tResult is not empty then
      get log("ERROR:" &CR& "Attempt to write out the Command Line Tool SetFile resulted in: "&& tResult)
      exit FolderIconFlag -- we failed
    end if
    put "755" into tPermission
    Chmod tSetFilePath, tPermission
    -- announce that the SetFile is installed
    set the uSetFileIsInstalled of stack "MyCoolStack" to "true"
  end if
 
  -- escape some special characters
  put fixPath(tSetFilePath) into tSetFilePath
  put fixPath(tFolderPath) into tFolderPath
  
  -- set the custom folder icon flag
  get shell(tSetFilePath && "-a C"&& tFolderPath)
end FolderIconFlag


function fixPath pPath
   put "\" & space & quote & "'`<>!;()[]?#$^&*=" into tSpecialChars
   repeat for each char tChar in tSpecialChars
      replace tChar with ("\" & tChar) in pPath
   end repeat
   return pPath
end fixPath


> On Apr 15, 2015, at 2:30 PM, Ray <ray at linkit.com> wrote:
> 
> Does anybody know of a way, from within Livecode, to create a folder and give it it's own custom display on the desktop?  I'd imagine this would be done with an .ico file.  I'd like to do this for both Mac and Windows.
> 
> I've looked through the RunRev store and haven't found any extensions which do this.  Maybe through a command-line somebody has written?
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode











More information about the use-livecode mailing list