<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
		<meta name="generator" content="Adobe GoLive 6" />
		<title>CrossDOM Extension</title>
	</head>

	<body>
		<hr />
		<p>ADOBE SYSTEMS INCORPORATED</p>
		<p>Copyright 2005 Adobe Systems Incorporated<br />
			All Rights Reserved</p>
		<p>NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms of the Adobe license agreement accompanying it. If you have received this file from a source other than Adobe, then your use, modification, or distribution of it requires the prior written permission of Adobe.</p>
		<hr />
		<p><b>Extension Name:</b> CrossDOM</p>
		<p><b>Folder name: </b>CrossDOM</p>
		<hr />
		<p><b>Description</b></p>
		<p>This sample shows the use of some of the Cross-DOM functions which are used by the Creative Suite Applications to communicate with other Creative Suite Applications.</p>
		<ul>
			
		</ul>
		<hr />
		<p><b>Module Definition:</b></p>
		<jsxmodule debug="debug" info="This sample shows the use of some of the Cross-DOM functions which are used by the Creative Suite Applications to communicate with other Creative Suite Applications." name="CrossDOM" version="1.0" />
		<p><b>Scripts:</b></p>
		<script><!--
//--------------------------------------------------------------------
// GLOBAL VARIABLES
//--------------------------------------------------------------------


// global variables

var theFile;


//--------------------------------------------------------------------
// CALLBACK FUNCTIONS
//--------------------------------------------------------------------


//---------------------------------------------------------------
// MODULE CALLBACKS


//---------------------------------------------------------
// initializeModule - called after the module has been loaded
//
// Description
//   Use to initialize global variables and data structures, and
//   create Picture objects using createPicture.

function initializeModule() 
{
	dialogs['crossDOM'].addEventListener( 'onClick', onClickHandler );
	dialogs['crossDOM'].addEventListener( 'onShow', chkAppsAndEnablePopups );
}


//---------------------------------------------------------
// startModule - called after all modules are initialized
// 
// Description:
//   All modules are initialized and all UI is available.

function startModule() 
{
	var commonFolder = new JSXFile(Folder.commonFiles);
	photo_scriptFile = new JSXFile(commonFolder.absurl + "/Adobe/StartupScripts/photoshop-9.jsx");

	gl_scriptFile = new JSXFile(commonFolder.absurl + "/Adobe/StartupScripts/golive-8.jsx");
	illustor_scriptFile = new JSXFile(commonFolder.absurl + "/Adobe/StartupScripts/illustrator-12.0.jsx");
	indesign_scriptFile = new JSXFile(commonFolder.absurl + "/Adobe/StartupScripts/indesign-4.0.jsx");

	photo_scriptFile.loadScript();
	gl_scriptFile.loadScript();
	illustor_scriptFile.loadScript();
	indesign_scriptFile.loadScript();	
		
	chkAppsAndEnablePopups();
}


//---------------------------------------------------------
// terminateModule - called before the module is unloaded
// 
// Description:
// Use it to perform any final actions, such as deallocate memory used
// by C++ extensions,  deallocate Picture objects using disposePicture.

function terminateModule() 
{
}

//--------------------------------------------------------------------
// CUSTOM EXTENSION FUNCTIONS
//--------------------------------------------------------------------
//---------------------------------------------------------
// chkAppsAndEnablePopups - called during initializeModule to check if the 
// Adobe applications that support crossDOM are installed.
// The popupApps and popupCmd popups are populated based on this.

function chkAppsAndEnablePopups( )
{

    dialogs['crossDOM'].controls['popupApps'].removeAll();
    
	if ( typeof golive == 'object')// if golive
	{
		dialogs['crossDOM'].controls['popupApps'].add('item', 'GoLive' );
	}
	
	if ( typeof illustrator == 'object')
	{
		dialogs['crossDOM'].controls['popupApps'].add('item', 'Illustrator' );
	}
	
	if ( typeof indesign == 'object' )
	{
		dialogs['crossDOM'].children['popupApps'].add('item', 'InDesign' );
	}
	
	if ( typeof photoshop == 'object' )
	{
		dialogs['crossDOM'].children['popupApps'].add( 'item', 'Photoshop' );
	}
	
}


//---------------------------------------------------------
// executeCmd - called to execute the command chosen.

function executeCmd( eventObj )
{
	switch ( dialogs['crossDOM'].children['popupApps'].value )
	{
		case 'GoLive':
		{
			switch ( dialogs['crossDOM'].children['popupCmd'].value )
			{			
				case 'Open':
					if ( typeof golive.open == 'function' )
						golive.open( theFile );
						break;
				case 'OpenAsNew':
					if ( typeof golive.openAsNew == 'function' )
						golive.openAsNew();
						break;
			}
		}
		break;
			
		case 'Illustrator':
		{
			switch ( dialogs['crossDOM'].children['popupCmd'].value )
			{
				case 'Open':
					if ( typeof illustrator.open == 'function' )
						illustrator.open( theFile );
						break;
				case 'OpenAsNew':
					if ( typeof illustrator.openAsNew == 'function')
					illustrator.openAsNew();
					break;
			}
		}
		break;
		
		case 'InDesign':
		{
			switch ( dialogs['crossDOM'].children['popupCmd'].value )
			{
				case 'Open':
					if ( typeof indesign.open == 'function' )			
						indesign.open( theFile );
						break;
				case 'OpenAsNew':
					if ( typeof indesign.openAsNew == 'function' )		
						indesign.openAsNew();
						break;
			}
		}
		break;
		
		case 'Photoshop':
		{
			switch ( dialogs['crossDOM'].children['popupCmd'].value)
			{
				case 'Open':
					if ( typeof photoshop.open == 'function' )			
						photoshop.open( theFile );
						break;
				case 'OpenAsNew':
					if ( typeof photoshop.openAsNew == 'function' )			
						photoshop.openAsNew();
						break;
			}
		}
		break;		
	}
}


