[CS3 JavaScript] Value or reference to an object

Hi all

My programming experience was not oriented object C when I was very young, I remember vaguely that it seems always easy to know if a function or an expression will return a value or a reference to an object.

Here is an example. When I take in corrections to the InDesign files, I often do a very quick search, down where the insertion point is at the end of the story, but only with depression a keyboard - not having to click, click on and type in the find/replace clean with InDesign dialog box. So I wrote a quick script to do this, where you can enter a search string.

But trying to isolate the text range to search is difficult.

mySelection = app.selection [0];

textrangeToSearchWithin = mySelection.parentStory.characters.itemByRange (mySelection.index, mySelection.parentStory.characters.length - 1);

The itemByRange() method that above seems to return a string, not a reference to the object in InDesign itself. I tested this by finding the name of the manufacturer of its parent and the parent - both seem fair. But referring to the object in InDesign itself is required if I am looking in the range of text using the InDesign findText() method and then determine what is the index in the history of the first found occurrence.

Can I force itemByRange() to return a reference? And a more general question, how predictable returns of methods of InDesign?

My questions might be due to my not be very well versed with JavaScript rather than what it is to do with InDesign, but I couldn't find answers on the ' net.

Bye bye

Paul

itemByRange can take some getting used to. The way you used it, it

Returns a character-table object (it's pretty hard to explain).

You can change that in a normal array of characters with

getElements();

A better way to get a range of text is:

mySelection = app.selection [0];

textrangeToSearchWithin =

mySelection

. parentStory.texts.itemByRange (mySelection.characters.item (0),)

mySelection.parentStory.characters.item(-1));

Substances

Tags: InDesign

