I’ve released a couple of upgrades. FileManagerLib 2.3.2 now has commands for dealing with date properties, while RegexAndStuffLib 1.0.6 accepts lists of strings for its regex change and regex batch commands.
I’m considering it. The issue is that it has to be calculated for anything other than flat files, which makes it potentially a bit slow. I suppose I could use the Finder approach with big items, and just make up a number .
I cant get a simple copy command to run get an error saying the file doesnt exist.
use theLib : script "FileManagerLib" version "2.3.2"
set rawFile to "~/Pictures/66/Capture/60161665_1/60161665_1-0002.CR2"
--added for testing only
set theFileOb to (parse object rawFile)
set rawPath to parent_folder_path of theFileOb & "/" & full_name of theFileOb as string
set destFolder to "/Users/riallen/Pictures/66/Capture/"
set articleNumber to "theNewName"
set theCopyCR2 to copy object rawPath new name (articleNumber & "-0000.CR2") as string to folder (quoted form of destFolder) as string
I can parse the object but cant copy the object using the rawPath or rawFile variables?
When I do a paste tell on the ``regex searchcommand in the regexAndStuffLib the last item is using sentinal boolean```
Don’t know what that is, but I don’t see it anywhere in the dictionary and it doesn’t come up in a search and I did a paste tell on a bunch of other commands and it’s not there.
set result_Text_List to regex search text ¬
search pattern text ¬
match case boolean ¬
dot matches all boolean ¬
anchors match lines boolean ¬
Unicode boundaries boolean ¬
replace template text ¬
capture groups Number_List ¬
using sentinal boolean
From the dictionary:
FUNCTION SYNTAX
set theResult to regex search text ¬
search pattern text ¬
match case boolean ¬
dot matches all boolean ¬
anchors match lines boolean ¬
Unicode boundaries boolean ¬
replace template text ¬
capture groups integer or list of integer
You can read the description in the library’s code. In the end, I decided there’s so little point in not using it, I cut it from the documentation. Unfortunately there’s no way to remove it from a paste tell, short of removing it.
If you’re after RegEx examples, the Web is really your oyster. There are different flavors, which can complicate things a bit, but there are zillions of examples out there.
I see regular expressions as a Swiss army knife with 10,000 blades when all I need is a pen knife to do one or two things. So when ever I look for a way to do simple things that require something like RegEx (like returning every paragraph from text with containing x and y) it seems like there’s an enormously complicated bit programming I need to learn.
I was hoping I could use regexandstufflib to just learn what I need, and sample scripts would go a long way.
This brings to mind a statement made years ago by Jamie Zawinski, a programmer best known for his role in the creation of Netscape Navigator and other major software projects. He said:
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.”