Script Help - Select Final Destination. Steve Mills.

23 views
Skip to first unread message

Rick Gaskin

unread,
Jan 13, 2017, 2:07:48 PM1/13/17
to multiad...@googlegroups.com
I have a little script that was written by the legendary Steve Mills
(well I helped a little. a very little :) )

What the script does is when you "Save" a file it also creates a PDF and
uploads specific destination on a network. And its all handled in the
background.

My shop uses it for proofing ads to the sales people. It works GREAT!!

BUT ...now our sale staff would their own individual proofing folders on
the network.

Sooooooooo i need figure out how to make this happen.

Conceptually ...I am thinking that on Save the user would be prompted to
select a salespersons name from a list. once a section had been made the
user would hit "ok"...a pdf would be created (as in the original script)
and it would be uploaded to the specified folder.

Unfortunately i haven't written or modified a script in years and not
sure what to do :(

Hopefully someone can help. Thank you in advance

Rick

(the original script is posted below)


property PDFPath : "PDFProofs:"

using terms from application "MultiAd Creator Pro"
on saved theDoc
set question to display dialog "Send Proof?" buttons {"Yes",
"No"} default button 2
set answer to button returned of question
if answer is "Yes" then
set fileName to name of theDoc
set destFolder to PDFPath


--Trim off .crtr extension if it has one:
if fileName ends with ".crtr" then
set sd to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
set fileName to (text items 1 thru -2 of fileName) as text
set AppleScript's text item delimiters to sd
end if


tell application "MultiAd Creator Pro"

export PDF current spread of theDoc saving in
(destFolder & fileName & ".pdf") print order user order export method
composite output color space CMYK stand in resolution 300 black and
white compression use zip color image compression use JPEG quality 80
with embed no base 14 fonts, use doc size, binary encoding and compress
text and line art without print as spreads, crop marks, registration
marks, color bars, document notes, plate information, text blocks only
and presentation mode
end tell

tell application "Finder"
activate
tell application "MultiAd Creator Pro"
activate
end tell
end tell
end if
end saved
end using terms from



Steve Mills

unread,
Jan 13, 2017, 2:18:29 PM1/13/17
to multiad...@googlegroups.com
On Jan 13, 2017, at 01:07 PM, Rick Gaskin <rga...@wdt.net> wrote:

I have a little script that was written by the legendary Steve Mills
(well I helped a little. a very little :) )

What the script does is when you "Save" a file it also creates a PDF and
uploads specific destination on a network. And its all handled in the
background.

My shop uses it for proofing ads to the sales people. It works GREAT!!

BUT ...now our sale staff would their own individual proofing folders on
the network.

Sooooooooo i need figure out how to make this happen.

Conceptually ...I am thinking that on Save the user would be prompted to
select a salespersons name from a list. once a section had been made the
user would hit "ok"...a pdf would be created (as in the original script)
and it would be uploaded to the specified folder.

Unfortunately i haven't written or modified a script in years and not
sure what to do :(

Hey Rick!

Putting an extra "choose your name" dialog in the middle of a save operation is a little hacky if there's no other way to get that info, so let's figure out if it can be done automatically. Will each sales person be running it from their own computer? And do they run from the own OS X user? If so, the script could easily grab the user name, match that against a list of {user name, folder name} pairs to get the name of their folder on the server.

If not, the existing "Send proof?" dialog could be replaced with a dialog that lets the user choose their name, and still have Cancel and OK buttons.

Sent from iCloud's ridiculous UI, so, sorry about the formatting

 

Rick Gaskin

unread,
Jan 13, 2017, 3:39:29 PM1/13/17
to multiad...@googlegroups.com

Hey Rick!

Putting an extra "choose your name" dialog in the middle of a save operation is a little hacky if there's no other way to get that info, so let's figure out if it can be done automatically. Will each sales person be running it from their own computer? And do they run from the own OS X user? If so, the script could easily grab the user name, match that against a list of {user name, folder name} pairs to get the name of their folder on the server.

If not, the existing "Send proof?" dialog could be replaced with a dialog that lets the user choose their name, and still have Cancel and OK buttons.

Sent from iCloud's ridiculous UI, so, sorry about the formatting


Yay Steve! I knew if i said your name 3x you would appear!!

Q: Will each sales person be running it from their own computer?
A: No. Their folders will be on the network. The individual folders will be sub folders of the PDFProof volume (which is mounted on the desktop). They will be looking at the PDFProof volume from their own individual PC's


"Send proof?" dialog could be replaced with a dialog that lets the user choose their name, and still have Cancel and OK buttons

The above  might be the best short term answer.

Here is the problem: The salespeople do not know when their PDF proofs are uploaded. And I am trying to come up with notification system that won't involve much interaction.

According to my IT staff if i can get the PDFproofs to individual folders (setup for each sales person).... they will handle the notification process.

That is where I am at...

Good to hear from you!!! Thank you!!




Steve Mills

unread,
Jan 13, 2017, 4:47:27 PM1/13/17
to multiad...@googlegroups.com
On Jan 13, 2017, at 02:39 PM, Rick Gaskin <rga...@wdt.net> wrote:

Yay Steve! I knew if i said your name 3x you would appear!! 

LOL. Yep, I'm a spooky ghost.

The above  might be the best short term answer.

Here is the problem: The salespeople do not know when their PDF proofs are uploaded. And I am trying to come up with notification system that won't involve much interaction.

According to my IT staff if i can get the PDFproofs to individual folders (setup for each sales person).... they will handle the notification process.

Here's the script changed to ask to choose a name instead of the plain dialog. You'll just have to replace Andy, Barney, and Opie with sales folder names.
 

property PDFPath : "PDFProofs:"

property lastChosenName : ""


using terms from application "MultiAd Creator Pro"

on saved theDoc

--Set names of folders on output server to sales names here:

set salesNames to {"Andy", "Barney", "Opie"}


set rep to choose from list salesNames with title "Send Proof?" with prompt "Select output folder name." default items {lastChosenName} OK button name "Yes" cancel button name "No" without multiple selections allowed and empty selection allowed

if rep is not false then

set lastChosenName to item 1 of rep

set fileName to name of theDoc

set destFolder to PDFPath


--Trim off .crtr extension if it has one:

if fileName ends with ".crtr" then

set sd to AppleScript's text item delimiters

set AppleScript's text item delimiters to {"."}

set fileName to (text items 1 thru -2 of fileName) as text

set AppleScript's text item delimiters to sd

end if


tell application "MultiAd Creator Pro"

export PDF current spread of theDoc saving in (destFolder & lastChosenName & ":" & fileName & ".pdf") print order user order export method composite output color space CMYK stand in resolution 300 black and white compression use zip color image compression use JPEG quality 80 with embed no base 14 fonts, use doc size, binary encoding and compress text and line art without print as spreads, crop marks, registration marks, color bars, document notes, plate information, text blocks only and presentation mode

end tell


tell application "Finder"

activate

tell application "MultiAd Creator Pro"

activate

end tell

end tell

end if

end saved

end using terms from


 

Rick Gaskin

unread,
Jan 17, 2017, 9:40:29 AM1/17/17
to multiad...@googlegroups.com
Thank you Steve!! This worked first try!!! Thank you!!!!

I have another idea that goes along with this script and i wondered if you might have some ideas.

What if I wanted to handle the email notification on my end?? In other words, when a file is added to one of the subfolders (Andy, Opie Etc) an email notification (using the file name as subject line) is sent to the owner of the folder..what is the best way to handle this??

(yes i know I said IT said they would handle it but i thought i could come up with solution as well :) or maybe it would better if IT handle it?? i dunno??)

Would a folder action script be the best way to go??

This is what I have thus far not sure how to convert the file name to subject line


on adding folder items to thefolder after receiving theAddedItems
   
    repeat with eachitem in theAddedItems
       
       
       
       
        set theSender to "rick<rga...@wdt.net>"
        set recipCommon to "rick"
        set recipAddress to "rga...@wdt.net"
        set msgText to "***AD HAS BEEN UPLOADED***"
       
       
       
       
       
       
        tell application "Mail"
           
           
            set newmessage to make new outgoing message with properties {subject:"Important File Attachment", content:msgText & return & return}
            tell newmessage
                set visible to true
                set sender to theSender
               
                make new to recipient with properties {name:recipCommon, address:recipAddress}
                make new attachment with properties {file name:eachitem} at after the last paragraph
               
               
            end tell
            send newmessage
        end tell
       
       
    end repeat
   
end adding folder items to





Steve Mills

unread,
Jan 17, 2017, 10:10:24 AM1/17/17
to Creator list list
On Jan 17, 2017, at 08:40:28, Rick Gaskin <rga...@wdt.net> wrote:
>
> I have another idea that goes along with this script and i wondered if you might have some ideas.
>
> What if I wanted to handle the email notification on my end?? In other words, when a file is added to one of the subfolders (Andy, Opie Etc) an email notification (using the file name as subject line) is sent to the owner of the folder..what is the best way to handle this??
>
> (yes i know I said IT said they would handle it but i thought i could come up with solution as well :) or maybe it would better if IT handle it?? i dunno??)
>
> Would a folder action script be the best way to go??

Probably. It depends on whether or not the act of exporting the pdf causes the folder action to fire. I think it will. I've been bitten in the past with thinking I could use a folder action to do things to files that get added remotely from a cloud drive situation, but it turns out that files added that way don't trigger it. But a local save should do it, IIRC.

> This is what I have thus far not sure how to convert the file name to subject line
>
>
> on adding folder items to thefolder after receiving theAddedItems
>
> repeat with eachitem in theAddedItems
> set theSender to "rick<rga...@wdt.net>"
> set recipCommon to "rick"
> set recipAddress to "rga...@wdt.net"
> set msgText to "***AD HAS BEEN UPLOADED***"
>
> tell application "Mail"
> set newmessage to make new outgoing message with properties {subject:"Important File Attachment", content:msgText & return & return}
> tell newmessage
> set visible to true
> set sender to theSender
>
> make new to recipient with properties {name:recipCommon, address:recipAddress}
> make new attachment with properties {file name:eachitem} at after the last paragraph
> end tell
> send newmessage
> end tell
> end repeat
> end adding folder items to

Put this right after your "set msgText" line:

set savedTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {":"}
set fileName to last text item of (eachitem as text)
set AppleScript's text item delimiters to savedTID

Then change the line to this:

set newmessage to make new outgoing message with properties {subject:"Important File Attachment \"" & fileName & "\"", content:msgText & return & return}

--
Steve Mills
Drummer, Mac geek

Rick Gaskin

unread,
Jan 17, 2017, 3:21:51 PM1/17/17
to multiad...@googlegroups.com
Well I thought it was good to go but now its acting weird. I replaced the Mayberry names with Disney characters. And created sub folders in the proof folder matching those names. Everything worked great and IT set it up so that i received notification every time something was sent to either of those three folders (donald, mickey, minnie).

I then changed the script removing the disney characters and replacing with "W90" and "NONE"

i created corresponding subfolders and IT set it up so that sales person W90 would get a notification. And it worked.

HOWEVER when i sent to the "NONE" folder I would get a a Script Error "The was a problem exporting the file" and it ask me to edit script??

My punctuation is correct no clue.

So I thought maybe bad folder....so i created a new folder and added the name to my script BUT I can't get it to dispay in the list for the selection??

I have done all the basic stuff: made sure the script was complied, made sure it was the only script, made sure it was attached scripts folder.

If I pull the script out of the attached scripts folder everything is normal no prompts no nothing. just save file no pdf generation etc.

I put the script back in the attached script folder and the despite the fact that the script has additional name it still doesnt display it in the list??

bizzare

CURRENT SCRIPT


property PDFPath : "PDFProofs:"

property lastChosenName : ""


using terms from application "MultiAd Creator Pro"
   
    on saved theDoc
       
        --Set names of folders on output server to sales names here:
       
        set salesNames to {"W90", "NONE", "TEST1"}

Steve Mills

unread,
Jan 17, 2017, 11:26:29 PM1/17/17
to Creator list list
On Jan 17, 2017, at 14:21:49, Rick Gaskin <rga...@wdt.net> wrote:
>
> Well I thought it was good to go but now its acting weird. I replaced the Mayberry names with Disney characters. And created sub folders in the proof folder matching those names. Everything worked great and IT set it up so that i received notification every time something was sent to either of those three folders (donald, mickey, minnie).
>
> I then changed the script removing the disney characters and replacing with "W90" and "NONE"
>
> i created corresponding subfolders and IT set it up so that sales person W90 would get a notification. And it worked.
>
> HOWEVER when i sent to the "NONE" folder I would get a a Script Error "The was a problem exporting the file" and it ask me to edit script??
>
> My punctuation is correct no clue.
>
> So I thought maybe bad folder....so i created a new folder and added the name to my script BUT I can't get it to dispay in the list for the selection??
>
> I have done all the basic stuff: made sure the script was complied, made sure it was the only script, made sure it was attached scripts folder.
>
> If I pull the script out of the attached scripts folder everything is normal no prompts no nothing. just save file no pdf generation etc.
>
> I put the script back in the attached script folder and the despite the fact that the script has additional name it still doesnt display it in the list??

That is pretty weird. You've quit and relaunched Creator?

Try adding a debug line after the "set salesNames" line:

display dialog salesNames as text

Does a dialog appear with all the names squished together?

Rick Gaskin

unread,
Jan 18, 2017, 7:01:45 AM1/18/17
to multiad...@googlegroups.com
hi steve thank you for the response.

from what i can tell..IT is moving the PDFproof from the salesperson
subfolders to the PDFproof volume and basically their configuration is
moving the file too quickly.....before the script has time to finish
creating its PDF its trying to move it to the PDF volume...hence the error.

IT created a delay on their end and the initial results is problem
solved...however it has not been tested with large files.

rick
>


Steve Mills

unread,
Jan 18, 2017, 9:32:00 AM1/18/17
to Creator list list
On Jan 18, 2017, at 06:01:43, Rick Gaskin <rga...@wdt.net> wrote:
>
> from what i can tell..IT is moving the PDFproof from the salesperson subfolders to the PDFproof volume and basically their configuration is moving the file too quickly.....before the script has time to finish creating its PDF its trying to move it to the PDF volume...hence the error.
>
> IT created a delay on their end and the initial results is problem solved...however it has not been tested with large files.

Aha. We have a couple apps at my job that need to wait for files to be xferred. What they do is make note of the file size when the file first appears, then check the size again every second. When we notice that the size has not changed after X seconds, we assume the xfer is complete. You might also work around it by exporting to a folder on the same volume that isn't being watched, then move it to the final folder. The move should be much faster than the export.

Rick Gaskin

unread,
Jan 19, 2017, 7:18:15 AM1/19/17
to multiad...@googlegroups.com


On 1/18/17 9:31 AM, Steve Mills wrote:
>
> Aha. We have a couple apps at my job that need to wait for files to be xferred. What they do is make note of the file size when the file first appears, then check the size again every second. When we notice that the size has not changed after X seconds, we assume the xfer is complete. You might also work around it by exporting to a folder on the same volume that isn't being watched, then move it to the final folder. The move should be much faster than the export.
>
> --
> Steve Mills
> Drummer, Mac geek
Thanks for the idea! And thank you very much for your help!! Long Live
Creator!!!

My next script project is to create a hot folder or droplet that will
PDF export Creator files

Drag creator files to folder/droplet on my desktop for batch PDF export.

Again I am not sure what is the best way...folder action script or droplet??

Thank you again Steve!


Steve Mills

unread,
Jan 19, 2017, 9:06:14 AM1/19/17
to Creator list list
On Jan 19, 2017, at 06:18:14, Rick Gaskin <rga...@wdt.net> wrote:

> Thanks for the idea! And thank you very much for your help!! Long Live Creator!!!

Hopefully you have a stock pile of old Macs that will still run old OSes. :)

> My next script project is to create a hot folder or droplet that will PDF export Creator files
>
> Drag creator files to folder/droplet on my desktop for batch PDF export.
>
> Again I am not sure what is the best way...folder action script or droplet??

I'd go with a droplet. That way the original file stays where it is.

Rick Gaskin

unread,
Jan 19, 2017, 1:12:54 PM1/19/17
to multiad...@googlegroups.com


On 1/19/17 9:06 AM, Steve Mills wrote:
>
> Hopefully you have a stock pile of old Macs that will still run old OSes. :)
Yeah fingers crossed. I tested alternatives to MC and there is nothing
on the market that works like MC. I even developed a couple of scripts
for InDesign (aka PageMaker) that replicated some Creator functionality
and it still stinks. How InDesign ever became the "industry standard"..i
will never know.

I have one final question regarding the current script...I need to do
some additional "trimming"

Our file naming format is client "name/size/order number"

the order number is always 7 digits and it is always the last item in
the file name format

ex: Maple Creek 1x1.5 1953975

how would i set it so that it would trim the .crtr if it has one (which
it is doingg now)

