![]() Typical output will look something like this. This is what I've been using to generate the csv file that I open and manipulate in TextWrangler via AppleScript. The terminal code I've been running, that generates this list/document looks like this:Įxiftool -csv -r -ext. But I didn't want too much time to pass before coming back to update you with my progress (and a few changes.)įor the sake of thoroughness I'll outline the entire process as it stands now. Sorry it's taken a while to return to this thread. Last edited by kevincbrock ( 03:41:36 pm) Replace " " using "" searching in text 1 of active document of text window 1 options s_options Replace "," using "," searching in text 1 of active document of text window 1 options s_options Replace "\\r" using "," searching in text 1 of active document of text window 1 options s_options Replace "\"" using "" searching in text 1 of active document of text window 1 options s_options Replace ".CR3" using "" searching in text 1 of active document of text window 1 options s_options Replace ".psd" using "" searching in text 1 of active document of text window 1 options s_options Replace ", Layer 1" using "" searching in text 1 of active document of text window 1 options s_options Replace "Background, Background copy" using "" searching in text 1 of active document of text window 1 options s_options Replace "******" using "" searching in text 1 of active document of text window 1 options s_options Replace "SourceFile,LayerNames" using "" searching in text 1 of active document of text window 1 options s_options (There are folder paths, specific to my system, that I've "redacted" here.) This one gets around the problem with the missing commas at the ends of some lines by doing my trick: "replace line breaks with comma' then "replace, with ," but if this is going to be my solution I would still like to remove that initial character, a comma, from the resulting string. I should probably add a snippet of my AppleScript so far. I suppose it's either: how to insert a comma at the end of lines without one? Or.how do I remove the very first character of a line in TextWrangler, using AppleScript / grep syntax? This workaround changes the subject line of my post. ![]() I realize I need to insert \ to get grep commands to work in AppleScript but evidently I can't get the correct syntax in AppleScript to remove that very first character, a comma. replacing with nothing.īut.I can't get that same grep command to run in AppleScript. In TextWrangler I can remove that comma with a search for ^. However, even if this last little "trick" works I'm still left with a single comma at the very beginning of the string. Then I end up with several sets of double commas, but one more search for, replacing with, fixes that. I can do a find/replace for all line breaks, replacing the breaks with commas. ![]() I should add that I already have a "workaround" that may be satisfactory. So my original goal was to simply add commas to the end of any lines that don't have one then removing the line breaks. those three long lines do not have commas at the end and ultimately everything needs to be comma separated. But for the few lines that do not end with commas, how can I do a replacement that is essentially: "for any lines that do not end with a comma - insert a comma"?Īs an example, let's say I'm left with a text doc that looks like this:ĮE8A8457,EE8A8466,EE8A8464,EE8A8462,EE8A8459,EE8A8457ĮE8A8842,EE8A8861,EE8A8859,EE8A8857,EE8A8855,EE8A8852,EE8A8850,EE8A8848,EE8A8842 Most of those lines have commas as the end, which I want to keep. In that regard this is really more of a TextWrangler, grep question than it is an AppleScript question, but I know this a solid pool of knowledge and someone here problems knows this answer.Ĭurrently, when I run my AppleScript I'm left with multiple lines of filenames. So far I have been running multiple find/replace searches in TextWrangler to clean up the text for my needs then I found out that I could consolidate several individual searches into a single AppleScript and be done with one click. The data that is returned gets dumped into a text document on my Desktop but I need to process this text a little further so that eventually I can paste a simple string of filenames, separated by commas, into Lightroom when I perform a search for filenames. I'm running an exiftool command in Terminal to generate a list of photoshop files with all their respective layer names. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |