How to make at startup script that fits spread on open
Hi there,
Does anyone know how to make a startup script for InD CS6 that fit spread too screen when document open?
I've tried this and it works but I've get a dialog that says "Object is not valid":
#targetengine "session"
main();
function main(){
var myEventListener = app.eventListeners.add("afterOpen", excuteScript);
function excuteScript(){
var myD = app.documents[0];
app.layoutWindows[0].zoom(ZoomOptions.FIT_SPREAD);
Hi Jump_Over and thank's for reply.
I'm a total newbie when it comes to scripting.
Can you show me how you mean?
Jonas
Similar Messages
-
How to make an 'order' button that works?
How do I make an 'order' button, by clicking on it, will post a pre-defined product number in a contactform?
Probably I have to use php, but I do not know how to make the correct script.
Regards, GeraldIf you just need it to pop text into a textfield, you can use javascript, something like this might do the trick for you...
<textarea id="TheText"></textarea>
<select id="DropDown">
<option value="">None</option>
<option value="text-one">Choice One</option>
<option value="text-two">Choice Two</option>
<option value="text-three">Choice Three</option>
<option value="text-four">Choice Four</option>
</select>
<script type="text/javascript">
var thetextbox = document.getElementById('TheText');
var mydropdown = document.getElementById('DropDown');
mydropdown.onchange = function(){
thetextbox.value = this.value;
</script>
The script should come after the textbox and dropdown in your HTML. -
How to make a Java program that recognises a function of two variables...
How to make a Java program that recognises a function of two variables to assign values to that?
First I will give an example and then do the question.
Ex1.
We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
To build the graph of this function attach values to 'x' to find the values of 'y'
And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
We can use any numbers, but arfer interval [-3.3]
X | y = x ^ 2 + 1
-3 | Y = (-3) ^ 2 +1 = 10
-2 | Y = (-2) ^ 2 +1 = 5
-1 | Y = (-1) ^ 2 +1 = 2
0 | y = (0) ^ 2 +1 = 1
1 | y = (1) ^ 2 +1 = 2
2 | y = (2) ^ 2 +1 = 5
3 | y = (3) ^ 2 +1 = 10
We then ordered the pairs:
(-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
Tabem that can be represented by a table:
X | y
-3 | Y = 10
-2 | Y = 5
-1 | Y = 2
0 | y = 1
1 | y = 2
2 | y = 5
3 | y = 10
Now I begin to explain my doubts.
See this program:
Ex2
* To change this template, choose Tools | Templates
* And open the template in the editor.
Encontrando_o_valor_de_y package;
* @ Author des Soldat Gottes
Import javax.swing.JOptionPane;
Public class (Main
* @ Param args the command line arguments
Public static void main (String [] args) (
Int x, y;
String x1;
X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
"Assign a value for 'x',"); / / receives a value for the function y = x + 1
X = Integer.parseInt (x1); / / tranforma String in int
Y = x + 1; / / receives the value of 'x' and calculates' y '
JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
/ / Displays the value of 'y'
System.exit (0);
We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
"Assign a value for 'x',");
The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
The question is: would it be possible to come to a function?
Ex: the program ask: DIGITE THE FUNCTION?
The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
And then to find the values of the x and y launch a table.
It would be possible that?
By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
I hope it has been easier to understand my doubts now.
Thank you for your attention!
God bless!rafaelmenezes wrote:
Thanks for the explanation, could understand what fly said.
But as it applied to a program?
How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
Strip out the spaces
Split the String on "x^"
That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you. -
I want to know how to create a new script that can be run in batch proces in Photoshop Element 11 ?
Have a look at the menu file/process multiple files. You can choose to add your signature (or the caption) to the image and export the new files.
If that solution is not flexible enough, consider using the very affordable (12$) Elements+ add-on which offers a 'meta stamp' script :
http://elementsplus.net/v5/en/meta-stamp.htm
Otherwise, have a look at other free and good solutions like Faststone Photoresizer, Xnview... -
How to make a Java application that will change the client box's IP address
HI how to make a Java application( that application would be run on the client ) that will change the client box's IP address ( IP address of itself )
If you can do that through the command line, then use Runtime.getRuntime().exec(...) to execute your command.
-
How to make a slide bar that controls opacity
I'm trying to figure out how to make a slide bar that would control opacity. If I were to take to pictures on top of each other, the slide bar would control the opasity of the top image. Thanks
can you make a slider that controls anything? if so, what's the range you can control?
ie, when the slider is at one extreme it causes some object to have value1 and when it's at the other extreme the object has value2. what value1, value2 can you handle? -
How to make the same code that works only?
how to make the same code that works only?
code:
Form2.Close = Me.Enabled = true
effect such as this codeI have this code:
Public Class Form1
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Form2.Show()
Me.Enabled = False
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Form3.Show()
Me.Enabled = False
End Sub
End Class
he wants to after closing Form2 and Form3 unblocked the whole form1
it means that:
when I click the button, displays the himself form2 and blocks himself form1" and after closing Form2 , unlocks himself Form1"
the same with Form3 -
How can I create an icon that when clicked will open and maximize an image file?
How do I create a icon that when clicked will open and maximize an image file? I have tried to use the simple image widget with maximize upon tap/click - however I am can only size the image really small and put on the page. I'd prefer to have a graphic that when clicked it simply opens up the image. This is for a very simple question/answer book. The user is suppose to look at a picture and locate something. I want to put an 'Answer' graphic on the image and then the user can click the 'answer' graphic and it will open up the picture with the answer identified.
Is this possible?Have yiu tried the PopOver widget? You can drop an image into it, maximise the image and the widgets window...But, you cannot get it full screen.
With iBooks Author, you either learn to use what is available within the app, or look online for third party widgets to purchase which suit your project. -
Hi,
I'm making a batch processing action and I really need a script that iterates through all open documents, finds the one with the biggest image size and then iterates one more time to change the rest of the documents to the same image size dimensions. At the end all documents must share identical image size. I'll really appreciate if someone can put a quick script for doing this. Thank you !I think should do…
#target photoshop
if (documents.length > 1) {
var smallest = 1000000; // Set beyond any size you may be expecting this should do?
for (var a = 0; a < documents.length; a++) {
smallest = Math.min(smallest,documents[a].width.as('px'));
for (var b = 0; b < documents.length; b++) {
if (documents[b].width.as('px') != smallest) {
app.activeDocument = documents[b];
var newWidth = new UnitValue(smallest, 'px');
documents[b].resizeImage(newWidth,undefined,undefined,ResampleMethod.BICUBICSMOOTHER);
}else{
alert("NOT enough docs to resize?"); -
How to i write a script that makes multiple selections in a pdf and exports them to excel?
I have a large number of PDFs
Not all the PDFs contain information we need. We want to be able to automate a script that extracts certain info from the PDFs and opens them in a certain format in excel.
Acrobat allows me to make a single selection and export as excel.
How do i export multiple parts to excel from the pdfs and ensure that the resulting excel is in a format that i can use without much fixing needed (e.g. merged cells)?This type of process can't really be done using JavaScript. You would need to read the contents of the file, word by word, decide (based on some logic) what data to extract, and then collect it and at the end export to a plain-text file. Not a simple process...
-
How can I autorun a script that will process an XML file on open?
I am using Frame 11. I have a registered script that looks for event notification Constants.FA_Note_PostOpenXML. When this event fires, the script is supposed to examine the root element (so I only edit appropriate XML files), then make some edits to the file. Specifically, I want to be able to delete empty pages, remove room for side heads, and fix table formatting (such as left indent, which I can't directly access, apparently, in the EDD or R/W rules). The snippet of code that starts doing the work follows:
Notification(Constants.FA_Note_PostOpenXML,true);
function Notify(note, object, sparam, iparam) {
switch (note) {
case Constants.FA_Note_PostOpenXML:
doTheWork();
break;
function doTheWork() {
var doc, flow, root, elemName, mPageAttrib, topicElem, topicElemName, allAttribs;
doc = app.ActiveDoc;
flow = doc.MainFlowInDoc;
root = flow.HighestLevelElement; // will always get something even if unstructured document
while(root.ObjectValid()) { //only do something for structured docs
elemName = getElementName(root);
...more code to do stuff....
I then check the root element name, and if it matches, I make some changes. This code works fine when run manually. But, when run as a registered script, the app.ActiveDoc object is invalid, and there is no structure to edit. (I added debug line if(!doc.ObjectValid()){alert("not valid");}, which is not included above.) It appears that the Constants.FA_Note_PostOpenXML event fires as soon as the XML file is opened, but BEFORE Frame actually reads it.
Does anyone have any recommendations on how to work around this? Is there another event I could use instead of Constants.FA_Note_PostOpenXML? Is there any other way to automatically manipulate an XML file when it loads?
Thanks in advanceThe Notify event receives four parameters: note, object, sparam, and iparam. For the event you are using, object should be the document object of the FrameMaker document being opened. So, you should be able to use this:
doTheWork(object);
Make sure you update your doTheWork function to receive the Doc object:
function doTheWork(doc) {
var flow, root, elemName, mPageAttrib, topicElem, topicElemName, allAttribs;
flow = doc.MainFlowInDoc;
root = flow.HighestLevelElement; // will always get something even if unstructured document
while(root.ObjectValid()) { //only do something for structured docs
elemName = getElementName(root);
...more code to do stuff....
-Rick -
How to make a calc script on a dense dimension ?
Dears,
I want to make a calculation script on a dense dimension where :
- I want to get an input from a member, then make a mathematical calculation , then populate the result in another member at the same dimension .
For More Clarification :
I have the following fix
CALC ALL ;
FIX ("SAR","Working.V01","Budget2012","FY12","G_10","NM_CAT01","Employee General","BegBalance")
"Internal Transportation" = "Monthly Transportation"*30 ;
ENDFIX
-Internal transportation and monthly transportation are 2 members on FB_account dimension (dense dimension) .
Waiting for your response, Thanks in advance.Dear ,
I appreciate your feedback . But, My problem is that after executing the calc script , No calculation happens .
by another means ,
-If I wrote "Internal transportation" = 500 ; --> It put 500 in it
-If I wrote "Internal transportation" = "Internal transportation" * 100 ; --> No calculation happened but it executed successfully
-if I wrote "Internal transportation" = "Monthly transportation" = 500; --> No calculation happened but it executed successfully
I don't know Why ??? -
How to Make a Line of Best Fit/Best Fit Line/Trendline in iWork Numbers '09
I'm not sure if this is well-known or has been answered elsewhere already, but multiple Google searches have not shown this solution on how to create a line of best fit in Numbers '09 (there is another method that involves drawing a line yourself, but this is much easier and more accurate).
I stumbled across this trying the above self-draw technique and got so excited I wanted to post the technique. So here is what you do:
1) Type out your X and Y data
2) Select the data and select Charts, then select the Scatter Plot
3) Open up Inspector and select the Chart tab
4) Select the "Series" tab below the picture of the Scatter Plot and the "Chart Colors..." button
5) At the bottom of the Inspector window, open the "Advanced" arrow
6) Select the "Trendline" tab and select the "Linear" trendline from the drop-down bar
That's it! You can even select the options to show the line equation or the R-squared value!
Here is a picture of the selected options and what your graph should look like (check that nice R-squared value!).
http://i.imgur.com/AvfPv.png
I hope this helps and hope it moves up to the top of the Google search page for this feature.Hi Asclepius37,
Why not just search "trend" or "trendline" in the Numbers '09 User Guide?
That would take you to page 149 of the guide and the article "Showing Trendlines in Charts," which lists a set of instructions very similar to those in your post.
The Numbers '09 User Guide and the iWork Formulas and Functions User Guide are searchable pdf files, and may both be downloaded through kinks in the Help menu in Numbers. Both are excellent resources to have on hand.
Regards,
Barry
PS: Searching "best fit" will return zero results, but "best" or "best-fit" will get you to the same article.
B -
How to make an insert script for CLOB data types?
I need to have an insert script for Oracle 11g where I insert large texts into a CLOB field
I exported data from a source table using TOAD's export dataset and the insert statements option, so it generates a script of just simple insert into statements with the clob strings in the values clause within single quotes.
While most of the inserts succeed, several fail with the error: string literal too long
How can I insert long texts into clobs?
One workaround I was considering, is maybe breaking up those inserts which are too big, so that it inserts a chunk, and then does an update to append additional chunks? not sure if that would work either
first wanted to get any ideas from the oracle experts here in case there is a much easier, non-manual labor intensive way.Thank you for that informative link, Raj
I wouldn't be able to use SQL Loader for this though, this is something that gets submitted to a DBA in a request and it must be in a script that can be run in Sql Plus, and it cannot pull it from a table or file. -
How to make a java program, that can be used by c++ application
I'm developing a Java web application (WEBapp), but I have also a c++ program.
C++ program must use WEBapp method to communicate on the web.
How to make a Java public function that accept value, elaborate, then return the resul to c++ application?jschell wrote:
You have C code.
You have Java code.
The two must communicate.I have a c++ program, and a Java program.
C++ program wants to communicate on the web (send text), and I'm trying to add this functionality to it creating a Java program.
NOW THE PROBLEM? How c++ program can use java-program (in local) to send data on the web?
You can just JNI to communicate either from java to C++ or from C++ to java. That is direct communication in that there is a single process involved. Thus you will no longer have a java application and a C++ application but rather a single application.I don't know JNI, i found http://java.sun.com/docs/books/jni/ and I think is too difficult to implement?
You can use files or sockets to communicate. Using sockets allows for any number of additional protocols including the previously mentioned web services. Those methodologies would allow more than one application to exist.I developed yesterday a java-side-interface using socket (in local host 127.0.0.1). So the c++ program must write or read to/from the socket to comunicate to java (then the java program send data on the web).
Finally it might be the case that you have a C++ application which you cannot modify. In that case then you MUST use whatever input/output mechanism that it supports. There is no choice. And until you have fully determined what those mechanisms are it is pointless to discuss a solution.I can modify the application, but I don't have developed it. The c++ application use a third-part dll (taken from SKYPE) to comunicate on the web: I have to remove the dipendence from this dll, and add the java program: java program must substitute the dll. It must be non-invasive to the c++ program. DLL calls can be "send(data)" or "receive(data)" or similar.
For this do you think that JNI is a must, or I can use soket on local host?
Maybe you are looking for
-
I need help using multiple content types in a wiki page library
I currently trying to used multiple custom content types based off of the wiki page content type in one wiki page library. EDIT: "Allow management of content types" has been enabled with the designer The way i would like this library to work is: Cli
-
I can no longer leave an app review in the iTunes store
I can no longer leave an app review in the iTunes store. After I sign in, and want to leave a review I get the following message: "You must own this item to write a Customer Review. In order to write a Customer Review for this item you must have purc
-
What's the differece between BI client 000 and 001 ?
Hello exports, We copy the client 000 to client 100, then we done the configuration "Integration into Portal " at client 100. But we can't success, we found that client 100 miss 7 system users( J2EE_ADMIN,SAPJSF,SLDDSUSER and so on). After we create
-
Sudoku and Mahjong Error mesages
5th Gen iPod 80Gb with video software ver: 1.2.3 (current) Win XP Pro w/SP2 iTunes ver: 7.6.0.29 (Current) Problem: Sudoku and Mahjong Both games have worked well in the past. No problems! Lately they will not even load /run on the iPod. I constantly
-
my ipod tuch is disabled and it wont me to canect it to itunes but i cant find the icon for it on the desck top on my computer my computer is a emac plz help me