keep the order number

and delete all the other items

the result would be 1953975 with the resulting pdf file name "1953975.pdf"

Steve Mills

unread,
Jan 19, 2017, 1:49:42 PM1/19/17
to multiad...@googlegroups.com
On Jan 19, 2017, at 12:12 PM, Rick Gaskin <rga...@wdt.net> wrote:

Yeah fingers crossed. I tested alternatives to MC and there is nothing
on the market that works like MC. I even developed a couple of scripts
for InDesign (aka PageMaker) that replicated some Creator functionality
and it still stinks. How InDesign ever became the "industry standard"..i
will never know.

Tell me about it. It's horrible! Graphics have to be in a box? Dumb. No dialogs for setting char/par attributes to selected text all at once? Dumb. And the AppleScript dictionary and implementation is a joke. My job now involves scripting for InDesign. There are so many things it can't do that you can do from the UI.

how would i set it so that it would trim the .crtr if it has one (which 
it is doingg now)

keep the order number

and delete all the other items

the result would be 1953975 with the resulting pdf file name "1953975.pdf"

--Trim off .crtr extension if it has one:
if fileName ends with ".crtr" then
set sd to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
set fileName to (text items 1 thru -2 of fileName) as text
set AppleScript's text item delimiters to sd
end if

Put this hunk after the above hunk:

set sd to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}
set fileName to last text item of fileName
set AppleScript's text item delimiters to sd

Rick Gaskin

unread,
Jan 19, 2017, 3:07:59 PM1/19/17
to multiad...@googlegroups.com



On 1/19/17 1:49 PM, Steve Mills wrote:

Tell me about it. It's horrible! Graphics have to be in a box? Dumb. No dialogs for setting char/par attributes to selected text all at once? Dumb. And the AppleScript dictionary and implementation is a joke. My job now involves scripting for InDesign. There are so many things it can't do that you can do from the UI.
WOW! I didn't know. That DOES suck.

Again I don't get why anyone would think Indesign was all that great. My only guess is that its because its an "ADOBE" product. People familiar with their other products find the environment "familiar"

On a plus note I have the PDF Upload script working for InDesign :)

We are going to hang on with Creator as long as we can ...hopefully someone will redevelop the program or something better than InDesign comes along.

We are the only group in my corp that still uses Creator and our production numbers surpass the combined totals of all the other groups using InDesign.

Maybe we should all get together and start a GoFundMe or CrowdFund or whatever ...to buy and re-tool Creator!



Put this hunk after the above hunk:

set sd to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}
set fileName to last text item of fileName
set AppleScript's text item delimiters to sd

Sent from iCloud's ridiculous UI, so, sorry about the formatting


i will give it a try thank you again!!!

Rick Gaskin

unread,
Feb 15, 2017, 3:28:06 PM2/15/17
to multiad...@googlegroups.com
steve mills. steve mills. steve mills.
>> Put this hunk after the above hunk:
>>
>> set sd to AppleScript's text item delimiters
>> set AppleScript's text item delimiters to {" "}
>> set fileName to last text item of fileName
>> set AppleScript's text item delimiters to sd
>>
hi steve. do you recall the above?? it works!!!

but i am having a problem with final PDF naming. :(

as you may or may not recall i was trying to strip have the PDF proofing
script result with only order number.

so when (for example) we save an ad we might call it joe's garage 2x2
1234567 (1234567 is the order number)

the script asks do you want to send proof hit ok and it would send a PDF
proof (using the above example) entitled 1234567.pdf

annnnnnd you modification does EXACTLY that!! yay!! :)

