Regxr is a minimal and lightweight MacOS desktop application that allows for easy checking of regular expression pattern matching. + Syntax highlighting. + Dark and light modes. + Minimal and simple to use. + Live preview of multiple pattern matches. + Full screen support.
41 36 likes 48,972 views Last modified Oct 24, 2017 12:39 AM
In iPhoto the filenames have been as used as default titles and shown below the thumbnails in the browser. Photos does not show the filenames as titles, and if a photo has no title, there is no identification visible in the browser, only in the Info panel.
To batch change the titles of photos without title, to make them visible below the thumbnails, you could try an Automator script I wrote to bring the titles back:
Note: If you are using iCloud Photo Library scroll down to 'Version2' - the Apple Script version. The Automator script version does not work well with iCloud Photo Library on Yosemite or El Capitan.
Create an Automator action, that executes an Apple Script to change the titles to the filename, if the title is empty:
The Apple Script:
onrun {input, parameters}
tellapplication 'Photos'
activate
set imageSel to (get selection)
if imageSel is {} then
error 'Please select an image.'
else
repeatwith im in imageSel
set title tothe name of im
ifnot (exists (title)) then
set the name of im tothe filename of im
endif
endrepeat
endtell
endrun
Launch Automator, create a new service, and drag a 'Run Apple Script' action into the workflow.
Copy and paste the text above into the 'Run Apple Script' action to replace the default text in the action.
Save this workflow with a suitable name. It will be installed in the services.
After the Automator action completed:
I put a version of the Automator workflow here in my Dropbox:
My script will just give you the general idea how to access filename and title in an Apple Script. For a more elaborate AppleScript, with more error checks and removing the filename extension, check out the script that NicFletcher posted:
For a discussion on how to improve this script, see: Re: Re: Where are photo file names?
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------
Version 2: To be used with iCloud Photo Library
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------
This version of the script is to be run directly from the Script Editor. The photos are not passed by selecting them in Photos but by collecting them in a top level album with the fixed name 'PhotoDropBox'. All photos in this album will get their titles changed, when you press the run button in Script Editor.
-- batch change the title of images to the filename
(* How to use this script:
Open this script in Script Editor. Launch Photos.
The photos can be passed to the script in two ways:
1. Either select photos while viewing the 'All Photos' album; this works better than Moments or smart albums
2. Or collect the Photos in a top level defined album with a fixed name.
If you want to select the photos without collecting them in an album, set the variable 'ReadFromAlbum' to false
If you want to pass the photos in a toplevel album, set ReadFromAlbum to true and change the variable 'theAlbumName' to the name of the album you are using.
When all photos are selected or in the album and all parameters set, press the 'Run' button in Script Editor.
*)
setReadFromAlbumtotrue
-- set this to true, if you want to pass the photos in a toplevel album
settheAlbumNameto 'PhotoDropBox' -- change this to the name of the album you will use
setimageSelto {}
tellapplication 'Photos'
activate
if (ReadFromAlbum) then-- the photos will be passed in a toplevel album named 'PhotoDropBox'
try
ifexistscontainertheAlbumNamethen
Regex For Mac
setthePhotosBuffertocontainertheAlbumName
setimageSeltoeverymedia itemofthePhotosBuffer
else
error 'Album ' & theAlbumName & 'does not exist'
endif
onerrorerrTexttwonumbererrNumtwo
display dialog 'Cannot open album: ' & errNumtwo & return & errTexttwo
endtry
Regex App For Mac Windows 10
else-- process the selected photos from the All Photos album
try
setimageSelto (getselection)
onerrorerrTexttwonumbererrNumtwo
display dialog 'Cannot get the selection: ' & errNumtwo & return & errTexttwo
endtry
endif
-- check, if the album or the selected photos do contain images
ifimageSelis {} then
error 'Please select some images.'
else
repeatwithiminimageSel
try
tellim
setitsnametoitsfilename
endtell
onerrorerrTextnumbererrNum
display dialog 'Error: ' & errNum & return & errText & 'Trying again'
try
delay 2
tellim
setitsnametoitsfilename
endtell
onerrorerrTexttwonumbererrNumtwo
display dialog 'Skipping image due to repeated error: ' & errNumtwo & return & errTexttwo
endtry
endtry
Regex App For Mac Shortcut
endrepeat
![]()
endif
endtell Simple chord mac app.
-- display dialog 'Done'
return 'Done'
Let your Mac do repetitive tasks for you
If you need to make the same changes to multiple files—such as changing filenames or resizing images—or archive or back up important files, you can create a custom workflow and have your Mac do the work for you.
Regex App For Mac DownloadScript your own actions
If the task you need to automate isn’t in the list of built-in actions, you can add your own scripts, such as AppleScript and JavaScript scripts, and shell commands to your workflow. Simply add the appropriate run script action to your workflow and enter your script code or shell commands.
To browse the Automator User Guide, click Table of Contents at the top of the page.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |