is it possible to:
check PDF pages in “Binder A”, if pdf pages is divisible by 4 with even number than move to “Binder B”
if not extract and delete the first 2 and the last 4 pages, rename the file and move this 6 pages to “Binder C”, rename the residue of the pdfs an move it to “Binder B”
Hi Yvan! I guess the PDF to work on always have more than 6 pages, I would even say much more. I can understand your point of view but if the OP does not evoke such cases than I guess he knows about his files. But for a neat AppleScript script, any case should be considered, even a file say thrown on an applet that would not be a PDF file. Than I suppose those cases must be handled (write a report or so) or just ignored.
Since you’re saying you cannot script, the first step to go is to read some existing (simple) scripts and see if you get sth. AS language is quite “natural” (at least for English speakers I guess :)).
The main thing to keep in mind is that you’ll want to talk to applications, using events (typically verbs) to act on some objects. Any scriptable application has its own vocabulary (although some vocabulary is common to every applications, such as count, delete, copy, etc.). You’ll “learn” an application vocabulary by opening its dictionary via an Script editor (Script Debugger, AppleScript Editor or so). It is also very important to consider the syntax. As your code has a syntax error it won’t compile and you’ll not be able to run it. Sometimes the syntax is correct but other issues come up.
Another possibility to enter the scripting world is to record actions (make a new script in ASE) and click the Record button, then perform some actions in the Finder. Back in ASE you’ll see those actions coded in AS language.
This said, I think Adobe also have that possibility to recording actions.
Be aware that a scriptable application does not mean that any action you can perform manually is necessarily scriptable while the opposite is also right: you can sometimes perform actions or reach some data you cannot in the real world of the app.
I know this still not answer your question but I think it’s important to keep that in mind prior any further step into AppleScript scripting.
set the_pdf_file to choose file of type {"com.adobe.pdf"} with prompt "Preisliste auswählen:"
set jobIDDialog to (display dialog "Auftragsnummer" default answer ¬
"AU-" buttons ¬
{" OK "})
set JobID to text returned of jobIDDialog
tell application "Finder"
set file_name to get name of the_pdf_file
end tell
tell application "Adobe Acrobat Pro"
try
open the_pdf_file with invisible
on error
display alert "Kann die Datei nicht öffnen" & file_name
return false
end try
set numPages to number of pages of document 1
numPages
if numPages mod 4 is not 0 then
tell application "Adobe Acrobat Pro"
--COVER--
set docRef to document 1
set docName to name of document 1
set PageCount to page count
set PageCountbeginn to PageCount - 4
delete pages docRef first 3 last PageCountbeginn
--Speicher die Datei in COVER als COVER--
mount volume "smb://appserv01/PLumschlag/"
set volCover to "PLumschlag:" as text
set NeuePdf to (JobID & " " & "Umschlag--" & docName as string)
set NeuePdfsave to ((volCover) & JobID & " " & "Umschlag--" & docName as string)
save docRef to file NeuePdfsave
close document 1
--INHALT--
open the_pdf_file with invisible
set docName to name of document 1
set PageCount to page count
set PageCountbeginnInhalt to PageCount - 3
delete pages docRef first PageCountbeginnInhalt last PageCount
delete pages docRef first 1 last 2
--Speicher die Datei in INHALT als INHALT
mount volume "smb://appserv01/PLinhalt/"
set volOhneKlapper to "PLinhalt:" as text
set NeuePdf to ((volOhneKlapper) & JobID & " " & "INHALT--" & docName as string)
save docRef to file NeuePdf
close document 1
tell application "Finder"
eject disk "PLinhalt"
eject disk "PLumschlag"
end tell
end tell
else
tell application "Adobe Acrobat Pro"
set docRef to document 1
set docName to name of document 1
mount volume "smb://appserv01/PLinhalt/"
set volOhneKlapper to "PLinhalt:" as text
set NeuePdf to ((volOhneKlapper) & JobID & " " & "komplett--" & docName as string)
save docRef to file NeuePdf
close document 1
end tell
tell application "Finder"
eject disk "PLinhalt"
end tell
end if
end tell