Recent Posts

Pages: [1] 2 3 4 5 ... 10
1
Adobe Acrobat scripting / Re: Applescript Mouse Click Help?
« Last post by Jean-Marie Schwartz on August 17, 2017, 02:36:52 AM »
Hi!

Acrobat is not very Applescript-friendly.
One way is to use UI Browser.app (from http://pfiddlesoft.com/uibrowser/) and try to isolate the button you wish in one way or another via UI scripting.
HTH.
2
Adobe Acrobat scripting / Applescript Mouse Click Help?
« Last post by Star123 on August 06, 2017, 06:15:09 AM »
Hi Guys,

I am using Mac OS X Yosemite, Apple Script Editor – Version 2.7 and Adobe Acrobat XI.

I would like to go the respective Tag for the Current Selection in the Tag Panel.

So Far What I doing is,
1. Selecting Text
2. Clicking Option Button in Tag Panel and
3. Clicking “Find Tag From Selection” from the list.

As of Now I am using the below script. But it take more time to click.

Code: [Select]
tell application "Adobe Acrobat Pro"
   activate
   set x to 50
   set y to 180
   
   do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END"


set x to 50
set y to 310

do shell script "
/usr/bin/python <<END
import sys
import time
from Quartz.CoreGraphics import *
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
mouseEvent(kCGEventLeftMouseUp, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclick(" & x & "," & y & ");
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
END"

end tell

By Applescript or Javascript, Can it possible to Click “Find Tag From Selection” on the Tag Panel?


Any Help would be appreciated.


Thanks,
Mathew
3
Hi there! I don't use ID hence I don't script ID, but can't address either spread or page? If so, you could target say the last page of spread 2, or page 2 of spread 17. Does this make sense? Another possible way (to me) would be to add the width of the page to the measures so that the new object to be created falls on the right hand page. Are you with me? Then you'd need to test the page number and detect wether you're on a odd or even page. HTH.
4
Adobe InDesign scripting / Text Frames for Page 2 to End Up on Page 1
« Last post by mbornbach on June 12, 2017, 05:28:44 PM »
I have a script that measures text frames and places those measurements as text inside the text frame. The only problem I'm having is that InDesign wants to put the measurements for page 2 of the spread on page 1. What do I need to change to convince InDesign to put the measurements for page 2 on page 2?

Code: [Select]

--------------------------------------------------------------------------------------------------------------
--CREATING SEPARATE NEW LAYER FOR THE MEASURMENTS AND TEXT BOXES IF IT DOESN'T EXIST
--------------------------------------------------------------------------------------------------------------

open afile


tell document 1 -->Beginning of tell document 1 block
try
set measuringLayer to make layer with properties {name:"Measure"}

--Telling script to use existing measure layer if it already exists
on error
set measuringLayer to layer "Measure"
end try



--------------------------------------------------------------------------------------------------------------
--GETTING MEASUREMENTS AND ADDING THEM AS TEXT TO THE MEASURED TEXT FRAME
--------------------------------------------------------------------------------------------------------------

--Displaying a message to the user if there are no text frames on the measure layer
if (count of every text frame of measuringLayer) is 0 then -->Beginning of if statement
set boxesDontExist to true -->Using this to display a dialog further down in the script, after the repeat loop ends.


--Getting the measurements of every text frame on the measure layer
else

set my_pages to every page
repeat with a_page in my_pages
set page_name to get the name of a_page


set boxesExist to true -->Using this to display a dialog further down in the script, after the repeat loop ends.
set measuringTextFrames to (every text frame of page page_name whose item layer is measuringLayer)
repeat with measuringTextFrame in measuringTextFrames -->Beginning of second repeat loop


--Geometric bounds are {top side, left side, bottom side, right side}, also referred to as {y1, x1, y2, x2}
set y2 to item 3 of geometric bounds of measuringTextFrame -->y2 is the bottom side of the frame
set y1 to item 1 of geometric bounds of measuringTextFrame -->y1 is the top side of the frame
set x1 to item 2 of geometric bounds of measuringTextFrame -->x1 is the left side of the frame
set x2 to item 4 of geometric bounds of measuringTextFrame -->x2 is the right side of the frame


--Doing some math with those measurements to figure out the square inches of each frame
set frameHeight to y2 - y1 -->bottom of frame - top of frame = height of the frame
set frameWidth to x2 - x1 -->right side of frame - left side of frame = width of the frame
set frameSquareInchesLong to frameHeight * frameWidth -->multiplying height time width to get square inches
set frameSquareInches to my roundThis(frameSquareInchesLong, 2) -->making the number round to only 2 decimal points instead of a gazillion
set inchMarks to {"''"} -->Adding the inch marks in between quotes
set measurementText to frameSquareInches & inchMarks as string -->Final result followed by the inch marks (example: 3.08")


--Creating the text frames that will hold the measurements
tell page page_name to set displayTextFrame to make text frame with properties {layer:measuringLayer, geometric bounds:{(y1 + "0.05"), (x1 + "0.075"), y2, x2}, stroke color:"None", stroke weight:0}


--Inserting the square inches figured into each frame as text
tell displayTextFrame

--Adding the drop shadow to the text
apply object style using dropShadowStyle

--Adding the calculated result for square inches in each text frame
set contents of insertion point -1 to measurementText

end tell

end repeat -->End of second repeat loop





end repeat --> End of repeat with page loop
end if -->End of if statement
5
Quark XPress support / Re: lock picture box to text in quarkxpress 8.0
« Last post by VernonP on June 12, 2017, 06:04:25 AM »
lock picture box to text in quarkxpress 8.0

How do you do this?
6
Quark XPress scripting / Re: Removing Paragraph Breaks
« Last post by Jean-Marie Schwartz on March 27, 2017, 03:40:31 AM »
Hi! Have you tried to concatenate doc files via a shell script? (Or am I missing sth?)
This might be helpful too: https://forums.macrumors.com/threads/combine-word-documents-through-script.1907370/ (and maybe this one: https://groups.google.com/forum/#!topic/microsoft.public.mac.office.word/tviRk1gUL80 ?)
7
Quark XPress scripting / Removing Paragraph Breaks
« Last post by mbornbach on March 23, 2017, 02:04:46 PM »
I have this script that combines word files into one file. I then drop that Word file onto Quark and drag it off to the side.
The problem I'm having is that the imported text cuts off after the first paragraph and the rest of the text is overflowing.
I'm trying to figure out how to replace the paragraph break in the code with something that won't cut off in Quark; either by changing something in this script in Word or by making a second script that changes it in Quark.

Code: [Select]
 on open of droppedfiles
with timeout of 1500 seconds
tell application "Microsoft Word"
set new_document to make new document
repeat with afile in droppedfiles
set file_path to afile as string
set filename to name of afile
set paste_range to text object of new_document
set collapsed_range to collapse range paste_range direction collapse end
insert file file name file_path at collapsed_range
end repeat
end tell
end timeout
end open
8
Adobe Photoshop scripting / Re: Script works except for Photoshop CS5
« Last post by Jean-Marie Schwartz on March 02, 2017, 05:25:44 AM »
Hi!

Most of the time if a script crashes the app other people won't necessary test the code  :)
Then it would be helpful to be a bit more accurate: at what stage does it crash? What script editor do you use? You'd need to add some log reports along the code as to see what happens and when does the crash occurs.
Does this make sense?
9
Adobe Photoshop scripting / Script works except for Photoshop CS5
« Last post by mbornbach on February 21, 2017, 08:49:08 AM »
I've gotten the following script to work on Photoshop CS5.5, Photoshop CC 2014 and Photoshop CC 2017. It crashes with Photoshop CS5. Any ideas how to fix this would be greatly appreciated. Thanks!

Code: [Select]
-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------

--HOW THIS SCRIPT WORKS:
--This applescript droplet runs whenever a file is dropped onto it.
--First, it creates a backup folder on the user's desktop called "Backups of Images"
--Then, it makes a backup copy to the user's desktop just in case the layered version is needed
--It opens each dropped file in photoshop where it is converted to CMYK
--It attempts to save and close the file
--It provides a bug fix for the overwriting save problem when using Photoshop CS5 or CS5.5 on newer operating systems
--It displays a dialog to the user if there were any problems
--It displays a success dialog to the user if everything went well

-------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------


on open droppedfiles
   with timeout of 1500 seconds
       
       ---------------------------------------------------------------------------------------------------
       -- CREATING AN EMPTY LIST TO ADD PROBLEM FILES TO
       ---------------------------------------------------------------------------------------------------
       
       set problem_list to {}
       set layered_list to {}
       
       
       ---------------------------------------------------------------------------------------------------
       -- CREATING BACKUP FOLDER IF IT DOESN'T EXIST
       ---------------------------------------------------------------------------------------------------
       
       repeat with afile in droppedfiles
           
           --SETTING THE PATH TO THE DESKTOP
           tell application "Finder"
               set desktop_folder to path to desktop as string
           end tell
           
           
           --CREATING BACKUP FOLDER ON THE DESKTOP IF IT DOESN'T EXIST YET
           if not my CheckForFolder(desktop_folder & "Backups of Images:") then
               tell application "Finder"
                   set backup_folder to make new folder at folder desktop_folder with properties {name:"Backups of Images"}
               end tell
           end if
           set backup_folder to desktop_folder & "Backups of Images:" as string
           
           
           -------------------------------------------------------------------------------------
           --BACKING UP THE IMAGES BEFORE PROCESSING
           -------------------------------------------------------------------------------------
           
           tell application "Finder"
               set file_ext to name extension of afile
               set filename to name of afile
               duplicate afile to alias backup_folder with replacing
           end tell
           
           
           -------------------------------------------------------------------------------------
           --CHANGING THE COLOR MODE TO RGB IN PHOTOSHOP
           -------------------------------------------------------------------------------------
           
           tell application "Adobe Photoshop CC 2017"
               activate
               set display dialogs to never
               open afile showing dialogs never
               
               tell current document
                   
                   --Adding the image's filename to a warning list if the image has multiple layers
                   set layer_count to (count of layers) as string
                   if layer_count is greater than 1 then
                       set layered_list to layered_list & "• " & filename & return
                       
                       
                       --Doing the rest of the processing if the image is flattened
                   else
                       
                       try
                           
                           --Changing color mode to CMYK
                           change mode to CMYK
                           
                           
                           -------------------------------------------------------------------------------------
                           --SAVING THE IMAGE
                           -------------------------------------------------------------------------------------
                           
                           --Trying to save
                           try
                               if file_ext contains "tif" or file_ext contains "jpg" or file_ext contains "jpeg" or file_ext contains "png" then
                                   save
                               else
                                   save in file file_path as TIFF appending lowercase extension without copying
                               end if
                               
                               
                               --This is the bug fix that saves a copy of the image
                               --Photoshop CS5.5 on newer operating systems throws an error when overwriting files on a server with an smb connection
                               --Apple says this is Adobe's fault. Adobe says this is Apple's fault.
                           on error
                               
                               --Trimming the extension of the filename so we can add _1, _2, _3 to the end of the filename
                               tell application "Finder"
                                   set old_delims to AppleScript's text item delimiters
                                   set AppleScript's text item delimiters to "." & file_ext
                                   set path_without_extension to first text item of file_path
                               end tell
                               
                               --Adding _1, _2, _3, etc. to the end of the filename to save a copy
                               repeat
                                   set the name_increment to 1
                                   set revised_file_path to path_without_extension & "_" & (name_increment as string) & "." & file_ext as string
                                   try
                                       if file_ext contains "tif" then
                                           save in file revised_file_path as TIFF appending lowercase extension without copying
                                       else if file_ext contains "jpg" or file_ext contains "jpeg" then
                                           save in file revised_file_path as JPEG appending lowercase extension without copying
                                       else if file_ext contains "png" then
                                           save in file revised_file_path as PNG appending lowercase extension without copying
                                       else
                                           save in file revised_file_path as TIFF appending lowercase extension without copying
                                       end if
                                       exit repeat
                                   on error
                                       set revised_file_path to path_without_extension & "_" & (name_increment as string) & "." & file_ext as string
                                       save in file revised_file_path
                                       
                                       
                                       --Using the finder to rename the file to the original name
                                       tell application "Finder"
                                           set revised_file to revised_file_path as alias
                                           try
                                               set name of revised_file to filename
                                           end try
                                       end tell
                                   end try
                                   
                               end repeat
                               
                               --Resetting applescript's text item delimiters
                               tell application "Finder" to set AppleScript's text item delimiters to old_delims
                               
                           end try
                           
                           
                           --Closing the document
                           close saving no
                           
                       on error
                           set problem_list to problem_list & "• " & filename & return
                       end try
                   end if
               end tell
           end tell
       end repeat
       
       
       ---------------------------------------------------------------------------------------------------
       -- DISPLAYING AN ERROR OR SUCCESS DIALOG TO THE USER
       ---------------------------------------------------------------------------------------------------
       
       --Display error message if there were any problems
       if problem_list is not {} and layered_list is {} then
           tell application "SystemUIServer"
               display dialog "THERE WAS A PROBLEM WITH SOME IMAGES:" & return & "The following files had a problem and have been left open in Photoshop. Please try dropping them on the script again:" & return & return & problem_list & return & "Images not in the above list processed successfully. If needed, the originals are in a folder called 'Backups of Images' on your desktop." as string with icon caution giving up after 900
           end tell
           
           --Display error/layered message if there were any problems and there were layered images
       else if problem_list is not {} and layered_list is not {} then
           tell application "SystemUIServer"
               display dialog "ATTENTION:" & return & return & "THERE WAS A PROBLEM WITH SOME IMAGES:" & return & "The following files had a problem and have been left open in Photoshop. Please try dropping them on the script again:" & "--------------------" & return & return & problem_list & return & return & "IMAGES WERE LAYERED:" & return & "The color mode was not changed on the following layered images because changing the color mode of layered images can have unexpected effects:" & return & return & layered_list & return & return & "Images not in either of the lists were processed successfully. If needed, the originals are in a folder called 'Backups of Images' on your desktop." as string with icon stop giving up after 900
           end tell
           
           
           --Display layered message if there were layered images
       else if problem_list is {} and layered_list is not {} then
           tell application "SystemUIServer"
               display dialog "ATTENTION: IMAGES WERE LAYERED" & return & "The color mode was not changed on the following layered images because changing the color mode of layered images can have unexpected effects:" & return & return & layered_list & return & "Any images not in the above list processed successfully. If needed, the originals are in a folder called 'Backups of Images' on your desktop." with icon stop giving up after 900
           end tell
           
           --Display success message if everything is good
       else
           tell application "SystemUIServer"
               display dialog "SUCCESS!" & return & "All the files have been successfully converted to CMYK." & return & return & "If needed, the originals are in a folder called 'Backups of Images' on your desktop." with icon note giving up after 900 -->Will display the success message to the user for 15 minutes or until ok is clicked
           end tell
       end if
       
       
   end timeout
end open

---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------

--FUNCTION TO CHECK IF A FOLDER EXISTS
on CheckForFolder(thisFolder)
   tell application "Finder"
       return (exists folder thisFolder)
   end tell
end CheckForFolder
10
Quark XPress support / Re: Importing text files into Quark with quark styles intact
« Last post by mbornbach on December 28, 2016, 02:49:34 PM »
It looks like simply saving the files as .docx files instead of .rtf files makes Quark happy. :)
Pages: [1] 2 3 4 5 ... 10