BUT what i am finding is that my co-workers are using all manner of file
naming formats. boo!! :(

using the above file name example... while i might name it joe's garage
2x2 1234567 i have co-workers who insist on using underscores in their
file names!!! so joe's garage 2x2 1234567 would be joe's garage
2x2_1234567 .

and whats happening is the resulting PDF is entitled 2x2_1234567
obviously the modification is looking for the first " " (space)

would it be possible to make the script hack everything off 7 characters
from the last character (7 including the last character) from the file
name? so the result would be 1234567.pdf

my co-workers have no reason to use the underscore. one started doing it
a few years ago and now at least 2 others are doing it.
i don't do it. i am a purest.

here is the entire script just to refresh your memory

property PDFPath : "PDFProofs:"

property lastChosenName : ""


using terms from application "MultiAd Creator Pro"

on saved theDoc

--Set names of folders on output server to sales names here:

set salesNames to {"NONE", "L2", "L3", "W60", "W70", "W90",
"W110", "W140", "W156", "W171", "W180", "W220", "W230", "W240", "W260",
"W350", "SL14", "SL16", "SL18", "SL33"}


set rep to choose from list salesNames with title "Send Proof?"
with prompt "Select output folder name." default items {lastChosenName}
OK button name "Yes" cancel button name "No" without multiple selections
allowed and empty selection allowed

if rep is not false then

set lastChosenName to item 1 of rep

set fileName to name of theDoc

set destFolder to PDFPath


--Trim off .crtr extension if it has one:

if fileName ends with ".crtr" then

set sd to AppleScript's text item delimiters

set AppleScript's text item delimiters to {"."}

set fileName to (text items 1 thru -2 of fileName) as text

set AppleScript's text item delimiters to sd

end if

set sd to AppleScript's text item delimiters
set AppleScript's text item delimiters to {" "}
set fileName to last text item of fileName
set AppleScript's text item delimiters to sd




Steve Mills

unread,
Feb 15, 2017, 11:46:30 PM2/15/17
to Creator list list
On Feb 15, 2017, at 14:28:04, Rick Gaskin <rga...@wdt.net> wrote:
>
> steve mills. steve mills. steve mills.
>>> Put this hunk after the above hunk:
>>>
>>> set sd to AppleScript's text item delimiters
>>> set AppleScript's text item delimiters to {" "}
>>> set fileName to last text item of fileName
>>> set AppleScript's text item delimiters to sd
>>>

> would it be possible to make the script hack everything off 7 characters from the last character (7 including the last character) from the file name? so the result would be 1234567.pdf

Yep. Use this 1 line in place of the above 4 lines:

set fileName to text -7 thru -1 of fileName

If the file name is less than 7 chars, it's gonna puke.

Rick Gaskin

unread,
Feb 16, 2017, 1:23:36 PM2/16/17
to multiad...@googlegroups.com


On 2/15/17 11:46 PM, Steve Mills wrote:
> Yep. Use this 1 line in place of the above 4 lines:
>
> set fileName to text -7 thru -1 of fileName
>
> If the file name is less than 7 chars, it's gonna puke.
>
> --

yay! that worked! thank you. i was over thinking it.

long live creator!!


Rick Gaskin

unread,
Feb 20, 2017, 7:14:37 AM2/20/17
to multiad...@googlegroups.com
On 2/16/17 1:23 PM, Rick Gaskin wrote:

> set fileName to text -7 thru -1 of fileName
is there any way that the script look at the resulting final filename
and determine

if the last 7 characters are digits or not? 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
(regardless of sequence)

and if NOT exit the script. (be nice if the script displayed a warning -
hit ok - before exiting but i will take what i can get lol)

........

some of my co-workers are having trouble understanding that if their
filenames don't end in a 7 digit numerical sequence that the script will
use the last 7 characters regardless....as a result the are some odd
ball final PDF file names.

in terms of procedure...they need to skip the automation (by selecting
"NO") and export manually ..directly to the salespersons watch
folder...but they just can't seem to grasp the concept. thinking is bad.

and i promise this will be my last modification request :)
(fingers crossed)

R





Steve Mills

unread,
Feb 20, 2017, 9:24:26 AM2/20/17
to Creator list list
On Feb 20, 2017, at 06:14:35, Rick Gaskin <rga...@wdt.net> wrote:
>
> On 2/16/17 1:23 PM, Rick Gaskin wrote:
>
>> set fileName to text -7 thru -1 of fileName
> is there any way that the script look at the resulting final filename and determine
>
> if the last 7 characters are digits or not? 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (regardless of sequence)
>
> and if NOT exit the script. (be nice if the script displayed a warning - hit ok - before exiting but i will take what i can get lol)

Put this hunk right after the previous modification that gets the last 7 chars. It attempts to convert the file name to a number. If it fails, it shows an error dialog with a Cancel button, which cancels the script:

try
fileName as number
on error
display dialog "File name does not end with a 7-digit number." buttons {"Cancel"} default button 1
end try

Rick Gaskin

unread,
Feb 20, 2017, 9:30:35 AM2/20/17
to multiad...@googlegroups.com
ok i will try it

