Using QuickKeys and AppleScript, I would like to script a way to find a “:” in a text field, then delete it as well as any text that follows. I already have my QuickKey setup…i just need to figure out the AppleScript.
You don’t say where the text is coming from but this is a good job for text item delimiters:
set x to "Test:This" set OldDelim to AppleScript's text item delimiters set AppleScript's text item delimiters to ":" set y to text item 1 of x set AppleScript's text item delimiters to OldDelim return y
Of course this is a proof of concept to show how to get everything up to the first “:”, the actual working of the final script would depend on where the text is coming from and what you need to do with it.