Jump to content

Help with requesting user input on File Action


Recommended Posts

Hello,

 

I am trying to create a File Action that takes user input. This is an action that takes the selected PDF file in finder and changes the page numbers of the file (e.g., the PDF is of an article that starts on page 36 and this action would make it so that the PDF file doesn't start on 1, but on 36). 

 

If I hard code in the page number, the action works great for me as a bash script:

 

python3 -m pagelabels --delete "$1"
python3 -m pagelabels --startpage 1 --firstpagenum 251 "$1"

 

However, I need to have a way to prompt for user input to add the page number (here, number 251). How can I add this?

(you might be wondering, why don't I turn this action into a python script instead of a bash script. The answer is, I have no python experience. I'm just using a thing I found on GitHub that I was able to get working on the command line.)

 

Here's the action itself: https://www.dropbox.com/scl/fi/hp8vohuqihme58ancud8e/PDF-Page-Numbers.alfredworkflow?rlkey=4drl8iffe06uciinr8zbqu68a&dl=0

 

edit: here's the link to the python command: https://github.com/lovasoa/pagelabels-py

Edited by derekvan
added link to python command
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...