Is the new scripting functionality available?


the product details page has feature listed configurator 4:

new scripting functionality: html widget has enhanced scripting capabilities allow open other extensions , call extendscript dom of host application.

is available now? how include extendscript code?

invoking javascript functions html

 

the global javascript object _adobe contains javascript properties , methods can invoke <script> tag in code html widget:

 

you can access these properties of _adobe javascript object in script:

 

global javascript properties

 

 


 

_adobe.jsxinterface                  this object provides access global properties or functions defined in host application's scripting environment.

 

global javascript properties

 

 


 

_adobe.basepath                      the root install path extension.

 


 

_adobe.assetspath                    the path assets/ folder extension.

 


 

 

global javascript methods

 

 


 

_adobe.popuphtml()                   opens page in new browser window.

 


 

_adobe.popupswf()                    opens flash file in new flash player window.

 


 

_adobe.popupflv()                    opens flash video in new flash player window.

 


 

_adobe.invokescript()                executes extendscript code in host application’s scripting environment.

 


 

_adobe.invokescriptfile()            executes referenced extendscript script in host

application’s scripting environment.

 


 

_adobe.invokefunctioninscriptfile()  calls javascript function defined in extendscript file.

 


 

_adobe.download()                    downloads file local file system.

 


 

_adobe.openextension()               opens adobe application extension programmatically.

 


 

_adobe.includejsxfile()              includes , executes extendscript code contained in a

file.

 


 

_adobe.jsxinterface.call()           invokes global function in host application’s

scripting environment.

 


 

 

global functions available in previous releases can used defined:

 

_adobefunctionname()

 

for example, function _adobe.popuphtml() is equivalent method_adobepopuphtml(). these functions, both forms shown in syntax statement. note method name starts lowercase letter, global function name starts uppercase letter.

 

_adobe.popuphtml()

 

opens page in new browser window.

 

_adobe.popuphtml(url[, width, height])

_adobepopuphtml(url[, width, height])

 

 


 

url      string. required. url html document open. can relative path html file in panel’s assets folder.

 

 


width    number. optional, default 400. width of new window in pixels.

 


 

height   number. optional, default 300. height of new window in pixels.

 


 

_adobe.popupswf()

 

opens flash file in new flash player window.

 

_adobe.popupswf(url[, width, height])

_adobepopupswf(url[, width, height])

 

 


 

url      string. required. url flash executable (swf file) open. can relative path html file in panel’s assets folder.

 


 

width    number. optional, default 400. width of new window in pixels.

 


 

height   number. optional, default 300. height of new window in pixels.

 


 

 

_adobe.popupflv()

 

opens flash video in new flash player window.

 

_adobe.popupswf(url[, width, height])

_adobepopupswf(url[, width, height])

 

 


 

url      string. required. url flash video (flv file) open. can relative path html file in panel’s assets folder.

 


 

width    number. optional, default 400. width of new window in pixels.

 


 

height   number. optional, default 300. height of new window in pixels.

 


 

 

_adobe.invokescript()

 

executes extendscript code in host application’s scripting environment. code can use javascript api of host application.

 

_adobe.invokescript(script)

_adobeinvokescript(script)

 

 


 

script   string. required. extendscript code run.

 


 

 

example: to create new document in photoshop:

 

_adobeinvokescript("app.documents.add()");

 

_adobe.invokescriptfile()

 

executes referenced extendscript script in host application’s scripting environment. script must reside in panel’s assets folder. can use javascript api of host application. (compare_adobe.includejsxfile().)

 

_adobe.invokescript(scriptfile)

_adobeinvokescript(scriptfile)

 

 


 

scriptfile string. required. path extendscript (jsx) file in panel’s assets

folder.

 


 

example: to create new document in photoshop, save file script.jsx in assets folder content:

 

app.documents.add();

 

invoke script in html widget’s <script> tag command:

 

_adobeinvokescriptfile("script.jsx");

 

_adobe.invokefunctioninscriptfile()

 

calls javascript function defined in extendscript file.

 

_adobe.invokefunctioninscriptfile(scriptfile, ns, fnname[, args])

_adobeinvokefunctioninscriptfile(scriptfile, ns, fnname[, args])

 

 


 

scriptfile string. required. path extendscript (jsx) file in panel’s assets

folder.

 


 

ns         string. optional. namespace in function defined.

 


 

fnname     string. required. name of function call.

 


 

args       array. optional, default null. array containing 1 or more arguments of correct types pass function call.

 


 

 

example: we recommend define function in object in namespace, avoid name collisions. example, can define function in file in panel’s assets folder named script.jsx:

 

this._configurator = {

open : function(filepath) { app.open(new file(filepath));

}

};

 

in html widget’s <script> tag, set filepath variable path document want open, invoke function command:

 

_adobeinvokefunctioninscriptfile("script.jsx", "_configurator", "open", [filepath]);

 

_adobe.download()

 

downloads file local file system.

 

_adobe.download(url[, defaultname, selectlocation, onsuccess, onerror])

_adobedownload(url[, defaultname, selectlocation, onsuccess, onerror])

 

 


 

url                string. required. url file download.

 


 

defaultname        string. optional, default null. file name save downloaded file in local file system. if null, uses last segment of url.

 


 

selectlocation     boolean. optional, default true. when true, opens platform dialog in user selects destination file. when false, saves file silently user’s ~/downloads/ folder.

 


 

onsuccess          function. optional, default null. function call when download successful. function must take single argument, downloaded file.

 


 

onerror            function. optional, default null. function call when download unsuccessful. function must take single argument, error instance containing error code , message string.

 


 

 

_adobe.openextension()

 

opens adobe application extension programmatically.

 

_adobe.openextension( extid[, startupparams])

 

 


 

extid           string. required. unique identifier of extension open.

 


 

startupparams   string. optional. string specifying one, two, or 3 startup parameters extension, in format

"width=value&height=value&title=value".

 

for example, “width=200&height=400&title=my panel”, or

“title=my panel”

 


 

 

_adobe.includejsxfile()

 

includes , evaluates extendscript code defined in file, returning value of last statement. after execution, global functions , variables defined in jsx file become global functions , variables in host application's scripting environment.

 

_adobe.includejsxfile( path )

 

 


 

scriptfile      string. required. path extendscript (jsx) file in panel’s

assets folder.

 


 

 

differs _adobe.invokescriptfile() in returning value of last statement in script, , in inclusion of globals in host’s scripting environment. after have included extendscript file, can use _adobe.jsxinterface.call() to invoke global functions defined in it.

 

_adobe.jsxinterface.call()

 

invokes global function in host application’s scripting environment.

 

_adobe.jsxinteface.call( functionname[, ...args])

 

 


 

functionname    string. required. name of function call.

 


 

args            optional. 1 or more arguments pass through function call.

 


 

you can use _adobe.includejsxfile() to include global functions in host’s scripting environment, , invoke them call.

 

 

 

invoking javascript functions html

 

the global javascript object _adobe contains javascript properties , methods can invoke <script> tag in code html widget:

 

you can access these properties of _adobe javascript object in script:

 

global javascript properties

 

 


 

_adobe.jsxinterface                  this object provides access global properties or functions defined in host application's scripting environment.

 

global javascript properties

 

 


 

_adobe.basepath                      the root install path extension.

 


 

_adobe.assetspath                    the path assets/ folder extension.

 


 

 

global javascript methods

 

 


 

_adobe.popuphtml()                   opens page in new browser window.

 


 

_adobe.popupswf()                    opens flash file in new flash player window.

 


 

_adobe.popupflv()                    opens flash video in new flash player window.

 


 

_adobe.invokescript()                executes extendscript code in host application’s scripting environment.

 


 

_adobe.invokescriptfile()            executes referenced extendscript script in host

application’s scripting environment.

 


 

_adobe.invokefunctioninscriptfile()  calls javascript function defined in extendscript file.

 


 

_adobe.download()                    downloads file local file system.

 


 

_adobe.openextension()               opens adobe application extension programmatically.

 


 

_adobe.includejsxfile()              includes , executes extendscript code contained in a

file.

 


 

_adobe.jsxinterface.call()           invokes global function in host application’s

scripting environment.

 


 

 

global functions available in previous releases can used defined:

 

_adobefunctionname()

 

for example, function _adobe.popuphtml() is equivalent method_adobepopuphtml(). these functions, both forms shown in syntax statement. note method name starts lowercase letter, global function name starts uppercase letter.

 

_adobe.popuphtml()

 

opens page in new browser window.

 

_adobe.popuphtml(url[, width, height])

_adobepopuphtml(url[, width, height])

 

 


 

url      string. required. url html document open. can relative path html file in panel’s assets folder.

 

 


 

width    number. optional, default 400. width of new window in pixels.

 


 

height   number. optional, default 300. height of new window in pixels.

 


 

_adobe.popupswf()

 

opens flash file in new flash player window.

 

_adobe.popupswf(url[, width, height])

_adobepopupswf(url[, width, height])

 

 


 

url      string. required. url flash executable (swf file) open. can relative path html file in panel’s assets folder.

 


 

width    number. optional, default 400. width of new window in pixels.

 


 

height   number. optional, default 300. height of new window in pixels.

 


 

 

_adobe.popupflv()

 

opens flash video in new flash player window.

 

_adobe.popupswf(url[, width, height])

_adobepopupswf(url[, width, height])

 

 


 

url      string. required. url flash video (flv file) open. can relative path html file in panel’s assets folder.

 


 

width    number. optional, default 400. width of new window in pixels.

 


 

height   number. optional, default 300. height of new window in pixels.

 


 

 

_adobe.invokescript()

 

executes extendscript code in host application’s scripting environment. code can use javascript api of host application.

 

_adobe.invokescript(script)

_adobeinvokescript(script)

 

 


 

script   string. required. extendscript code run.

 


 

 

example: to create new document in photoshop:

 

_adobeinvokescript("app.documents.add()");

 

_adobe.invokescriptfile()

 

executes referenced extendscript script in host application’s scripting environment. script must reside in panel’s assets folder. can use javascript api of host application. (compare_adobe.includejsxfile().)

 

_adobe.invokescript(scriptfile)

_adobeinvokescript(scriptfile)

 

 


 

scriptfile string. required. path extendscript (jsx) file in panel’s assets

folder.

 


 

example: to create new document in photoshop, save file script.jsx in assets folder content:

 

app.documents.add();

 

invoke script in html widget’s <script> tag command:

 

_adobeinvokescriptfile("script.jsx");

 

_adobe.invokefunctioninscriptfile()

 

calls javascript function defined in extendscript file.

 

_adobe.invokefunctioninscriptfile(scriptfile, ns, fnname[, args])

_adobeinvokefunctioninscriptfile(scriptfile, ns, fnname[, args])

 

 


 

scriptfile string. required. path extendscript (jsx) file in panel’s assets

folder.

 


 

ns         string. optional. namespace in function defined.

 


 

fnname     string. required. name of function call.

 


 

args       array. optional, default null. array containing 1 or more arguments of correct types pass function call.

 


 

 

example: we recommend define function in object in namespace, avoid name collisions. example, can define function in file in panel’s assets folder named script.jsx:

 

this._configurator = {

open : function(filepath) { app.open(new file(filepath));

}

};

 

in html widget’s <script> tag, set filepath variable path document want open, invoke function command:

 

_adobeinvokefunctioninscriptfile("script.jsx", "_configurator", "open", [filepath]);

 

_adobe.download()

 

downloads file local file system.

 

_adobe.download(url[, defaultname, selectlocation, onsuccess, onerror])

_adobedownload(url[, defaultname, selectlocation, onsuccess, onerror])

 

 


 

url                string. required. url file download.

 


 

defaultname        string. optional, default null. file name save downloaded file in local file system. if null, uses last segment of url.

 


 

selectlocation     boolean. optional, default true. when true, opens platform dialog in user selects destination file. when false, saves file silently user’s ~/downloads/ folder.

 


 

onsuccess          function. optional, default null. function call when download successful. function must take single argument, downloaded file.

 


 

onerror            function. optional, default null. function call when download unsuccessful. function must take single argument, error instance containing error code , message string.

 


 

 

_adobe.openextension()

 

opens adobe application extension programmatically.

 

_adobe.openextension( extid[, startupparams])

 

 


 

extid           string. required. unique identifier of extension open.

 


 

startupparams   string. optional. string specifying one, two, or 3 startup parameters extension, in format

"width=value&height=value&title=value".

 

for example, “width=200&height=400&title=my panel”, or

“title=my panel”

 


 

 

_adobe.includejsxfile()

 

includes , evaluates extendscript code defined in file, returning value of last statement. after execution, global functions , variables defined in jsx file become global functions , variables in host application's scripting environment.

 

_adobe.includejsxfile( path )

 

 


 

scriptfile      string. required. path extendscript (jsx) file in panel’s

assets folder.

 


 

 

differs _adobe.invokescriptfile() in returning value of last statement in script, , in inclusion of globals in host’s scripting environment. after have included extendscript file, can use _adobe.jsxinterface.call() to invoke global functions defined in it.

 

_adobe.jsxinterface.call()

 

invokes global function in host application’s scripting environment.

 

_adobe.jsxinteface.call( functionname[, ...args])

 

 


 

functionname    string. required. name of function call.

 


 

args            optional. 1 or more arguments pass through function call.

 


 

you can use _adobe.includejsxfile() to include global functions in host’s scripting environment, , invoke them call.



More discussions in Configurator


adobe

Comments

Popular posts from this blog

how to devide a circle into equal parts

"Could not fill because there are not enough opaque source pixels" - not solved by any other thread

Why can't I change the billing info for my account?