Jump to content

Press Enter after invoking Applescript

Recommended Posts

I've modified the following script in DTPO and as written, I select files in DTPO, run the Alfred Keyword to Applescript workflow I made using the following code.  It then auto fills a pop-up box with "archive-", but I still have to press Enter.


Is there a way to press "enter" using Alfred so it's a simple invoke Alfred, type my keyword (using the default text I've added to the script) and have the files all rename with no more user interaction? 

-- Add Prefix To Names
-- Created by Christian Grunenberg Sat May 15 2004.
-- Copyright (c) 2004-2009. All rights reserved.
-- Based on (c) 2001 Apple, Inc.

tell application id "com.devon-technologies.thinkpro2"
		set this_selection to the selection
		if this_selection is {} then error "Please select some contents."
			set prefix to display name editor "Add Prefix" info "Prefix:" default answer "archive-"
			if prefix is not "" then exit repeat
		end repeat
		repeat with this_item in this_selection
			set current_name to the name of this_item
			set new_item_name to prefix & current_name
			set the name of this_item to new_item_name
		end repeat
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell
Edited by harringg
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...