Watch downloads folder for PDF's and open with preview

Dear Chris,
Probably, I think that "Open Downloaded PDFs in Preview.kmmacros" is a macro created by you, so I will post from here.

I rewrote your macros a bit and made it possible to preview from "skim".
I specified the location of the file as "tutor UltraEdit_foler / master" Folder, which you recently gotten to consult.
When the number of files was small (content-1.tex to content-3.tex), there was not much problem, but as content-7.tex increased, 8 "pdf" created after LaTeX compilation was 8 , All will be displayed from "Skim".
What kind of writing should be done to ensure that PDFs from "content diverted" tex from content-1 to content-7 are not spit out?
How should only "main.pdf" (made from "main.tex") be displayed from skim?
Is there a way to specify the name?
I would be pleased if you teach me that way.

Thx and regards, WAKAMATSU (boehmflute)

Hey @boehmflute,

It sounds to me as if you're creating a batch of files at once to this watched folder.

If so I suspect you can do something like this:

image

-Chris

Dear Chris,
Thank you for your advice.
I have rewritten the point of your comment.
Thanks again, I was able to display only a specific "master.pdf".
By the way,I was not creating a batch of files at once to this watched folder.
Just I have changed Folder's path and Previewer app's from your original "Open Downloaded PDFs in Preview"macros.
Thx and regards, WAKAMATSU (boehmflute)
Open%20Downloaded%20PDFs

1 Like

This is awesome.

But I keep getting this path error

image

I double checked both of these:
/Users/macuser/Downloads/
~Downloads/

So %TriggerValue% is not working on my side somehow?

This macro/technique is in error.
==The %TriggerValue% returns the FULL PATH== to the item that was added to the folder.

So, it should be:

image

Most likely you are making the same error.
Just set the Open File to %TriggerValue%

1 Like

This macro should correct problems due to changes in KM and otherwise.
I'm not sure when the change occurred, but as of Keyboard Maestro 8.2.4, the ==%TriggerValue% returns the FULL PATH== to the item that was added to the folder.

Also, I have changed the original macro which open using default app to open explicitly using Preview.app, and only for files ending with (as opposed to contains) ".pdf"


MACRO:   Open Downloaded PDFs in Preview


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/f/6/f6049ef1c40c316c64e0aced22e88a91b6d50000.kmmacros">Open Downloaded PDFs in Preview.kmmacros</a> (2.7 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|480x666](upload://o3vLhId6M0l8VoeZKfGsKPYHgbV.png)

Just curious...

Is there a reason you don't want to use a simple folder action to achieve this?
folderAct

Because I prefer to use KM, which is also simple.

But is there a way to extract just a filename from %TriggerValue% now when it returns the full path?

Easy - just use the Filter Action to get the file name component of the path. Check out the KM wiki here.

1 Like

You may also find these Actions useful:

1 Like

Yep, Get File Attribute Action is exactly what I needed.
Thank you!

2 Likes