Similar Questions

  • Is it possible to have a reference to an object?

    LabVIEW class. Is it possible to have a reference to an object? Is it possible to get a reference to an object and run the reference methods? I thank.

    See the data value reference

    If that wasn't enough, explain what you are trying to do more in detail.

  • A dynamic event - handle the two event 'user' and "value change" reference

    Hello everyone,

    I'm trying to manage in a structure unique event two upcoming events of the change in value of references and user events.

    However, these two types are looking for bundles. Someone has already tried to do something like that?

    Thank you

    Alessandro

    Do not use 2 register for events in a single node node add events and the Coachman.

  • LV Scripting how to get all references to schema object.

    Hello

    I'm trying to find a way to get a list of all the schema for a VI object given.  I tried the 'Plan - [AllObjects]' method, but this function returns references to key objects in the diagram, not all the objects recursively, which are inside these main objects.  Is there a method to do? If not, is there a way to do it recursively? I did not found anything so far.

    Thank you

    Michel

    Check the attached file.

    Published:

    In addition, it would be possible to make this operation recursively in the sub a high level VI VI?

    Oops I missed the recursive part, you will still be able to use the code in the attached VI, however, you must provide the references VI/Subvi of recursively.

  • DLL, interfacing with which coexist value and reference types

    Currently, I'm working with a supplied DLL.

    I have header files and everything and the DLL import wizard does a decent job of importing DLL functions but there are certain types of data that cannot simply be dealt with.

    The DLL requires the use of a data type that is a structure with data reference and value types.  I could theoretically replace the references by simple U32s, but much of the information required in the data is in the data referenced by the pointers structures.

    How can I do to implement this light how do I have to be able to transmit data to the DLL in its original form (value and reference types).

    I have something like the following:

    struct point {}

    Int device,

    * The point then

    * Previous item

    * Data Datastruct

    }

    I downloaded the Microsoft WDK, CVI and Visual Studio 2008 available.  I'm not very experienced in this end of things...   I will dispose of Structs with pure value types, but how do I get the data in reference types?

    I strongly suspect that I need a wrapper DLL, but how is the best way to go about this?

    Shane.

    Shane,

    It's always a problem when you use a DLL.

    If you do not have the sources of the DLL, you must trust the description of it.

    (Or you will have to disassemble to be sure, which is forbidden in most cases )

    If (in your case), the linked list is handled elsewhere than your Labview code, you will get in trouble. (Added, deleted, or modified items)

    I don't know your DLL. But usually the data is stored inside the DLL. For example, I have a DLL function that reads a counter from a DAQ hardware. If I reset it (on its reset settings), it sends back the nuber of counted events. This DLL must not be initalized.

    Other hardware DAQ I use must be initalized using its DLLS before you read all the values.

    It all depends on the implementation of your DLL.

    You have a detailed description of your DLL?

    Balze

  • ORA 38818: Illegal reference to the object as

    Hi people,

    In our environment 12.2, we try to create MATERIALIZED view and we receive, "ORA 38818: Illegal reference to the object as APPS.abc.

    We already recorded our custom pattern by Doc-ID 1929668.1 .

    Kind regards

    Ali

    Hello Ali,.

    Please see below the reference document, it can be useful.

    ORA-38818: Mention illegal as object when creating materialized view (Doc ID 1556379.1)

    1.4.2.5 appearing in the following Document:

    Develop and deploy customizations in Oracle E-Business Suite version 12.2 (Doc ID 1577661.1)

    -Coco

  • I have to do, if this error message appears: "JavaScript exception: error calling function selector: [object Error]? It seems that by Internet Explorer. Thank you very much for your reply and I hope you can help me.

    I have to do, if this error message appears: "JavaScript exception: error calling function selector: [object Error]? It seems that by Internet Explorer. Thank you very much for your reply and I hope you can help me.

    Hi Brad,

    Here is the link: http://projektw.primo-werbung.de/

    We have this problem only by Internet Explorer. Mozilla, Safari and Opera - there is all right.

  • Value of temperory in the object view

    Dear all,

    I'm trying to set the value of in the view object temperory, because I have 2 lists drop-down town and the country where the country is defined in the table and the city is not in the set table. So to create cascading drop down list I created a temp and view object attribute assigning LOV from which it loads as LOV cascading also. All the features work very well.
    But the problem is that when I select the city (Oracle Bisnuess component browser) it gives me an exception:
    * (Oracle.jbo.ReadOnlyAttrException) Houston-27008: QueryValues_Temp attribute in the object EMAIL_TEMPLATE_MASTER_VO1 view cannot be set.*

    where QueryValues_Temp is my domain temperory... I tried to set the same field in the view object as...
    If you have any idea how should I tackle this problem?


    -Thank you

    Check the properties of the attribute - attribute view in the dialog box change the attribute - and make sure that the attribute is updateable, i.e. set it always. The exception, it seems that it is not editable.

  • The call for a Subvi without providing a reference to the objects inside the Subvi?

    Hi all

    Suppose I have a Subvi, which trace Y1 vs X 1 and Y2 X 2 vs on the same XYGraph. See attachment.

    XYGraph the property node is linked to the XYGraph. It sets the style width and point line for each curve on the XYGraph.

    If I call this Subvi 4 times in other code (make 4 diferent XYGraphs (XYGraph1, XYGraph2, XYGraph3, XYGraph4, each of which contains two lines Y1 X 1 and Y2 X 2 vs vs)).

    Why would I need to create 4 different references for 4 different XYGraphs?

    The question is really this: If the property node is explicitly linked to the XYGraph in the Subvi, why the property node must be updated via a reference if the Subvi is called

    several times to several XYGraphs? Wouldn't the Subvi take entries, draw the curves of the XYGraph, update the nodes property and then produce a final with XYGraph

    update properties?

    If there is to be a Subvi why you a graph on its façade and manipulate its properties? You will have to manipulate the properties of the chart on the front of the top-level VI. You see a graph is not a type of data - it is a display object. What is passed through calling screw terminals are given, and in this case, the data type is an array of clusters containing a table of x values and an array of values there.

    If you want to do a Subvi that performs this operation you must pass it a reference to the curve that you want to handle that one of them has entered the data values.

    Mike...

  • AEs/Single/data queues the value element references

    I'll have my CLD exam in December, and I'm just trying to 'inflate' as much as info that I can of course of the forum, alongside the preparation of the material...

    I also started to read "nuggets" pleasant and interesting too, and I hope I can get clarification for some of my issues that have emerged. (Sorry if I have a question is too noobish, trying to practice for the CLD beside my regular daily workload, and I am a little slow thinker in the night )

    I use often FGVs (and ActionEngines) in my applications, and for some "surfing and learning' on the discussion forum, OR I found this post:

    http://goo.GL/Cz1d0p

    People here recommended that the OP could use screws of wrapper which method has 2 benefits, explained here:

    "Wrap".

    http://goo.GL/J4vEIE

    My 1st question:

    I'm not really sure of what means a VI wrapper? Is this a Subvi, where the certain Subvi AE is called dynamically? I couldn't find examples showing how do (I read the entire post, but the subsequent discussion was more about OBJECT oriented programming...)

    2nd question:

    In the second post of nugget of community, there are a few closing notes, one of them: "AEs do not need a while loop." I thought AEs must also use a shift uninitialized register to store information (such as FGVs), and I need a while loop to have the shift register... Isn't it?

    question 3:

    I fall into the usual dangerous trap, jumping through different related posts, and try to understand everything at the same time but I wonder if there is a kind of basic example, which shows the three solutions (ActionEngines, SingleElementQueue, refs value data) for the same task?

    Thanks a lot for the explanation!

    PS: Sorry for using google URL shortened, but the forum of the site gives me error (Please enter a valid url) when I try to paste the normal URL...

    Martins wrote:

    question 3:

    I fall into the usual dangerous trap, jumping through different related posts, and try to understand everything at the same time but I wonder if there is a kind of basic example, which shows the three solutions (ActionEngines, SingleElementQueue, refs value data) for the same task?

    The single line of the element should not be used anymore.  Its purpose has been simplified with the value of data reference.  The concept between the two is exactly the same (reference to a single piece of memory that is locked when read until edited and rewritten in it).  The DVR uses only the Structure of the elements in Place to include the action-Edit-reading where the SEQ relied on the writer is smart enough to actually write data in the queue.

    I like the Action engines.  They are simple and keep everything in one place.  Read you from a register of offset (or feedback node), do whatever it takes with it and rewrite in the shift register (or feedback node).  The fact that it is inside a non-reentrant VI acts as your lock.

    I personally only used once a DVR in a real project and it is only to take care of some composition in my-oriented configuration object (several necessary items to refer to another shared object).  Otherwise, he has been driving Action all the way for me.

  • Find this value (ServiceUrl) in a display object

    I use this script from the reference of vSphere powercli book to empty the VM view to text to search on this topic:

    Header 1

    {ConvertTo-text function

      Param)

    [Parameter(ValueFromPipeline=$True)]

    [object []] $InputObject,

        [int] $Depth = 2,

    [switch] $FullPath = $false,

    [Switch] $ExtensionData = $false,

    [Parameter (DontShow)]

    [string] $Indent = ",

    [Parameter (DontShow)]

        [string] $Path = "

      )

    Process { }

    If ($Indent.Length - lt $Depth) { }

    foreach ($object in $InputObject) { }

              $object. PSObject.Properties | ForEach-Object-process {}

              If ($FullPath) {}

                "$($Path + '\' + $_. (Name) - $($_.) TypeNameOfValue) = $($_.) (Value) '.

              } else {}

                "$($Indent) $($_.)" (Name) - $($_.) TypeNameOfValue) = $($_.) (Value) '.

              }

              If (($_.)) Name - not "ExtensionData' - or $ExtensionData) - and $_. PSObject.Properties) {}

                $ctSplat = @ {}

                  InputObject = $object."$($_.) (Name) ".

                  Depth = $Depth

                  FullPath = $FullPath

                  Path = "$($Path + '\' + $_.) (Name) ".

                  Indent = "$($Indent)"

                  ExtensionData = $ExtensionData

                }

    ConvertTo-text @ctSplat

              }

            }

          }

        }

      }

    }

    Reject a var:

    $dump = get-View - ViewType virtualmachine-filter @{'name' = $VMname} | ConvertTo-text

    Now, I wanted to see if I can get the right VM host ESX Server name in the view VM (without having to call another opinion).

    It seems that I found but I don't know how the devil to access: (I'm filtering a lot of output)

    ...

    VMware.Vim.VirtualMachineFeatureRequirement VMware.Vim.VirtualMachineFeatureRequirement

    ...

    Length - System.Int32 = 13

    Length - System.Int32 = 15

    RecentTask - [VMware.Vim.ManagedObjectReference] =

    DeclaredAlarmState - [VMware.Vim.AlarmState] =

    TriggeredAlarmState - [VMware.Vim.AlarmState] =

    AlarmActionsEnabled - System.Boolean = False

    Tag - [] VMware.Vim.Tag =

    Value - [] VMware.Vim.CustomFieldValue =

    AvailableField - [VMware.Vim.CustomFieldDef] =

    MoRef - VMware.Vim.ManagedObjectReference = VirtualMachine-8

    Type - System.String = VirtualMachine

    Value - System.String = 8

    Customer - VMware.Vim.VimClient = VMware.Vim.VimClientImpl

    Version - VMware.Vim.VimVersion = Vim55

    VimService - System.Web.Services.Protocols.SoapHttpClientProtocol = VimApi_60.VimService

    ServiceContent - VMware.Vim.ServiceContent = VMware.Vim.ServiceContent

    > ServiceUrl - System.String = https://esxi01/SDK                                                                                                                                 

    ServiceTimeout - System.Int32 = 100000

    CertificateError - System.EventHandler'1 [[VMware.Vim.CertificateErrorEventArg, VMware.Vim, Version = 6.0.0.0, Culture = neutral, PublicKeyToken = 10980b081e887e9f]] =.

    How do I access the ServiceUrl of the notice?

    As far as I know, the ServiceUrl represents the URL of vSphere you are connected (connect-VIServer).

    This isn't the ESXi on which the virtual computer runs, unless of course you are connected to the node ESXi instead of the vCenter.

    The best way to find the node ESXi, in all cases, is to execute another Get - view on the host MoRef.

    Notice-EEG-Id $vm. Runtime.Host - name of the property. Select - ExpandProperty name

  • CS3 Javascript Application error

    Since the addition of a new site, I suddenly get the error message following which prevents me from using the application:

    JavaScript error

    On line 9 of the file "minimal: Applications: Adobe Dreamweaver.
    "CS3: Configuration: Objects:Forms:CommonForm.htm.
    :
    TypeError: thePageDom has no properties

    I have since removed the addition of managed sites site and restored the application to the version of yesterday - which none resolved the problem.

    Help, please!

    Troubleshooting step 4 here: http://www.adobe.com/go/tn_19105.

  • Help contains no description for instance through me class reference and dialog object via this

    Hi DIAdem,

    I have a tiara 2015 SP2 version.

    The Scipt VB has a possibility to refer to an instance of the current class by me. It is sometimes important and useful. It works in tiara. But it is not described in the help of DIAdem.

    Tiara provides a reference to the current object SOUTH via this. It is not described in the help too.

    Can you tell us why or you can add it to future versions of the help / DIAdem?

    Thank you.

    Hi Sasha_62

    You can use 'This' in the Calculationscript for the calculation, in the Barmanger and in the SOUTH Editor.

    You're right, 'This' and 'Me' is not or not very obvious described in the help of tiara and we will try to do better in the next version.

    Thanks for the suggestion.

    Winfried

  • Pass values to the function vs object pass to the function

    What is the best way to pass some values to the function?

    It is sufficient to indicate the characters or arrays of char etc something like this: function (float x, float [] z)

    or

    Create class (object)... say ValuesToPass vltp;  with the variables, the set and get methods.

    Assign values: vltp.setX = blah, blah = vltp.setZ

    ...  And not vltp to the function like this: function (vltp) and the values of the extract by using the get methods...

    What sense would be less time and consume of heap space?

    From my point of view - by passing the values as values would be faster, but I'm new to java and can't be 100% sure on this subject...

    Thank you

    If a method will work on three different bits of data, such as arrays of 2 char and int, so I suspect that most people would say just pass these as parameters rather than creating a "temporary" object just to contain these.

  • Creating and passing the reference to an object in j2me

    Hi, I'm new to Blackberry JDE, I want to know how to create, transmit and receive refernce for an object in Blackberry JDE.

    Exactly as its operation in j2se and Java everywhere else. Each reference to objects in Java is in function, that is to say, saying 'ButtonField f = new ButtonField()', f is a reference to a ButtonField object.

    It's all standard Java.

Maybe you are looking for

  • Problem of monitor Satellite 1410 303 after Windows XP pack 2

    After you install Windows XP Service Pack 2 on my Satellite 1410 303, a vertical strip about an inch of width is lost and remains black on the right side of the screen. Is their a way to fix it?Thanks in advanceGeorge

  • Display of RDP - Surface vs iPad

    I am considering buying your Surface for my law firm - which uses a complete environment of Ms. One of the applications we use, Profiles(a SQL-based, case management software) Client are available on the race with a RDP session. We have tried to use

  • Outlook Express 6: "Spelling" button is grayed out.

    Spell checking is disabled and I don't know how to activate it. It is a Dell Dimension 2400, Windows XP, O.E. 6. Installed WordPerfect Productivity Pack. Help please?

  • slow file write

    After installation of kaspersky internet security my system save file too slowly on the local network, what is the solution?

  • CD/dvd drive read only not all disks

    When I put a disc in the drive says that there is no disk in itI've uninstalled and restarted the computer, and used the program fixand the computer says that it works correctly as I looked to filter things and he's not here