Help needed with tweaking Curt Clifton's "Populate" script

[I didn’t realize this AppleScript forum existed, and originally posted this question elsewhere. Sorry!]

I’ve used Curt Clifton’s Populate Template Placeholders in OF1 for many years. Back in the day, I tweaked it so that the populated project appeared in the same folder as the template, and there was no need to move it into place, as it is already in place.

I just switched to OF2, and my old script no longer works. I downloaded Curt’s update, but my scripting abilities are so lame that I cannot figure out how to repeat my feat on the new version of Curt’s script.

Is anyone interested in helping me figure this out? It does make the script vastly more convenient.

Thanks in advance.

Never mind! I went to the old forum and found the post where I explained the trick I used. Here it is: replace the existing “set duplicatedItem” with this:

set duplicatedItem to selectedItem

And it does seem to work.

Alas, it didn’t work… The populated project is indeed in place, but the original is kicked out to top level! Darn.

If I can sort this out, I’ll be back, but if anyone knows how to do what I want, please let me know! I’d like both original and duplicate to stay put.

I found an even better (In my opinion) script. More power user features.

Check this out.

1 Like

Worth a try! Thanks.

1 Like

OK, I figured out a way to use Curt Clifton’s “Populate Template Placeholders” so that the populated duplicate appears in the same folder as the template. The advantage is that templates can reside where they belong, and duplicates don’t have to be moved.

Here’s how you do it:

	duplicate (selectedItem) to after selectedItem
	set duplicatedItem to selectedItem
	-- above lines replace Curt Clifton's original, which was:
	-- 	duplicate (selectedItem) to after last section
	-- 	set duplicatedItem to last section

Whew. I know so little about AppleScript that it took a while to sort this out, but it does seem to work.

And here are some other tweaks to that script that you may find helpful:

After:

	set note of duplicatedItem to theNote

you can use:

	set next review date of duplicatedItem to (current date) + (1 * days) 
	set reviewInterval to {fixed:true, unit:week, steps:3} 
	set review interval of duplicatedItem to reviewInterval 
	set status of duplicatedItem to active

to review the new project the next day and every three weeks, and to make the new project active.