I'm a novice at coding so please be patient with me.
I've created a Workflow with Automator (OSX) which works fine. The only issue I have is that I want it to run on a number of inputs (that is as a batch). I've inserted the Loop action but the problem I'm having is about changing the initial input each time.
I would like to use an applescript to automate the insertion of the initial input each time.
I have a TXT file with URLs. With an apple script, I'd like to copy a URL (or a line of text) to clipboard. In the next iteration I'd like to copy the next URL (or line of text).
Can anyone help?
Thank you!!
You can create one looping workflow (called as LinesToClipboard.workflow) what will
The workflow:
Get Value of Variable
(LineNumber)Run Shell Script
/bin/bash
Pass input
to as arguments
/etc/passwd
to the full path of your filename, like /Users/myname/Documents/myfile.txt
linenum=${1:-0}
filename="/etc/passwd" # full path of your text-filename
let linenum++
sed -n "${linenum}p" < "$filename" | pbcopy
echo $linenum
Set Value of Variable
(LineNumber)Run Workflow
- add your current workflow (or the "ShowClipboard.workflow" - see bellow)
Wait for workflow to finish
should be checkedLoop
Run Shell Script
(Ignore this action's input), content one line: echo 0
(This will reset the variable LineNumber to zero, when the loop ends)Set Value of Variable
(LineNumber)For testing, you can create another workflow, called ShowClipboard.workflow, with an content:
Get Contents of Cliboard
Set Value of Variable
(clipval)Ask for confirmation
(and drag the (clipval)
to the Message field)Run the first workflow.
Screenshots (for sure) :)
The second workflow (for testing)