that is clever...i hadnt thought about attacking it like that...

i will get back to you.....


Rick Gaskin

unread,
Feb 20, 2017, 9:40:50 AM2/20/17
to multiad...@googlegroups.com


On 2/20/17 9:24 AM, Steve Mills wrote:
hmmmmmm that test didn't go as well.

script behaved as before. no breaks in processing.

i think i put it in the right place?




property PDFPath : "PDFProofs:"

property lastChosenName : ""


using terms from application "MultiAd Creator Pro"

on saved theDoc

--Set names of folders on output server to sales names here:

set salesNames to {"NONE", "L2", "L3", "W60", "W70", "W90",
"W110", "W140", "W156", "W171", "W180", "W220", "W230", "W240", "W260",
"W350", "SL14", "SL16", "SL18", "SL33"}


set rep to choose from list salesNames with title "Send Proof?"
with prompt "Select output folder name." default items {lastChosenName}
OK button name "Yes" cancel button name "No" without multiple selections
allowed and empty selection allowed

if rep is not false then

set lastChosenName to item 1 of rep

set fileName to name of theDoc

set destFolder to PDFPath


--Trim off .crtr extension if it has one:

if fileName ends with ".crtr" then

set sd to AppleScript's text item delimiters

set AppleScript's text item delimiters to {"."}

set fileName to (text items 1 thru -2 of fileName) as text

set AppleScript's text item delimiters to sd

end if

set fileName to text -7 thru -1 of fileName

try
fileName as number
on error
display dialog "File name does not end with a 7-digit
number." buttons {"Cancel"} default button 1
end try





Steve Mills

unread,
Feb 20, 2017, 9:51:17 AM2/20/17
to Creator list list
On Feb 20, 2017, at 08:40:49, Rick Gaskin <rga...@wdt.net> wrote:
>
> hmmmmmm that test didn't go as well.
>
> script behaved as before. no breaks in processing.
>
> i think i put it in the right place?

Looks correct. What file name did you use? What OS are you using?

Rick Gaskin

unread,
Feb 20, 2017, 9:59:29 AM2/20/17
to multiad...@googlegroups.com


On 2/20/17 9:51 AM, Steve Mills wrote:
> On Feb 20, 2017, at 08:40:49, Rick Gaskin <rga...@wdt.net> wrote:
>> hmmmmmm that test didn't go as well.
>>
>> script behaved as before. no breaks in processing.
>>
>> i think i put it in the right place?
> Looks correct. What file name did you use? What OS are you using?
>

OS 10.11.6

filenames:

test file spec

and

Untitled 1 2x2




Rick Gaskin

unread,
Feb 20, 2017, 12:48:53 PM2/20/17
to multiad...@googlegroups.com
did you have any luck duplicating the script on your end??

Rick Gaskin

unread,
Feb 20, 2017, 1:30:42 PM2/20/17
to multiad...@googlegroups.com


On 2/20/17 12:48 PM, Rick Gaskin wrote:
>
>
>> OS 10.11.6
>>
>> filenames:
>>
>> test file spec
>>
>> and
>>
>> Untitled 1 2x2
>>
>>
> would another IF statement work??

--Trim off .crtr extension if it has one:

if fileName ends with ".crtr" then

set sd to AppleScript's text item delimiters

set AppleScript's text item delimiters to {"."}

set fileName to (text items 1 thru -2 of fileName) as text

set AppleScript's text item delimiters to sd

end if

set fileName to text -7 thru -1 of fileName

if fileName is not number

then display dialog "File name does not end with a 7-digit
number." buttons {"Cancel"} default button 1

end if




Steve Mills

unread,
Feb 20, 2017, 2:03:08 PM2/20/17
to multiad...@googlegroups.com
On Feb 20, 2017, at 12:30 PM, Rick Gaskin <rga...@wdt.net> wrote:

would another IF statement work??

if fileName is not number

No. That's comparing a text object to a class. I'm on 10.12 at home and 10.10 here at work, but my script works in both places. I kinda doubt Apple broke it in 10.11 only. Make a new script and try this:

"1234567" as number

Does it work or error? How about this one:

"abcdefg" as number

Error?

Rick Gaskin

unread,
Feb 20, 2017, 2:13:02 PM2/20/17
to multiad...@googlegroups.com


On 2/20/17 2:02 PM, Steve Mills wrote:
>
> No. That's comparing a text object to a class. I'm on 10.12 at home
> and 10.10 here at work, but my script works in both places. I kinda
> doubt Apple broke it in 10.11 only. Make a new script and try this:
>
> "1234567" as number
>
> Does it work or error? How about this one:
>
> "abcdefg" as number
>
> Error?
>
>
see that is why you are a script writer and i am a graphic artist :)

yes the creation of a new script worked!!

why was it so fickle?? multi-ad? apple script?

one of the other modify scripts didnt work on two separate computers
until the computer was restarted.



Steve Mills

unread,
Feb 20, 2017, 2:19:06 PM2/20/17
to multiad...@googlegroups.com
On Feb 20, 2017, at 01:13 PM, Rick Gaskin <rga...@wdt.net> wrote:

see that is why you are a script writer and i am a graphic artist :)

yes the creation of a new script worked!!

why was it so fickle?? multi-ad? apple script?

one of the other modify scripts didnt work on two separate computers
until the computer was restarted.

That's weird. I've never seen that. It sure ain't Creator's fault. :)

Rick Gaskin

unread,
Feb 20, 2017, 2:22:18 PM2/20/17
to multiad...@googlegroups.com


On 2/20/17 2:18 PM, Steve Mills wrote:
>
> That's weird. I've never seen that. It sure ain't Creator's fault. :)
>
LONG LIVE CREATOR!!!!

thank you again for all your help!!!!

that should do it!!

(knock on simulated wood office furniture)

Muffin

unread,
Sep 25, 2017, 10:36:12 AM9/25/17
to MultiAd Creator User Group
I use to communicate with Steve all the time years but lost email. Anyone know how to get a hold of him because I need his expert analysis of why Creator SAVE function no longer works in Sierra 10.12.6 when saving to server. No problems saving to your own computer.

On Friday, January 13, 2017 at 2:18:29 PM UTC-5, Steve Mills wrote:
On Jan 13, 2017, at 01:07 PM, Rick Gaskin <rga...@wdt.net> wrote:

I have a little script that was written by the legendary Steve Mills
(well I helped a little. a very little :) )

What the script does is when you "Save" a file it also creates a PDF and
uploads specific destination on a network. And its all handled in the
background.

My shop uses it for proofing ads to the sales people. It works GREAT!!

BUT ...now our sale staff would their own individual proofing folders on
the network.

Sooooooooo i need figure out how to make this happen.

Conceptually ...I am thinking that on Save the user would be prompted to
select a salespersons name from a list. once a section had been made the
user would hit "ok"...a pdf would be created (as in the original script)
and it would be uploaded to the specified folder.

Unfortunately i haven't written or modified a script in years and not
sure what to do :(

Hey Rick!

Putting an extra "choose your name" dialog in the middle of a save operation is a little hacky if there's no other way to get that info, so let's figure out if it can be done automatically. Will each sales person be running it from their own computer? And do they run from the own OS X user? If so, the script could easily grab the user name, match that against a list of {user name, folder name} pairs to get the name of their folder on the server.

If not, the existing "Send proof?" dialog could be replaced with a dialog that lets the user choose their name, and still have Cancel and OK buttons.

Steve Mills

unread,
Sep 25, 2017, 10:45:24 AM9/25/17
to multiad...@googlegroups.com
On Sep 25, 2017, at 09:36 AM, Muffin <jmeh...@matthewsintl.com> wrote:

I use to communicate with Steve all the time years but lost email. Anyone know how to get a hold of him because I need his expert analysis of why Creator SAVE function no longer works in Sierra 10.12.6 when saving to server. No problems saving to your own computer.

I'm still here. Sorry, but I don't have any helpful answers for your save problem. Creator's code base is ancient. It's actually amazing that it still runs at all on 10.12.

You say "no longer works". Can you be more specific? Does it crash? Does it appear to work with no error, but no file is actually saved?

It could be that there is no fix. One workaround I'd suggest would be to set up a local folder that matches the structure of the folders on your servers. Something like:

Workaround Folder:
    ServerA:
        Output:
    ServerB:
        Customer A:
        Customer B:

Then set up a folder action script and use it on each subfolder within Workaround Folder. The script would notice files added to the folder and move them to the folder of the same relative path on the appropriate server.
Reply all
Reply to author
Forward
0 new messages