//---------------------------------------------------------
// onClickHandler - called when a control is clicked in the 
// crossDOM palette.

function onClickHandler( UIEventObj )
{
	switch( UIEventObj.target.name )
	{
		case 'fileBtn':
			theFile = fileGetDialog("Please select a file");
			if (theFile != null)
			{
				dialogs['crossDOM'].children['fileName'].value = theFile;			
				var fileValue = theFile;
				
				// create files object for Bridge
				theFile = new File ( fileValue );
			}
			break;
		
		case 'goBtn':
			executeCmd();
			break;
	}
}
//-->
</script>
		<hr />
		<p><b>Menu Bar</b> Menu and Menu Bar definitions - menu items and menus added to the GoLive menu bar</p>
		<!--
		<jsxmenubar>
			<jsxmenu name="" title="">
				<jsxitem name="" title="" dynamic>
				<jsxmenu name="" title="">
					<jsxitem name="" title="" dynamic>
				</jsxmenu>
			</jsxmenu>
		</jsxmenubar>
		-->
		<p><b>Palettes</b> Palette Window definitions - palette listed in Windows menu by default</p>
		<jsxpalette name="crossDOM" title="$$$/extendscript/CrossDom/paletteTitle=Adobe Cross DOM" menu="" width="250" height="200" minwidth="245" minheight="170">
			<table border="0" cellspacing="0" cellpadding="0" cool="cool" width="245" height="170" gridx="5" gridy="5" usegridx="usegridx" usegridy="usegridy" showgridx="showgridx" showgridy="showgridy">
				<tr height="20">
					<td width="5" height="169" rowspan="7"></td>
					<td width="239" height="20" colspan="5"></td>
					<td width="1" height="20"><spacer type="block" width="1" height="20" /></td>
				</tr>
				<tr height="30">
					<td width="120" height="30" colspan="3" valign="top" align="left" xpos="5">
						<jsxcontrol name="app" type="static" value="$$$/extendscript/CrossDom/SelectApplication=Select Application: " posx="5" posy="20" width="110" height="16"></jsxcontrol>
					</td>
					<td width="119" height="30" colspan="2" valign="top" align="left" xpos="125">
						<jsxcontrol name="popupApps" type="popup" value="" posx="125" posy="20" width="115" height="19"></jsxcontrol>
					</td>
					<td width="1" height="30"><spacer type="block" width="1" height="30" /></td>
				</tr>
				<tr height="5">
					<td width="120" height="5" colspan="3"></td>
					<td width="119" height="30" colspan="2" rowspan="2" valign="top" align="left" xpos="125">
						<jsxcontrol name="popupCmd" type="popup" value="Open,OpenAsNew" posx="125" posy="50" width="115" height="19"></jsxcontrol>
					</td>
					<td width="1" height="5"><spacer type="block" width="1" height="5" /></td>
				</tr>
				<tr height="25">
					<td width="120" height="25" colspan="3" valign="top" align="left" xpos="5">
						<jsxcontrol name="cmd" type="static" value="$$$/extendscript/CrossDom/Select Command=Select Command: " posx="5" posy="55" width="110" height="16"></jsxcontrol>
					</td>
					<td width="1" height="25"><spacer type="block" width="1" height="25" /></td>
				</tr>
				<tr height="30">
					<td width="120" height="30" colspan="3" valign="top" align="left" xpos="5">
						<jsxcontrol name="fileName" type="static" value="$$$/extendscript/CrossDom/ChooseFile=Choose File:" posx="5" posy="80" width="105" height="21"></jsxcontrol>
					</td>
					<td width="20" height="30"></td>
					<td width="99" height="30" valign="top" align="left" xpos="145">
						<jsxcontrol name="fileBtn" type="button" value="..." posx="145" posy="80" width="45" height="19"></jsxcontrol>
					</td>
					<td width="1" height="30"><spacer type="block" width="1" height="30" /></td>
				</tr>
				<tr height="35">
					<td width="5" height="59" rowspan="2"></td>
					<td width="234" height="35" colspan="4" valign="top" align="left" xpos="10">
						<jsxcontrol name="fileName" type="edit" value="$$$/extendscript/CrossDom/FileChosen=File chosen..." posx="10" posy="110" width="230" height="19"></jsxcontrol>
					</td>
					<td width="1" height="35"><spacer type="block" width="1" height="35" /></td>
				</tr>
				<tr height="24">
					<td width="80" height="24"></td>
					<td width="154" height="24" colspan="3" valign="top" align="left" xpos="90">
						<jsxcontrol name="goBtn" type="button" value="GO" posx="90" posy="145" width="80" height="19"></jsxcontrol>
					</td>
					<td width="1" height="24"><spacer type="block" width="1" height="24" /></td>
				</tr>
				<tr height="1" cntrlrow="cntrlrow">
					<td width="5" height="1"><spacer type="block" width="5" height="1" /></td>
					<td width="5" height="1"><spacer type="block" width="5" height="1" /></td>
					<td width="80" height="1"><spacer type="block" width="80" height="1" /></td>
					<td width="35" height="1"><spacer type="block" width="35" height="1" /></td>
					<td width="20" height="1"><spacer type="block" width="20" height="1" /></td>
					<td width="99" height="1"><spacer type="block" width="99" height="1" /></td>
					<td width="1" height="1"></td>
				</tr>
			</table>
		</jsxpalette>
		<p></p>
	</body>

</html>

















