Almost got it right 🙂 Two small issues.
The first is a 'Yate'ism. You have to remember that unless told otherwise a Yate action executes stepwise. That means that each statement is executed in parallel for each selected file. The 'Compare Text Test' statement only returns true if the associated test is "true for all files". You really want the entire action to run completely on a per file basis. (This might result in more than one prompt). As you want to execute all statements as a single unit for each selected file, you need a Force Grouped statement.
The second issue is the order of the Set and Or options on the tests. The first 3 Test statements are ignored because the 4th Sets the result overwriting whatever came before. The first Test should be a Set so that it overwrites the previous action test state value, The following 3 should Or in the result because you want to "or with what came before".
Also, the UI option on the Prompt statement is meaningless as it is only examined when Batch Processing. (It is harmless though).
Try:
Force Grouped Execution
Trim the Title field (SP) [Leading] [Trailing]
Test if the Title field ends with ")" (Set result)
Test if the Title field ends with "]" (Or result)
Test if the Title field ends with "!" (Or result)
Test if the Title field ends with "?" (Or result)
if false
Trim the Title field (Non A#) [Trailing]
else
Prompt Character found!
endif
Only a few tweaks to get it to work. Good start 🙂
Here's a variant which accumulates the "Character found" prompts and issues it only once.
Set named variable 'matches' to ""
Comment The following Run forces the Grouped requirement
Run inline action 'Test a single file' grouped
Test if named variable 'matches' is not empty (Set result)
if true
Prompt Character found in:\n\n\<matches>
endif
Start Test a single file
Trim the Title field (SP) [Leading] [Trailing]
Test if the Title field ends with ")" (Set result)
Test if the Title field ends with "]" (Or result)
Test if the Title field ends with "!" (Or result)
Test if the Title field ends with "?" (Or result)
if false
Trim the Title field (Non A#) [Trailing]
else
Get Property File Name (with extension) -> Variable 1
Set named variable 'matches' to "\<matches>\n\v1"
endif
One other little hint. Remember that an action only operates on those files that are selected. If you want an action to automatically select all open (non hidden) files, give it the All Files property in the Action Manager.
|