1
Scripting in general / Re: Renaming and Filing Images
« Last post by FredrickB on April 16, 2019, 06:56:04 AM »Is there a limit on how many images you can rename with this code?
(*
SELECT THE PARAGRAPHS HERE BELOW PRIOR TO RUN THIS SCRIPT !!!
Paragraph 1 from Data File
Paragraph 2 from Data File
Paragraph 3 from Data File
Paragraph 4 from Data File
Paragraph 5 from Data File
Paragraph 6 from Data File
Paragraph 7 from Data File
Paragraph 8 from Data File
Paragraph 9 from Data File
Paragraph 10 from Data File
Paragraph 11 from Data File
Paragraph 12 from Data File
Paragraph 13 from Data File
Paragraph 14 from Data File
Paragraph 15 from Data File
Paragraph 16 from Data File
Paragraph 17 from Data File
Paragraph 18 from Data File
Paragraph 19 from Data File
Paragraph 20 from Data File
Paragraph 21 from Data File
Paragraph 22 from Data File
Paragraph 23 from Data File
Paragraph 24 from Data File
Paragraph 25 from Data File
Paragraph 26 from Data File
Paragraph 27 from Data File
Paragraph 28 from Data File
Paragraph 29 from Data File
Paragraph 30 from Data File
*)
set the_data to every text of (the clipboard)
set the_text to every paragraph of the_data
--set the_count to length of the_text
repeat while ((item -1 of the_text) is "")
set the_text to (reverse of (rest of (reverse of the_text)))
end repeat
set NOP to length of the_text -- number of paragraphs in Data File
tell application "QuarkXPress9"
tell document 1
set my_list to {}
set props to properties of every text box
repeat with a_box in props
if anchored of a_box is true then
set end of my_list to a_box
end if
end repeat
set NOC to length of my_list -- number of "cells" in line 2
try
if NOP > NOC then
set repeat_line_2 to NOP div NOC
repeat (repeat_line_2 - 1) times
tell story 1 of current box
copy line 2 to after line -1
end tell
end repeat
end if
end try
set my_list to {}
set props to properties of every text box
repeat with a_box in props
if anchored of a_box is true then
set end of my_list to a_box
end if
end repeat
set my_list to reverse of my_list
repeat with j from 1 to length of my_list
try
set story 1 of object reference of item j of my_list to item 1 of the_text
set the_text to rest of the_text
end try
end repeat
end tell
end tell
beep 2
I suppose you mean that the user is prompted to select one box (because the user just don't know what number is such box). Are you with me?
tell application "QuarkXPress"
activate
tell document 1
set thedata to every text of (the clipboard)
set thedata to thedata as text
set ccount to count paragraphs of thedata
try
set theSelection to selection
set thebox to (make picture box at beginning with properties {bounds:{5, 10, 10, 20}})
delay 0.5
set tool mode to drag mode
tell current page
set selected of thebox to true
set selected of text box 1 to false
cut thebox
end tell
select text box 1
set tool mode to 1
delay 1
paste
set box type of picture box 1 to text box type
select text box 2
set inserttext to paragraph 1 of thedata
set the clipboard to inserttext as text
delay 0.2
paste
set paracount to count of paragraphs of text box 1
set ccount to count characters of paragraph paracount of text box 1
--set ccount to ccount - 1
set selection to insertion point after character ccount of paragraph paracount of text box 1
tell application "System Events" to keystroke tab
delay 0.1
end try
end tell
end tell