Apply an action to all pages.
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Apply an action to all pages.
Is there a way to apply an action more times in a document? A sort of loop to spare the work to click the action for each page in the document. I inserted the command to jump to next page, but can't find how to recall the action.
-
- Mitglied
- Posts: 235
- Joined: Fri 19 Dec 2008 11:36
Re: Apply an action to all pages.
Hi,
You can assign a keyboard shortcut to an action, perhaps you can make a new action incorporating the action you want + 'next page'?
Then assign a keyboard shortcut to this new combined action and repeat this keyboard shortcut until you've reached the end of the document?
- Paul
You can assign a keyboard shortcut to an action, perhaps you can make a new action incorporating the action you want + 'next page'?
Then assign a keyboard shortcut to this new combined action and repeat this keyboard shortcut until you've reached the end of the document?
- Paul
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Re: Apply an action to all pages.
Assign a shortcut would be a nice help. But how can this be done?
-
- Betatester
- Posts: 3676
- Joined: Thu 26 Nov 2009 22:59
Re: Apply an action to all pages.
Go to Preferences -> Usage -> Keyboard Shortcuts
There's an entry "Actions" in the middle pane where you should find your action. (And remenber to press the "Assign" button, after picking a keyboard shortcut – I tend to forget the last step).
Cheers
Burkhard.
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Re: Apply an action to all pages.
Thanks, Shortcuts for Actions could be a great help. But now I have another trouble. All the job is to resize scanned PDF, that my Epson multifunction resizes (I guess to allow printing without cutting the border). PDF layout resolution is 300dpi in any case, but if I use scanner with 300dpi, the raster layer will have 309dpi (about 97%), if I use 200dpi, the raster layer will have 206dpi, if I use 600dpi, the raster layer will have 618dpi. Mostly this is not a problem, but sometime it is. So I need an action to resize layer inside PDF. I used adjust layer scale with formula, in the resolution field I put:
If (d≥600; 600; If (d≥300; 300; If (d≥200; 200; d)))
But Action doesn't work as aspected.
If (d≥600; 600; If (d≥300; 300; If (d≥200; 200; d)))
But Action doesn't work as aspected.
-
- Betatester
- Posts: 3676
- Joined: Thu 26 Nov 2009 22:59
Re: Apply an action to all pages.
'if' has to be lower case. Also, PL doesn't accept "≤" or "≥" (I can't get <= or >= to work, either, although they are documented, but as a workaround, you can negate the conditional and exchange the other arguments).
Cheers
Burkhard.
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Re: Apply an action to all pages.
OK, I simplified the formula in this way:
if (d>450; 600; if (d>250; 300; 200))
And the Action seems to work just fine. Thanks.
if (d>450; 600; if (d>250; 300; 200))
And the Action seems to work just fine. Thanks.
-
- Mitglied
- Posts: 417
- Joined: Sat 23 Apr 2016 17:03
Re: Apply an action to all pages.
My advice would be to use a specialized printing program such as QImage for printing. No second guessing and consistent printing results every time. Not all programs play nice with printers. It's often a case of who's in control.
regards
regards
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Re: Apply an action to all pages.
But a way to apply an action to all pages makes sense in any case. I just worked with a mess PDF with 250 pages, that sends my printer in error after printing some white pages (one white page every 20/30 sec.). The unique way to print it, was to rasterize and merge all layers on all pages. But even for this, my i7-12700KF with 64GB of ram and gen.4 SSD, take between 5 and 20 seconds for each page. If there was a way to apply the action to all pages, I could save much time and let the computer do the job.
-
- Entwickler
- Posts: 4234
- Joined: Tue 19 Nov 2002 15:49
Re: Apply an action to all pages.
You're on macOS, aren't you?borgo1971 wrote: ↑Thu 02 May 2024 18:50 But a way to apply an action to all pages makes sense in any case. I just worked with a mess PDF with 250 pages, that sends my printer in error after printing some white pages (one white page every 20/30 sec.). The unique way to print it, was to rasterize and merge all layers on all pages. But even for this, my i7-12700KF with 64GB of ram and gen.4 SSD, take between 5 and 20 seconds for each page. If there was a way to apply the action to all pages, I could save much time and let the computer do the job.
Then you coud use one of the attached scripts.
The first one asks for the name of an action and applies that action to every page afterwards:
Code: Select all
tell application "PhotoLine"
try
set doc to front document
on error
set doc to missing value
end try
# Is there a document?
if doc is not missing value then
#Ask the user for the action name that he wants to execute.
set actionName to input box title "Enter Action Name" description "Name:"
# Did the user enter a name?
if actionName is not "" then
# Execute the action with every page.
repeat with actPage in doc's pages
#Set a well-defined active layer, so that the action can work properly.
set active layer of actPage to first child of actPage's root
actPage do operation type "Action" with options {name:actionName}
end repeat
end if
end if
end tell
Code: Select all
tell application "PhotoLine"
try
set doc to front document
on error
set doc to missing value
end try
# Is there a document?
if doc is not missing value then
# Flatten every page.
repeat with actPage in doc's pages
merge actPage
end repeat
end if
end tell
- Download the scripts and unpack them.
- Start PhotoLine
- Open your document
- Double-click the script.
- Apple's Script Editor will appear and you can execute the script.
If you want to apply the script repeatedly, you can export it as an app from Script Editor.
Martin
You do not have the required permissions to view the files attached to this post.
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Re: Apply an action to all pages.
Yes, I'am...
Oh, great! This script does exactly what I needed... yesterday :
But I'm sure I will need them again ... unless PhotoLine integrates a similar feature in the future.
They result incredible fast, especially the one that directly flattens all pages of a document. But the other is also incredibly fast when compared with using the action via shortcut.
I would like to know if such a thing can be done on windows as well... in any case I think it would be really nice to have these features integrated into PhotoLine.
Thanks anyway for these scripts.
-
- Entwickler
- Posts: 4184
- Joined: Mon 18 Nov 2002 15:30
- Location: Bad Gögging
Re: Apply an action to all pages.
I am sure, Martin can make a script for Windows.
Another trick would be to save the document in TIFF format and then load it on pages.
This way, every page will be a flat image.
Another trick would be to save the document in TIFF format and then load it on pages.
This way, every page will be a flat image.
-
- Entwickler
- Posts: 4234
- Joined: Tue 19 Nov 2002 15:49
Re: Apply an action to all pages.
A Windows script is straighforward. The larger problem is the scripting language.
VBScript is deprecated on Windows 11, so probably PowerShell is the way to go. But by default, PowerShell scripts are disabled on Windows, so one has to enable them (https://stackoverflow.com/questions/646 ... his-system).
The good thing about PowerShell: Windows has a development environment for it (PowerShell ISE) with a quite usable debugger.
With all that said, here are the scripts. You should save them under the given name and can then execute them from Windows Explorer.
ActionToEveryPage.ps1:
MergeEveryPage.ps1:
VBScript is deprecated on Windows 11, so probably PowerShell is the way to go. But by default, PowerShell scripts are disabled on Windows, so one has to enable them (https://stackoverflow.com/questions/646 ... his-system).
The good thing about PowerShell: Windows has a development environment for it (PowerShell ISE) with a quite usable debugger.
With all that said, here are the scripts. You should save them under the given name and can then execute them from Windows Explorer.
ActionToEveryPage.ps1:
Code: Select all
$pl = New-Object -ComObject PhotoLine.Application -Strict
$pl.Visible = $True
$doc = $pl.ActiveDocument
# Is there a document?
if ($doc -ne $null)
{
# Ask the user for the name of the action.
$actionName = $pl.InputBox("Execute Action On Every Page", "Action Name:")
# Did the user enter a name?
if ($actionName.Length -gt 0)
{
# Execute the action on every page.
foreach ($page in $doc)
{
# Set a well-defined active layer, so that the action
# knows where to start.
$page.ActiveLayer = $page.RootLayer.First
$page.DoOperation("Action", "Name", $actionName)
}
}
}
# Attention: Powershell and Powershell ISE release COM objects only after quitting.
# So if you quit PhotoLine before quitting Powershell (ISE), PhotoLine will remain
# active in the background and you will have to terminate it using the Task Manager.
Code: Select all
$pl = New-Object -ComObject PhotoLine.Application -Strict
$pl.Visible = $True
$doc = $pl.ActiveDocument
# Is there a document?
if ($doc -ne $null)
{
# Merge every page.
foreach ($page in $doc)
{
$doc.Merge($page)
}
}
# Attention: Powershell and Powershell ISE release COM objects only after quitting.
# So if you quit PhotoLine before quitting Powershell (ISE), PhotoLine will remain
# active in the background and you will have to terminate it using the Task Manager.
-
- Mitglied
- Posts: 136
- Joined: Thu 11 Sep 2008 21:03
- Location: Tolmezzo (UD) Italia
Re: Apply an action to all pages.
Thanks again for your answer. I didn't really ask the scripts for windows, I just wanted to know if they were doable... even I'm evaluating to turn to windows sometime in the future.
Given the effort you made, I hope they will at least be useful to some other users.
Given the effort you made, I hope they will at least be useful to some other users.
-
- Mitglied
- Posts: 187
- Joined: Thu 28 May 2015 18:00
- Location: Belgium
Re: Apply an action to all pages.
Could those Powershell scripts become visible and launchable from within Photoline menu "Filter/Script" ?Martin Huber wrote: ↑Mon 06 May 2024 12:36 With all that said, here are the scripts. You should save them under the given name and can then execute them from Windows Explorer.
Regards
Philippe