XCLN: Using AppleScript for Drag-and-Drop Support on Macintosh

Last reviewed: March 2, 1998
Article ID: Q166714
The information in this article applies to:
  • Microsoft Exchange Macintosh client, versions 4.0 and 5.0

SUMMARY

The Microsoft Exchange Macintosh client does not support drag-and-drop functionality from the operating system to an Open Compose message or folder. However, there is limited support for attaching files to a New Compose message. Using AppleScript, you can create a script that prompts for a file and allows the Exchange client to be opened, New Compose message window to be opened, and the selected file to be attached.

NOTE: AppleScript is included with the Macintosh operating system; if it is not present, re-install the operating system to add AppleScript.

MORE INFORMATION

NOTE: This AppleScript requires System 7.5 or higher to function correctly.

Apple Events allow for certain actions to be automated and saved as scripts. These AppleScripts (very similar to a macro) will work with any application that is scriptable. The Exchange Macintosh client is ONLY scriptable in the following manner.

To create the script:

  1. Open the Apple Script Editor, usually located in the AppleScript folder within the Apple Extras folder on the machine's local hard disk drive.

  2. Type the following in the script window below at the bottom of the editor.

          on run
    
             set file1 to choose file
             tell application "Microsoft Exchange & Schedule+"
                open file1
             end tell
          end run
    
       The above script applies to Microsoft Exchange version 5.0. For
       Microsoft Exchange version 4.0, change the third line to:
    
          tell application "Microsoft Exchange"
    
    

  3. Click the Check Syntax button; there should be no errors reported. You must correct any syntax errors before continuing.

  4. Select the File menu and choose Save As. Choose a location for the script to be saved; remember this location. Change the Kind selection to Application and select the Never Show Startup Screen option.

  5. Save the script with the following name EXCHOPENDOC in the chosen location.

You should now be able to double-click on the saved script to test it. The script should result in a Chooser window appearing and allowing you to select a file to attach.

The Exchange client will start using the default profile; you will be prompted for your username and password information. Once these are validated, Exchange Client opens a new message window and attaches the selected file. Upon sending or closing the new message, Exchange Client will close and the script is completed.

NOTE: This script should be used while the Microsoft Exchange Server is running. If the Microsoft Exchange Server is not running, nothing will happen and no errors will be reported.

NOTE: If the Exchange application has been hidden then the new compose message will also appear hidden. Only by unhiding Exchange will the new compose message appear.

Some suggestions for use of this script are to create a macro in Microsoft Word to call the script. Once the macro is created it may be shown as a toolbar button or menu command. Here is an example of a Word macro:

         Sub MAIN
   MacScript("exchopendoc")
   End Sub

Note: This will not attach the current open Word document. The current document must be saved and then selected when using with Word.

Another use for this script is to make an alias to the AppleScript file and place the alias file in your Apple Menu Items folder in the System folder. This allows the calling of the script from anywhere within the Macintosh operating system.

Keywords          : XCLN kbcode kbusage
Version           : MACINTOSH:4.0,5.0
Platform          : MACINTOSH


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 2, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.