Hello,
I need some help automating a task and I'm half way through. I am using file associations with docx;pdf to automate the following:
1. Have an original docx file that I duplicate and edit
2. Print the docx file to pdf
3. Rename the edited and pdf files to a number (doesn't matter)
4. Move both files to .\Archive\*\<sometext>-*-<moretext>
5. Copy the file path of the pdf file to clipboard
Steps 1, 2 and 3 are manual and I want them to remain manual.
I've managed to do step 4 using file associations and ::rename but I have no idea how to do step 5 and searching for "file path" in the help files didn't help much.
Any help is appreciated.
Rename and copy file path via file associations?
Re: Rename and copy file path via file associations?
Your step nr. 04 contains the file path that you're moving the files to, correct?
Then just use the script command
to copy the path to the clipboard
Then just use the script command
Code: Select all
copytext <the variable that contains the path>;
One of my scripts helped you out? Please donate via Paypal
Re: Rename and copy file path via file associations?
I haven't set any variables, it's just a single line command. Do I need to do that?highend wrote:Your step nr. 04 contains the file path that you're moving the files to, correct?
Then just use the script commandto copy the path to the clipboardCode: Select all
copytext <the variable that contains the path>;
Also, how can I separate/specify just the pdf file when I execute the operation on both files simultaneously?
Re: Rename and copy file path via file associations?
Show the code you're using and give a real world example (real file & folder names)
One of my scripts helped you out? Please donate via Paypal
Re: Rename and copy file path via file associations?
I'm in folder C:\Dir, with an empty folder C:\Dir\Archive and a file C:\Dir\Template.docxhighend wrote:Show the code you're using and give a real world example (real file & folder names)
I manually duplicate the word file, rename to, let's say 123.docx, and export it as a pdf.
I now have three files in C:\Dir:
Code: Select all
C:\Dir\Template.docx
C:\Dir\123.docx
C:\Dir\123.pdf
Code: Select all
|"Archive" docx;pdf>::rename , '.\Archive\*\text-*'
Code: Select all
C:\Dir\Archive\123\text-123.docx
C:\Dir\Archive\123\text-123.pdf
Re: Rename and copy file path via file associations?
Ok, thanks
Try this as your new file association:
Try this as your new file association:
Code: Select all
|"Archive" docx;pdf>::$base = gpc(gettoken(<get SelectedItemsNames |>, 1, "|"), "base"); $dst = "<curpath>\Archive\$base\text-"; rename , "$dst*"; copytext "$dst$base.pdf";
One of my scripts helped you out? Please donate via Paypal
Re: Rename and copy file path via file associations?
Amazing, worked like a charm - thank you!highend wrote:Ok, thanks
Try this as your new file association:Code: Select all
|"Archive" docx;pdf>::$base = gpc(gettoken(<get SelectedItemsNames |>, 1, "|"), "base"); $dst = "<curpath>\Archive\$base\text-"; rename , "$dst*"; copytext "$dst$base.pdf";