//alert("Version from 01/09/06");
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2006 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/
/*
@@@START_XML@@@
Adobe Dreamweaver CS3
This script enables other applications to communicate with Adobe Dreamweaver.
Adobe Dreamweaver CS3
Ce script permet à d'autres applications de communiquer avec Adobe Dreamweaver.
Adobe Dreamweaver CS3
このスクリプトは、他のアプリケーションと Adobe Dreamweaver との通信を有効にします。
Adobe Dreamweaver CS3
Mithilfe dieses Skripts können andere Anwendungen mit Adobe Dreamweaver kommunizieren.
Adobe Dreamweaver CS3
Questo script consente ad altre applicazioni di comunicare con Adobe Dreamweaver
Adobe Dreamweaver CS3
Este script posibilita que otras aplicaciones se comuniquen con Adobe Dreamweaver
Adobe Dreamweaver CS3
Dit script laat andere toepassingen toe te communiceren met Adobe Dreamweaver
Adobe Dreamweaver CS3
Este script permite que outros aplicativos se comuniquem com o Adobe Dreamweaver
Adobe Dreamweaver CS3
Skriptet gjør at andre programmer kan kommunisere med Adobe Dreamweaver
Adobe Dreamweaver CS3
Dette script betyder, at andre programmer kan kommunikere med Adobe Dreamweaver
Adobe Dreamweaver CS3
Tämän komentosarjan avulla muut sovellukset ja Adobe Dreamweaver voivat kommunikoida keskenään
Adobe Dreamweaver CS3
Det här skriptet gör det möjligt för andra program att kommunicera med Adobe Dreamweaver
Adobe Dreamweaver CS3
"此指令碼能讓其他應用程式與 Adobe Dreamweaver 進行通訊。
Adobe Dreamweaver CS3
"此脚本使其它应用程序能够与 Adobe Dreamweaver 进行通信
Adobe Dreamweaver CS3
"이 스크립트를 사용하면 다른 응용 프로그램에서 Adobe Dreamweaver 과(와) 통신할 수 있습니다.
@@@END_XML@@@
*/
//--------------------------------------------------------------------
// DREAMWEAWER COMMON INTERFACE
//--------------------------------------------------------------------
var Dreamweaver = new Object();
var dreamweaver = Dreamweaver; // Also support
var dw = Dreamweaver; // Also support
$.localize = true;
//---------------------------------------------------------
// executeScript ()
// Lets DW execute the specified JavaScript.
// The entire document object model (DOM) of the target application is available to the script.
//
dw.executeScript = function ( script )
{
var bt = new BridgeTalk;
bt.target = 'dreamweaver';
bt.body = script;
bt.send();
}
//---------------------------------------------------------
// quit()
// Performs the equivalent of DW's File > Exit or File > Quit command.
//
dw.quit = function ()
{
if (BridgeTalk.isRunning('dreamweaver')) // First check if GoLive is open
{
dw.executeScript("dw.quitApplication();");
}
}
//---------------------------------------------------------
// openAsNew(fromTemplate)
// Performs the equivalent of DW’s File > New command.
//
// Arguments
// - fromTemplate: If true DW prompts for a template to use, if false the default "New Document"-dialog is used.
//
dw.openAsNew = function ( fromTemplate )
{
dw.activate();
if ((fromTemplate != undefined) && fromTemplate)
dw.executeScript("dw.newFromTemplate()");
else
dw.executeScript("dw.newDocument()");
}
//---------------------------------------------------------
// open(files)
// Performs the equivalent of DW’s File > Open command on the specified files.
//
// Arguments
// - files: A File object or array of File objects. (See File and Folder Objects.)
//
dw.open = function open( files )
{
if (files.reflect.name == "Array")
{
dw.activate();
for (var index=0; index < files.length; index++)
{
var script = "dw.openDocument(dw.convertURIToFilePath('" + files[index].fsName + "'));"
dw.executeScript(script);
}
}
else if (files.reflect.name == "File")
{
dw.activate();
var script = "dw.openDocument(dw.convertURIToFilePath('" + files.fsName + "'));"
dw.executeScript(script);
}
}
//---------------------------------------------------------
// print(files)
// Performs the equivalent of DW's File > PrintCode command on the requested files.
//
// Arguments
// - files: A File object or array of File objects. (See File and Folder Objects.)
//
dw.print = function ( files )
{
if (files.reflect.name == "Array")
{
dw.activate();
for (var index=0; index < files.length; index++)
{
var script = "dw.printDocument(dw.convertURIToFilePath('" + files[index].fsName + "'));"
dw.executeScript(script);
}
}
else if (files.reflect.name == "File")
{
dw.activate();
var script = "dw.printDocument(dw.convertURIToFilePath('" + files.fsName + "'));"
dw.executeScript(script);
}
}
//---------------------------------------------------------
// reveal(file)
// Gives DW the operating-system focus, and, if the specified file is open in DW, brings it to the foreground.
//
// Arguments
// - files: A File object or string specifying a file that can be opened in the target application.
//
dw.reveal = function ( file )
{
if (file.reflect.name == "File")
{
dw.activate();
var script = "dw.revealDocument(dw.convertURIToFilePath('" + file.fsName + "'));"
dw.executeScript(script);
}
else if (file.reflect.name == "String")
{
dw.activate();
var script = "dw.revealDocument(dw.convertURIToFilePath('" + file + "'));"
dw.executeScript(script);
}
}
//---------------------------------------------------------
// place - insert files into active document or site
//
// Description: Place attempts to insert the specified files
// into the current page. If no page is open nothing will happen.
dw.place = function ( files )
{
dw.executeScript(
"var doc = dw.getDocumentDOM();" +
"if (doc != null)" +
"doc.insertFiles(" + files + ");"
);
dw.activate();
}
//--------------------------------------------------------------------
// BRIDGE UI
//--------------------------------------------------------------------
//---------------------------------------------------------
// Create Bridge Specific UI
//
if( BridgeTalk.appName == 'bridge' )
{
var placeInDreamweaverMenu = MenuElement.create( 'command',
localize ("$$$/DWBI/Menu/Place/InDreamweaver=In Dreamweaver"),
'at the end of submenu/Place', 'PlaceInDreamweaver' );
placeInDreamweaverMenu.onSelect = function()
{
// Get all selected files (no containers).
var sel = app.document.getSelection("*");
// Get the files, may be remote/version cue
// app.preflightFiles( sel ); // deprecated, use app.acquirePhysicalFiles() instead:
app.acquirePhysicalFiles( sel );
var fileList = Dreamweaver.thumbnailsToFiles(sel);
dw.place(fileList);
}
placeInDreamweaverMenu.onDisplay = function()
{
this.enabled = false;
//??? BridgeTalk.isRunning is always returning false #1116359, so always enabling menu even if GoLive is not running
//??? if( BridgeTalk.isRunning('dreamweaver') && app.document.selections.length > 0 )
if (app.document.selectionLength > 0)
{
// You can put at least a link to anything onto a HTML-page
// If there was filtering, this is where it would go
// For performace reasons, we should not get a selection with too many objects for every click in the menu bar.
// So if the selection is higher than 200, we optimistically assume that there will be at least one non-container object in the list
// and then handle the filtering only if the menu item is actually selected.
if (app.document.selectionLength > 200)
{
this.enabled = true;
}
else
{
// Get all selected files (no containers).
var sel = app.document.getSelection("*");
if (sel.length > 0)
this.enabled = true;
}
}
}
} // End of Bridge specific code
//--------------------------------------------------------------------
// UTILITIES
//--------------------------------------------------------------------
//---------------------------------------------------------
// activate()
// Gives DW the operating-system focus.
//
dw.activate = function ()
{
dw.executeScript("dw.activateApplication();");
BridgeTalk.bringToFront('dreamweaver');
}
//---------------------------------------------------------
// argsToString -
//
// Description:
// This routine create a string for the arguments that we can transmit
// over BridgeTalk as text.
//
Dreamweaver.argsToString = function ( args )
{
var outArgs = new Array();
for( var index=0; index