Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help, please, with a beforeQuit script

Guest
Dec 20, 2013 Dec 20, 2013

The script uses a beforeQuit event handler to copy InDesign libraries from one folder to another. Some of the libraries are large and the process takes a while.

I would like to display a progress bar so that users know that their PCs haven't frozen up. But it only flashes into view briefly. Then the InDesign window closes, but the file-copying is still taking place.

Is there some way to delay the actual quit event until the beforeQuit function has finished? Or maybe what I need is a way to display the progress bar that isn't dependent on InDesign.

TOPICS
Scripting
938
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 22, 2013 Dec 22, 2013

Hi Robert

You can use vb and applescript

To display a simple alert that won't close on the application quite is quite simple.

Note the use of the 3 quote marks.

A progress bar is more complicated.

myVBScript = '''MsgBox "Hello there",64,"My message Box"''';

myAppleScript = """tell application "System Events" to display notification "Hi there!" with title "Greetings" """;

// if the above notifcation doesn't work i.e. old o.s. then you can do the below alert

// myAppleScript = """tell application "System Events" to display alert "Hi there!" """;

if ($.os.match(/^W/)) app.doScript(myVBScript,ScriptLanguage.VISUAL_BASIC);

else app.doScript(myAppleScript,ScriptLanguage.APPLESCRIPT_LANGUAGE);

// see

// http://www.javascriptkit.com/javatutors/vbalert.shtml

// http://stackoverflow.com/questions/5588064/how-do-i-make-a-mac-terminal-pop-up-alert-applescript

// https://developer.apple.com/library/mac/documentation/applescript/conceptual/applescriptlangguide/re...

Trevor

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 26, 2013 Dec 26, 2013

Thanks for that... my original post didn't make it clear that I want to run a progress bar, not just because it might be cooler, but because it can dismiss itself when the file copying is complete.

But you've given me the idea of using a javascript beforeQuit handler to launch a vb script (wish I could use AppleScript, but alas) that takes care of file copying. My vb skills are pretty rusty, but I can probably plow thru that. If a progress bar is "complicated" can I infer that it's not impossible?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 26, 2013 Dec 26, 2013

Hi Robert,

The notifications also dismiss themselves after they pop up, but in vb it seems to be quite complicated to do anyway.

As far as a progress bar seeing as you are monitoring a file copying process that monitoring could be done by an external program written in a language suitable for you.

Although some people would advise against it you could use this workflow.

Firstly write the programs to do the monitoring and progress bar then you can get indesign to execute the program as follows

1) On Close save a data file that contains a list of the files that need to be copied from where to where.

2) Get indesign to execute the monitoring program

3) The monitoring progress bar program can read the data file and show the progress bar appropriately.

Defiantly doable, but no so easy. In applescript I think it would be quite easy but as you said "alas"

Trevor

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Dec 26, 2013 Dec 26, 2013
LATEST

This thread my be helpful http://forums.adobe.com/message/5608266#5608266

In particular post 4 by Ariel

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines