Pass arguments to javascript from plug in...
Hi,
I m using InDesign CS3 on MAC OS...
I have a plugin calling a javascript. I need to pass a string value from the plug in to the script...
I found that there is a parameter in the method RunFile in IScriptRunner.h for this purpose... But i don kno how to use this...
virtual ErrorCode RunFile(const IDFile& idFile, IScriptEventData* data, bool16 showErrorAlert = kTrue, bool16 invokeDebugger = kFalse) = 0;
where,
@param data is used to pass arguments and return the result IN/OUT
What does this IScriptEventData* data carry???
How to pass a string value as argument to javascript from plugin code and how to retrieve and use it there...
Is there any sample code for this?
Someone pls guide me...
Thank you.
Are there other command line options with extendscript, like compile to jsxbin etc.. Where is this documented?
UDevp wrote:
I used the below command to run script from command prompt, I'm able to run the script but not able to pass arguments to the script.
"C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit CS4\ExtendScript Toolkit.exe" -run "C:\Program Files\Adobe\Adobe InDesign CS4\Scripts\test.jsx"
Any suggestion would be helpful..
It may be possible to edit prefs file with command line and to check file in script.
Similar Messages
-
How to pass parameters to javascript from HTMLB Button Click
Hi Experts,
I am using a HTMLB Button, I need to pass parameters to JavaScript onClientClick.
Whether we can pass parameters to javascript function from HTMLB button.
I tried to pass parameters to javascript in onClientClick, but on load of the page it is saying that its a Syntax error.
This is the code that i have created Script
Note: The parameters and the Button are dynamically created. Also there are n Numbers of buttons created.
Please help me in this regard to solve the issue. If there are any error in syntax please let me know.
Thanks & Regards,
PalaniRather than using SQL loader, you could just use similar syntax in an external table definition. It both cases, the file may need to be at the OS level.
http://www.psoug.org/reference/externaltab.html
If your file is stored in an Apex table's clob column, you can just loop through the individual lines (but then need to parse the lines yourself). See clob2line here http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:285215954607#388438800346703098
Or you can dump the clob to the OS first (using utl_file or dbms_lob), and then read it back using external table, taking advantage of your control file definition. sqlloader has the disadvantage of needing user/pass usually.
http://www.psoug.org/reference/dbms_lob.html
http://www.psoug.org/reference/utl_file.html -
Passing values to javascript from database
hi friends,
I have to fetch values from the database and pass the values to the java script variable.
I tried this, but is not working. When i place the script inside the java, it isnt working. Iam passing value to this script variable as argument to a function. This is my code:
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
while (rs.next())
for (int i = 1; i <= numberOfColumns; i++)
count=count+1;
if (i > 1)
columnValue = rs.getString(i);
%>
<script>
var hcbList = [<%=request.getParameter("columnValue")%>];
</script>
<%
System.out.println("");
st.close();
%>
Pls solve the problem. Its very urgent!
thanxKeep this in mind: JSP is source generation software.
In other words JSP generates the HTML and/or Javascript that will be rendered on the browser. So What you need to do is keep the JSP and Javascript separate in your mental picture. You ask yourself, "what would the finished Javascript code look like that would give me the results?" Then you apply JSP as a template to fill in the blanks. In your example you want a list or an array of values in your Javascript. I don't use Javascript to often but from memory I belive an array in Javascript is something like this:
<script>
var hcbList = {"val1", "val2, "valx"};
</script>That's what the finished Javascript would look like. Now you apply JSP as a template.
<!-- This is the fill-in-the-blank template
<script>
var hcbList = {<%=insertArrayHere%>};
</script>Now you fill in the blanks
//insertArrayHere is your blank
String insertArrayHere = "";
//iterate over the collection and build a string that represents the JS array
for(int i = 1; i <= numberOfColumns; i++)
//wrap each value with quotes if it is to be a JS string
insertArrayHere += "\"" + rs.getString(i) + "\"" + ","; //terminate with a comma
//trim the last comma off the array guts
insertArrayHere = insertArrayHere.substring(0, insertArrayHere.length() - 1); Now I'm sure that's not exactly what you want because it looks like you got some crazyness going on in your logic. I don't know how you can query the using values from the database. Anyhow it poses as a good example of how to apply the concept of the two technologies. (Also, why are you doing a System.out from JSP? You should be calling log() if you want console output.) The whole idea is that JSP can NOT talk directly to Javascript. It can only generate Javascript dynamically before it is received by the browser. -
How to pass arguments to script from plugin
Hello there....
I want to run a script from my plugin. To do this, I want to pass some arguments to the script. How can I do this? I also want to know how those arguments can be read in script?
Thanks in advance..Here is a simple example of how to run some script code from a plug-in.
InterfacePtr scriptManager(Utils()->QueryScriptManager(kJavaScriptMgrBoss));
if (!scriptManager)
return;
InterfacePtr scriptEngine(scriptManager->QueryDefaultEngine());
if (!scriptEngine)
return;
InterfacePtr scriptRunner(scriptEngine, UseDefaultIID());
if (!scriptRunner)
return;
RunScriptParams params(scriptRunner);
scriptRunner->RunScript("alert('hello from planet script!');", params);
Replace "alert(...);" with your own script. -
Passing arguments to JVM from eclipse
When running a program from eclipse, I get an error like java.lang.UnsatisfiedLinkError: no driJNI in java.library.path
I tried the -Djava.library.path={whatever} in the VM arguments. However, I still get the error of unsatisfied link. When try setting the property in the code with:
System.setProperty("java.library.path","{whatever}");
System.out.println(System.getProperty("java.library.path"));
the output remains : null.
anyother suggestions? if i just use command line the problem goes away. however, i'd like to be able to make eclipse work.
Thanks.It is called a here-document, as in "The Document is Right Here".
anycommand_that_reads_stdandardin <<UNIQUE_STRING
stuff to be
read by the
command via
its standard input
UNIQUE_STRING
The typical convention is to use EOD for the unique string as in End-of-Data, but any string that will NOT occur in the body of the text starting in column 1 is fine. And keep the string simple, no spaces, tabs, funny characters, etc...
This is similar to putting all of the text between the <<EOD and EOD into a file and then invoking the command with:
anycommand_that_reads_stdandardin <file.with.data
The advantage of the here-document is that you do not need to have a separate file, or do a bunch of echo statements into file so you can pass it as input to the command, and then remember to clean up the temp file later.
In addition, the here-document allows shell substitutions to occur, which is just what you needed for your osascript work.
If you are intrested in shell scripting, you might spend some time in a book store, drinking coffee while browsing some of the books on learning bash, or if you can find it, "Learning Unix for Mac OS X Tiger". If you enjoy it and find any of the books useful to you, grab your credit card and head to check-out -
Passing arguments to osascript from the command line
I'm just learning how to use the Terminal at the moment and was wondering if anyone knew how to pass parameters from the command line to Applescript via osascript. I'm trying to use this as a function embedded in my .profile file so I don't have to type out the whole line each time I want to use an Applescript.
Just as an exercise, I'm trying to get osascript to pass a string of text to a dialog box using 'tell application "Finder" to display dialog "$1" '. But all this does is open a dialog box with "$1" in it! Anyone know how to get this to work?Neyüm wrote:
I'm just learning how to use the Terminal at the moment and was wondering if anyone knew how to pass parameters from the command line to Applescript via osascript. I'm trying to use this as a function embedded in my .profile file so I don't have to type out the whole line each time I want to use an Applescript.
Just as an exercise, I'm trying to get osascript to pass a string of text to a dialog box using 'tell application "Finder" to display dialog "$1" '. But all this does is open a dialog box with "$1" in it! Anyone know how to get this to work?
http://discussions.apple.com/forum.jspa?forumID=735 -
Passing arguments from Air to Photoshop jsx script
I would like to invoke JavaScript file in Photoshop from my Adobe Air application. I managed to call my script with the following code:
// Create native startup info
nativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartupInfo.executable = filePhotoshop; // File referencing Photoshop exe
// Create Vector array to pass arguments
procarg = new Vector.<String>();
procarg.push("start");
procarg.push(jsFileToCall);// String with path to my jsx file
procarg.push(scriptData); // String with argument to pass to jsx file
nativeProcessStartupInfo.arguments = procarg;
// Create native process object for calling executable file
process = new NativeProcess();
// SET ERROR HANDLERS
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);
process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR ,onError,false,0,true);
process.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR ,onError,false,0,true);
process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR ,onError,false,0,true);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA ,onError,false,0,true);
// CALL NATIVE PROCESS
process.start(nativeProcessStartupInfo);
The Photoshop app is started, my JavaScript is invoked, but the argument is not passed into jsx.
Is there any method how to pass arguments to script in Photoshop? (I know that I can use the file to pass the parameters, but I do not like that solution.)
Thanks in advance for any hint.
Zdenek MThe only documented way I know of is programming the script as a Photoshop Plug-in that has a dialog. Then record using the script in an action. The script will record the arguments used in its dialog into the Photoshop Actions step. Then when the action is used played the action recorded arguments are retrived and the script bypasses displaying its dialog.
However In CS3 I looked at Adobe Photoshop Image Processor JavaScript it internaly used the Fit Image Plug-in Script and passed the width and hight to it. So it is posible to pass arguments from one JSX to an JSX Plug-in Script.
From CS5 "Image Processor.jsx"
// use the fit image automation plug-in to do this work for me
function FitImage( inWidth, inHeight ) {
if ( inWidth == undefined || inHeight == undefined ) {
alert( strWidthAndHeight );
return;
var desc = new ActionDescriptor();
var unitPixels = charIDToTypeID( '#Pxl' );
desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
executeAction( runtimeEventID, desc, DialogModes.NO );
If You can write a file from Adobe Air you could also write the jsx file to pass the args you want to pass a to plug-in script via the ActionManager. -
Passing arguments to the jsx file from command line
Thanks for taking my question.
I am using the following to be able to run my script from the command line.In case you were wondering on why i would be doing this- i would need to invoke the javascript from a server side code(like java,php etc. in my case it is java)
"c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx"
Anyways, i have been successful in running the myscript.jsx from the command line but i am not able to figure out how i could pass arguments to "myscript.jsx" from the command line, and be able to refer to these arguments within the script.
I have tried the following
"c:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" "c:\path to script\myscript.jsx" "argument1" "argument2"
and tried to refer these arguments within the script using arguments[0] and arguments[1] . But looks like this does not work.
Any thoughts?????To run JavaScript from the prompt using ExtendScript Toolkit 1.0.3 or 2.0.2 you need to do the following:
Add the line #target indesign to the top of your script otherwise ESTK will open without executing the script. Example:
#target indesign
//MakeDocumentWithParameters.jsx
//An InDesign CS2 JavaScript
//Shows how to use the parameters of the document.open method.
//The first parameter (showingWindow) controls the visibility of the
//document. Hidden documents are not minimized, and will not appear until
//you add a new window to the document. The second parameter (documentPreset)
//specifies the document preset to use. The following line assumes that
//you have a document preset named "Flyer" on your system.
var myDocument = app.documents.add(true, app.documentPresets.item("Flyer"));
//SaveDocumentAs.jsx
//An InDesign CS2 JavaScript
//If the active document has not been saved (ever), save it.
if(app.activeDocument.saved == false){
//If you do not provide a file name, InDesign will display the Save dialog box.
app.activeDocument.save(new File("/c/temp/myTestDocument.indd"));
Ensure Indesign is open. Execute the following command:
"C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" -run "[path to script]\script.jsx"
For example:
"C:\Program Files\Adobe\Adobe Utilities\ExtendScript Toolkit\ExtendScript Toolkit.exe" -run "C:\Program Files\Adobe\Adobe InDesign CS2\Presets\Scripts\test.jsx"
This command can be easily called from Java or any other third party application of your choice.
It took me a while to find this information, so I thought I'd share it with everyone.
Good luck! -
How to run a java class from a shell script with passing arguments
hi,
I have a jar with all the required classes. I was using ant to run the classes i needed.
But now i want to use a shell script to run the class, also the class accepts some arguments so when script is run it should accept arguments.
So can any one tell me how to set class paths, jar location and call the required class from shell script or batch file with passing arguments to it.
Thanks in advance.Let's say that the order of arguments is as below
1. Jar file name
2. Classpath
Your shell script would look like this
java -cp $CLASSPATH:$2 -jar $1 I am assuming that your jar file has the required main-class entry in its manifest. Note that $1...$9 represent the arguments to this shell script.
The same goes for a batch file
java -cp %CLASSPATH%;%2 -jar %1 -
Can I run javascript from a plug-in ? I'd like to change some document features when my plug-in finishes. Is this possible ? If so how ?
Thanks,
MattAlmost every object inside an InDesign document can have a label. In JS, simply use
>[whatever].label = "Your private data";
where "whatever" is anything from Application, Asset, AssignedStory, Assignment, Behavior, Book, BookContent, Bookmark, Button, Cell, CellStyle ... and so on (about 100 items).
The string may be any string you want, of any reasonable length (I remember seeing a limit of 32,767 characters somewhere). -
How to pass a value to javascript from flash using externalinterface
hi,
i'm currently trying to call a javascript function and pass values to it. but i'm not really familiar in using the addcallback since i only tested on calling a function from flash without passing anything to the function.
Basically, i'm going to retrieve the values of a node from xml.
and then i will assign those values to a variable in flash.
now what i'm going to do next is pass this value to a javascript parameter..is it done using externalinterface?
Could anyone give me an example.
I just need to throw the value to the javascript function parameter and no return values to the actionscript.
The event is that whenever an image is click, the corresponding value for each image is passed to the javascript function.
here is my unfinished script.
function imageClicked(e:Event):void {
for each (var imageURL:XML in xml.images.link_to)
ExternalInterface.call("TestButton",imageURL);
thanks so much in advance.first, it seems that the 'TestButton' funciton in JS will be called several times when an image is clicked - for each loop in the 'for each' loop you wrote.
second, in order to test the communication between AS and JS, try starting with something simple, like -
ExternalInterface.call('alert', 'OK');
if this doesn't work try tracing the ExteranlInterface.available property/
if it does work, place an alert within the 'TestButton' in the JS code, to see its actually being called.
and so forth...
good luck,
eRez -
How to execute adobe air app & pass argument from Flex ?
Helo everyone,
May i ask a question, How to execute adobe air app & pass argument from Flex ?
Thanks in advanced.
Jacky Ho.Hello Jacky,
You can find an example here
http://spreadingfunkyness.com/passing-parameters-to-adobe-air-at-startup/ -
How to pass arguments from PAPI to the process
Can any one tell me How to pass arguments from PAPI to the process.
The link Creating a new work item instance in a process using PAPI shows how to create instances on PAPI and pass in the variable information as they are being created.
Provide some additional detail if you're interested in seeing how to pass in variable information using PAPI for scenarios other than instance creation.
Dan -
Warning: passing argument 2 of 'setValue:forKey:' from distinct Objective-C
I want to keep my projects warning free. In the following line
[tempValues setValue:@"Some Text" forKey:[NSNumber numberWithInt:0]];
the compiler complains with an
"warning: passing argument 2 of 'setValue:forKey:' from distinct Objective-C type" warning.
tempValues is an NSMutableDictionary.
Any idea how to resolve this warning?Essentially, the typical rationale behind this particular warning is: The compiler must not let you write code that seeks to modify a non-modifiable object without giving some warning.
Are you in effect trying to modify a non-modifiable object?
Remember...(and I quote because I'm too lazy otherwise) "When you have a variable of type NSMutableArray*, then anyone would think that the array it points to can be modified. So if this variable contains a pointer to an actual non-mutable array, that would be a recipe for disaster, because any attempt to actually modify the array would fail in some way. For that reason, Objective-C must not just allow an assignment assigning an NSArray* to an NSMutableArray* variable.
The other way round is harmless: Anyone looking at a variable of type NSArray* would think the array cannot be modified and therefore won't try to modify it. If the actual object is an NSMutableArray, no harm is done." -
I need to call a batch file from java and pass arguments to that Batch file
Hi,
I need to call a batch file from java and pass arguments to that Batch file.
For example say: The batch file(test.bat) contains this command: mkdir
I need to pass the name of the directory to the batch file as an argument from My Java program.
Runtime.getRuntime().exec("cmd /c start test.bat");
How to pass argument to the .bat file from Java now ?
regards,
Krish
Edited by: Krish4Java on Oct 17, 2007 2:47 PMHi Turing,
I am able to pass the argument directly but unable to pass as a String.
For example:
Runtime.getRuntime().exec("cmd /c start test.bat sample ");
When I pass it as a value sample, I am able to receive this value sample in the batch file. Do you know how to pass a String ?
String s1="sample";
Runtime.getRuntime().exec("cmd /c start test.bat s1 ");
s1 gets passed here instead of value sample to the batch file.
Pls let me know if you have a solution.
Thanks,
Krish
Maybe you are looking for
-
"mode not supported"ATV3 VGA Kanex ATV Pro
hi Apple TV3 Samsung LED projector via VGA Kanex ATV Pro VGA-HDMI convertor Macbook Mavericks all i get is mode not supported? ta JJ
-
The next page in not displaying in the SAP Script
Hello, I had one SAP script. There were two pages in the script and i mentioned the next page also for the FIRST and NEXT page as First - next page --> next and next -- next page --> next Now, I am having 3 items which needs to be gets displayed usin
-
My dad bought an iPhone 4S, and I have the exact same model. Neither of us have the iOS6 update. His phone has 4G, mine doesn't. He also has more features than I. Why is that?
-
Hello Can anyone help me with information about how integrate Wonderware Software Inbatch with SAP ERP. Any experience?. Any consultant in Barcelona? Thanks.
-
My iphone 6 appears to be incompatible with my Volkswagen Passat sound dock
I've tried a 30 pin to 3.5 connector and a 30 pin to lightning connector and neither work. I was using a 30 pin male/female connector with an iphone 4s and it worked well. Is there a problem with the new phone?