Method to apply a style HTTP in Cascades/QML?

Something like AJAX. What is the equivalent in Cascades/QML? What classes should I Explorer in the API?

Advice would be greatly appreciated.

Applications vary.

http://someservice.com/v1/do/blah

http://someservice.com/v1/do/meh

The output of the service is JSON.

I'll take the exit and probably put it in a list (much like the sample application of stamp collector)

Help me get started at all help or sample code would be really useful. I imagine that it would be useful for developers who integrate their stunts BB10 app API or data of third parties.

Thank you!

Hello

I wrote a simple example application to show how to create an application that consumes a twitter feed and display JSON content crawled in a standard list view.

First create a new project named 'Twitter', by selecting file-> New-> BlackBerry Cascades C++ Project, and then choose the option "Empty project" Standard.

We will start by creating a class called TwitterRequest responsible for the download and let us know through the slots and signals that the twitter JSON data is available. This class must be placed in your src/folder of the project

TwitterRequest.hpp

/*
 * Copyright (c) 2011-2012 Research In Motion Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef TWITTERREQUEST_HPP_
#define TWITTERREQUEST_HPP_

#include 

/*
 * This class is responsible for making a REST call to the twitter api
 * to retrieve the latest feed for a twitter screen name. It emits the complete()
 * signal when the request has completed.
 */
class TwitterRequest : public QObject
{
    Q_OBJECT
public:
    TwitterRequest();
    virtual ~TwitterRequest();

    /*
     * Makes a network call to retrieve the twitter feed for the specified screenname
     * @param screenname - the screen name of the feed to extract
     * @see onTimelineReply
     */
    void getTimeline(QString screenname);

public slots:
    /*
     * Callback handler for QNetworkReply finished() signal
     */
    void onTimelineReply();

signals:
    /*
     * This signal is emitted when the twitter request is received
     * @param info - on success, this is the json reply from the request
     *               on failure, it is an error string
     * @param success - true if twitter request succeed, false if not
     */
    void complete(QString info, bool success);
};

#endif /* TWITTERREQUEST_HPP_ */

TwitterRequest.cpp

/*
 * Copyright (c) 2011-2012 Research In Motion Limited.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "TwitterRequest.hpp"
#include 
#include 
#include 
#include 
#include 

TwitterRequest::TwitterRequest()
{
}

TwitterRequest::~TwitterRequest()
{
}

void TwitterRequest::getTimeline(QString screenname)
{
    QNetworkAccessManager* netManager = new QNetworkAccessManager();
    if (!netManager)
    {
        qDebug() << "Unable to create QNetworkAccessManager!";
        emit complete("Unable to create QNetworkAccessManager!", false);
        return;
    }

    QString queryUri = "http://api.twitter.com/1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_n...";
    queryUri += screenname;
    QUrl url(queryUri);
    QNetworkRequest req(url);

    QNetworkReply* ipReply = netManager->get(req);
    connect(ipReply, SIGNAL(finished()), this, SLOT(onTimelineReply()));
}

void TwitterRequest::onTimelineReply()
{
    QNetworkReply* reply = qobject_cast(sender());
    QString response;
    bool success = false;
    if (reply)
    {
        if (reply->error() == QNetworkReply::NoError)
        {
            int available = reply->bytesAvailable();
            if (available > 0)
            {
                int bufSize = sizeof(char) * available + sizeof(char);
                QByteArray buffer(bufSize, 0);
                int read = reply->read(buffer.data(), available);
                response = QString(buffer);
                success = true;
            }
        }
        else
        {
            response =  QString("Error: ") + reply->errorString() + QString(" status:") + reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toString();
            qDebug() << response;
        }
        reply->deleteLater();
    }
    if (response.trimmed().isEmpty())
    {
        response = "Twitter request failed. Check internet connection";
        qDebug() << response;
    }
    emit complete(response, success);
}

Then, replace the main.qml with the following content.

import bb.cascades 1.0

Page {
    content: Container {
        background : Color.DarkRed
        layout : DockLayout {
        }
        ListView {
            layoutProperties : DockLayoutProperties {
                verticalAlignment : VerticalAlignment.Center
            }
            objectName : "basicTimelineView"
            id : basicTimelineView
            listItemComponents: [
                ListItemComponent {
                    type: "item"
                    StandardListItem {
                        statusText: {
                            ListItemData.created_at
                        }
                        descriptionText: {
                            ListItemData.text
                            }
                    }
                }
            ]
        }
    }
    onCreationCompleted: {
        cs.getTimeline("ladygaga");
    }
}

This is a simple page with a ListView with standard components, indicating the date and the content of the tweet. As you can see, immediately after that page is created a call is made in the c++ code by using the context property 'cs' set in the constructor for the App to retrieve the latest tweets of the usernamed "ladygaga". To learn more about the call c ++ QML here https://bdsc.webapps.blackberry.com/cascades/documentation/ui/integrating_cpp_qml/index.html

Finally, this linking is the App class. It uses slot machines to handle the "full" signal generated by the class TwitterRequest when data are available, analyzes the data in a model of GroupData and fills the ListView with the recovered data.

App.HPP

#ifndef APP_H
#define APP_H

#include 
#include 

class App : public QObject
{
    Q_OBJECT

public:
    App();

    /*
     * Called by the QML to get a twitter feed for the screen nane
     */
    Q_INVOKABLE void getTimeline(QString screenName);

public slots:
    /*
     * Handles the complete signal from TwitterRequest when
     * the request is complete
     * @see TwitterRequest::complete()
     */
    void onTwitterTimeline(QString info, bool success);

protected:
    bb::cascades::AbstractPane* m_root;
};

#endif // ifndef APP_H

App.cpp

#include 
#include 
#include 
#include 
#include 

#include "App.hpp"
#include "TwitterRequest.hpp"

using namespace bb::cascades;

App::App()
{
    QmlDocument *qml = QmlDocument::create("main.qml");
    qml->setContextProperty("cs", this);

    m_root = qml->createRootNode();
    Application::setScene(m_root);
}

void App::getTimeline(QString screenName)
{
    //sanitize screenname
    QStringList list = screenName.split(QRegExp("\\s+"), QString::SkipEmptyParts);
    if (list.count() <= 0)
    {
        qDebug() << "please enter a valid screen name";
        return;
    }
    QString twitterid = list[0];

    TwitterRequest* tr = new TwitterRequest();
    tr->getTimeline(twitterid);
    connect(tr, SIGNAL(complete(QString, bool)), this, SLOT(onTwitterTimeline(QString, bool)));
}

void App::onTwitterTimeline(QString info, bool success)
{
    if (!success)
    {
        qDebug() << "Error retrieving twitter fee: " << info;
        return;
    }

    ListView* list = m_root->findChild("basicTimelineView");
    if (!list || list->dataModel() != NULL)
    {
        qDebug() << "basic list already populated";
        return; //if basic timeline list not found or already populated do nothing
    }

    // Create a group data model with id as the sorting key
    GroupDataModel* dm = new GroupDataModel(QStringList() << "id_str");
    dm->setGrouping(ItemGrouping::None);

    // parse the json response with JsonDataAccess
    bb::data::JsonDataAccess ja;
    QVariant jsonva = ja.loadFromBuffer(info);

    // the qvariant is an array of tweets which is extracted as a list
    QVariantList feed = jsonva.toList();

    // for each object in the array, push the variantmap in its raw form
    // into the ListView
    for (QList::iterator it = feed.begin(); it != feed.end(); it++)
    {
        QVariantMap tweet = it->toMap();
        dm->insert(tweet);
    }

    // set the data model to display
    list->setDataModel(dm);
    list->setVisible(true);
}

I hope that's enough to help you get started. There are many improvements that can be made, for example using multiple pages, load the ajax style tweets, even having a page where the twitter user name can be changed, and so on of error handling. Good luck!

See you soon

Swann

Tags: BlackBerry Developers

Similar Questions

  • Apply the style of paragraph 1 above and the style of paragraph 3 below all paragraphs containing only the italics?

    Hello

    I need a script that can find the paragraphs in italics only glyphs (maybe we can change all that pretty color) and apply the style of paragraph 1 above, the style of paragraph 3 below and this paragraph in italics to paragraph style 2

    Some paragraph of text (for the 1 paragraph style)

    some italic text (for paragraph style 2)

    little text (for the 3 paragraph style)

    After you run the script, I have something like this in 3 styles different points

    a text

    some italic text

    a text

    Lost link!

    /*

    Fixing paragraph style combinations

    Version: 1.2.B

    Script by Thomas Silkjaer

    http://indesigning.NET/

    Minor version b: Bruno Herfst

    + Add any style to replace paragraphs

    + Can cancel

    */

    var the_document = app.documents.item (0);

    Create a list of paragraph styles

    var list_of_paragraph_styles = [];

    var all_paragraph_styles = [];

    the_document.paragraphStyles.everyItem () .name;

    for (i = 0; i< the_document.paragraphstyles.length;="" i++)="">

    list_of_paragraph_styles.push (the_document.paragraphStyles [i]. (Name)

    all_paragraph_styles.push (the_document.paragraphStyles [i]);

    }

    for (i = 0; i< the_document.paragraphstylegroups.length;="" i++)="">

    for (b = 0; b< the_document.paragraphstylegroups[i].paragraphstyles.length;="" b++)="">

    list_of_paragraph_styles.push (the_document.paragraphStyleGroups [i] .name + ' /' + the_document. paragraphStyleGroups [i] .paragraphStyles [i] .name);

    all_paragraph_styles.push (the_document.paragraphStyleGroups [i] .paragraphStyles [i]);

    }

    }

    var list_of_replace_paragraph_styles = list_of_paragraph_styles.slice (0);

    list_of_replace_paragraph_styles.unshift ("[no paragraph style]" "");

    That the dialog box to select the paragraph styles

    var the_dialog = app.dialogs.add ({name: 'Paragraph style pairs Fix'});

    {with (the_dialog.dialogColumns.Add ())}

    {with (dialogRows.Add ())}

    staticTexts.add({staticLabel:"Find:"});)

    }

    {with (borderPanels.Add ())}

    var find_first_paragraph = dropdowns.add ({stringList:list_of_paragraph_styles, selectedIndex:0});})

    staticTexts.add ({staticLabel: "monitoring of"});

    var find_second_paragraph = dropdowns.add ({stringList:list_of_replace_paragraph_styles, selectedIndex:0});})

    }

    {with (dialogRows.Add ())}

    staticTexts.add({staticLabel:"Change:"});)

    }

    {with (borderPanels.Add ())}

    var change_first_paragraph = dropdowns.add ({stringList:list_of_paragraph_styles, selectedIndex:0});})

    staticTexts.add ({staticLabel: "monitoring of"});

    var change_second_paragraph = dropdowns.add ({stringList:list_of_paragraph_styles, selectedIndex:0});})

    }

    }

    {if (the_dialog. Show())}

    Define paragraph styles

    var find_first_paragraph = all_paragraph_styles [find_first_paragraph.selectedIndex];

    anyStyle var = false;

    If (find_second_paragraph. SelectedIndex == 0) {}

    anyStyle = true;

    }

    var find_second_paragraph = all_paragraph_styles [find_second_paragraph.selectedIndex - 1];

    var change_first_paragraph = all_paragraph_styles [change_first_paragraph.selectedIndex];

    var change_second_paragraph = all_paragraph_styles [change_second_paragraph.selectedIndex];

    Set preferences for grep to find to find all the points with the first selected paragraph style

    app.findChangeGrepOptions.includeFootnotes = false;

    app.findChangeGrepOptions.includeHiddenLayers = false;

    app.findChangeGrepOptions.includeLockedLayersForFind = false;

    app.findChangeGrepOptions.includeLockedStoriesForFind = false;

    app.findChangeGrepOptions.includeMasterPages = false;

    app.findGrepPreferences = NothingEnum.nothing;

    app.findGrepPreferences.appliedParagraphStyle = find_first_paragraph;

    app.findGrepPreferences.findWhat = ' $';

    Search current history

    var the_story = app.selection [0] .parentStory;

    var found_paragraphs = the_story.findGrep ();

    var change_first_list = [];

    var change_second_list = [];

    Browse the paragraphs and create a list of words and mark them as index words

    myCounter = 0;

    {}

    try {}

    Create an object to in paragraph reference and the following

    var first_paragraph is found_paragraphs [myCounter].paragraphs.firstItem ();.

    var next_paragraph = first_paragraph.paragraphs [-1] .insertionPoints [-1] .paragraphs [0];

    {if (anyStyle)}

    change_first_list.push (first_paragraph);

    change_second_list.push (next_paragraph);

    } else {}

    Check if the next paragraph is equal to the find_second_paragraph

    if(next_paragraph.appliedParagraphStyle == find_second_paragraph) {}

    change_first_list.push (first_paragraph);

    change_second_list.push (next_paragraph);

    }

    }

    } catch (err) {}

    myCounter ++;

    } While (myCounter<>

    Apply paragraph styles

    myCounter = 0;

    {}

    change_first_list [myCounter] .appliedParagraphStyle = change_first_paragraph;

    change_second_list [myCounter] .appliedParagraphStyle = change_second_paragraph;

    myCounter ++;

    } While (myCounter<>

    Alert ("fact pairs fixation!");

    }

  • [AS] [CS6] Apply different styles in the context of a text

    Hello

    Currently I have an AppleScript script to fill a block of plain text with a series of chains:

    say MyTextFrame to define (content of the history of the mother) to MyText1 & MyText2 & MyText3 & MyText4

    I would like to apply a different style (MyStyle1 to MyStyle4) for each of these channels (MyText1 to MyText4).

    Precision: MyTextI strings can contain a word or a paragraph or more, so I can't apply a style to a paragraph, for example.

    Thomas

    See the syntax below

    Please note that, while the js elements begin a 0 as start at 1, so you will have to set that in the script by Uwe

    Tell application "Adobe InDesign CS6"

    Set myDocument to the active document

    page 1 of myDocument, myPage value

    myTextFrame value framework text 1 of myPage

    tell the parents of myTextFrame

    Reference value character myText 1-character - 2 of paragraph 1 of the text object

    say myText

    apply the character style with the character style "myCharStyle" of myDocument

    tell the end

    tell the end

    tell the end

    look at examples in manual https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/InDesignScripting/InD esign-ScriptingGuide - AS.pdf

    A very useful guide indeed

    Trevor

  • How change/apply a style/styleName in a mosaic page

    Hello
    I ' try to set up a page for un composite application.
    I used le Group of experts complex type () " ""<: view panel label =" ComplexPanel " styleName ="TabbedPanelStyle">") . and I would like to to know How can I change the styleName (custom) or even create my own style
    sheet and apply it to my mashup page.
    Is as possible ? If so, how?
    et where is the different attributes of " styleName " ?
    Thanks in advance

    In particular, see the section create a composite application-> skins to use in the file of the application-> apply custom styles

    http://help.Adobe.com/en_US/enterpriseplatform/10.0/AEPDeveloperGuide/WS2ff6a5055c1467b7-4 aec0869131761cca4f - 7ffe.html

    Jocelyn

  • Acombien to apply a style

    How can I apply a style in actionScript? For example, in the code below, how can I apply for one of two css styles incorporated into each of the generated button dynamically?

    Thank you!

    <? XML version = "1.0" encoding = "utf-8"? >
    " < = xmlns:mx mx:Application ' http://www.Adobe.com/2006/MXML "layout ="absolute"creationComplete =" init () "> "
    < mx:Script >
    <! [CDATA]
    Import mx.controls.Button;
    private var: button;
    [Bindable] private var thisButtonNumber:Number
    private function init (): void {}
    for (var i: int = 0; i < 10; i ++) {}
    button = new Button;
    Button.Width = 200;
    Button.Label = String (i)
    panel.addChild (button);
    }
    }
    []] >
    < / mx:Script >
    < mx:Style >
    button {}
    fontSize: 18pt;
    color: Red;
    }
    {.buttonStyle1}
    fontSize: 12pt;
    color: Green;
    }
    < / mx:Style >
    < mx:Panel id = "Panel" / >
    < / mx:Application >

    Hello

    Try like this: -.


    http://www.Adobe.com/2006/mxml"layout ="absolute"creationComplete =" init () ">"
       
            Import mx.controls.Button;
    private var: button;
    [Bindable] private var thisButtonNumber:Number
    private function init (): void {}
    for (var i: int = 0; i<>
    button = new Button;
    Button.Width = 200;
    Button.Label = String (i)
    button.setStyle ('styleName', 'buttonStyle' + i.toString ());
    panel.addChild (button);
    }
    }
    ]]>
       

       
           
    {.buttonStyle0}
    fontSize: 12pt;
    color: Green;
    }
    {.buttonStyle1}
    fontSize: 14pt;
    color: Red;
    }
    {.buttonStyle2}
    fontSize: 16pt;
    color: white;
    }
    {.buttonStyle3}
    fontSize: 18pt;
    color: yellow;
    }
    {.buttonStyle4}
    fontSize: 20pt;
    color: Green;
    }
    {.buttonStyle5}

    fontSize: 22pt;
    color: Purpole;
    }
    {.buttonStyle6}
    fontSize: 24pt;
    color: Cyan;
    }
    {.buttonStyle7}
    fontSize: 26pt;
    color: Orange;
    }
    {.buttonStyle8}
    fontSize: 28pt;
    Color: Blue;
    }
    {.buttonStyle9}
    fontSize: 30pt.
    color: black;
    }
       
           

    with respect,

    Mayeul Singh Bartwal

  • Impossible to properly apply a style

    This is the second time when I can't do a paragraph style be applied in a way that it is supposed to. Say, I use tripped 18pt, bold font style. I select a portion of text container and make a style of it. I then click the style to assign to a new paragraph but it holds tightly tripped 18pt Simple. How do I make it work or is it a bug?

    Pages ' 09 (4.2)

    You have probably mixed style is in the initial paragraph that you did the Style from which in the paragraph you want to apply the Style to.

    To make sure that the original style does only one font etc type a short series of words so that it starts and ends even, apply all of your properties to that, then set a new-Style.

    To force a Style to a paragraph, click in the text and double click on the name of the Style in the Styles Palette.

    Peter

  • How to avoid overwriting the italics when you apply paragraph styles?

    First of all, let me say thank you to the community of Adobe's Forum for the great help over the years! You Rock! 9 times out of 10 you nail!

    OK, so I have a long document full of italics, bold and accents. Successfully, I imported the text in MS Word and kept these text features using the import options. But now, when I go to apply paragraph styles, the italics are lost. Is it possible to implement paragraph styles so that they maintain Roman, italic, bold and also special characters like accents? Thank you!

    Hi David: I just put upward (and record) queries for search/replace that I of course after you import all text. For example, I have one that is italic in the document and it goes to a character called italic style. Once I saved queries, it is very fast to run on all the stories at the same time. And once the local formatting is managed through character styles, it is intact by assigning paragraph styles.

    ~ Barb

  • In Photoshop CC2015-how I automatically apply a style to the shape layer that I draw?

    HI -.

    I work in an office with a few different versions of Photoshop on Windows 10.

    On my CS5 PSD I can draw some shape layers, like arrows and have all the styles applied automatically style palette that I draw.

    But the fellow with PSD CC 2015 workers need to use 2 markets - draw shape layer and then select the style in the style palette.  None of the settings on the top of the screen seem to allow us to apply the style we attract.

    Is there a hidden area or a preference?

    The automatic application of a style has been removed from Photoshop?

    TIA your answer.

    J2

    This is not possible with the latest Photoshop shape tool. If you want that it is a characteristic shape tool like Photoshop old tool form the best you can do is submit an idea on the Adobe site comments but you hold no breath hoping Adobe will implement your idea.  If you want this feature you will now need to regress to an older version of Photoshop as CS2. This is the version of Photoshop, I used for my second screenshot, Photoshop community customer family

  • InDesign CC 2015 (do not apply paragraph styles)

    Hello

    InDesign doesn't apply paragraph styles. Said she, but nothing has changed. Someone else has the same problem?

    Thank you

    Have you looked to see that a character Style is accidentally applied on the same text? Character styles replaces the paragraph style attributes.

  • Not applying paragraph styles does not correctly

    I don't know even how to describe this problem except that... weird.

    For example: I put a style particular to 21 PT 22 PT. leading. When I apply this style to a paragraph, it sets the text to 42/44 - twice as big. Even with a heading style. I updated PT. 41 and it comes out to pt 82. It does this for all my styles. The '+' is not appear on any of them, this isn't a matter of substitution.

    Has anyone else seen elsewhere? I'm getting nowhere attempting this nail.

    TIA

    The text has been transformed? This will mess up the paragraph styles. Do not apply to the size of the game. The paragraph style will be applied, but then the transformation will also be applied.

  • Can character or paragraph automatically apply a style to recurring words in a document?

    Can you character style or paragraph search for recurring words in a document and automatically apply a style? For example to make some "BOLD" words that appear several times in a document? To help Windows and must currently Adobe InDesign C.

    You can add a GREP style to a paragraph style to apply a character style to any match for your GREP expression, which may be your Word.

  • apply existing styles to paragraphs

    I have a little problem. How to apply existing styles. Different style to the first, second and third paragraph of the story/selection. I think it's simple, but I can't solve the problem. Thank you.

    It's pretty easy:

    mySelection var = app.selection [0];

    var paraStyle1 = app.activeDocument.paragraphStyles.itemByName ("style1");

    var paraStyle2 = app.activeDocument.paragraphStyles.itemByName ("style2");

    etc.

    mySelection.paragraphs [0] .appliedParagraphStyle = paraStyle1;

    mySelection.paragraphs [1] .appliedParagraphStyle = paraStyle2;

    etc.

  • Apply a Style of object for anchor

    Hi all

    Could someone please give solution for my application.

    1. find the anchor marker

    2. apply a style object for the chart image by selecting parent.

    myDoc var = app.activeDocument;

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.appliedParagraphStyle = 'abc '.

    app.findGrepPreferences.findWhat = "~ a".

    var myFound = myDoc.findGrep ();

    for (i = 0; i < myFound.length; i ++)

    {

    myFound [i] .parentTextFrames [0] .appliedObjectStyle = app.activeDocument.objectStyles.item ("Image") //Error only

    }

    Thanks in advance

    Beginner

    Hello

    An anchored object is not parent, but child (pageItem) for the anchor.

    myFound[i].parentTextFrames[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image")   //Error this only
    

    Try this code

    myFound[i].pageItems[0].appliedObjectStyle = app.activeDocument.objectStyles.item("Image");
    

    Thank you

    mg.

  • Need to get all the text of the particular applied character style

    Can someone help me I need to get all the texts of the particular applied character style

    app.findTextPreferences.appliedCharacterStyle = 'style1 Character. "

    app.findTextPreferences.appliedCharacterStyle = 'style1 Character. "

    var mf = app.activeDocument.findText ();

    var myText = ";

    for (var i = 0; i)<>

    myText is myText + mf [i] .silence;.

    }

    Alert (MyText);

  • Apply the style of Pará to the xml element based on the type of master page?

    IM using a flow xml, im importing the xml to be used across different master page templates and I want to apply paragraph styles different items depending on what master page xml, they are on...

    So I have 3 put templates in place

    Type of page 1

    Type of page 2

    Type of page 3

    and 3 paragraph styles

    style 1

    style 2

    style 3

    I have the same xml structure deposited on each page...

    < Entry >

    < name > Page < / name >

    < / name >

    So, can I use javascript to apply the paragraph (style 1) style to the xml element (name) on any page that uses the master page (type of Page 1)

    Is this possible? whether and how this could be done?

    Thanks in advance

    Hello

    Try:

    #include '... / XML rules/glue code.jsx ";

    myDoc var = app.documents.item (0);

    var myRuleSet = new Array (new applyParaStyle());

    {with (MyDoc)}

    var elements = xmlElements;

    __processRuleSet (Elements.Item (0), myRuleSet);

    }

    function applyParaStyle() {}

    myIdName = "Xp".

    This.XPath = "//restaurant_name";

    This.Apply = function (myElement, myRuleProcessor) {}

    {with (MyElement)}

    {Switch(insertionPoints[0].parentTextFrames[0].) ParentPage.appliedMaster.Name)}

    case "X-Master:

    App.Select (texts);

    App.Selection [0]. FillColor = myDoc.colors.item ("xxxx");

    break;

    case 'guide-Scotland:

    App.Select (texts);

    App.Selection [0]. FillColor = myDoc.colors.item ("scotland");

    by default:

    break;

    }

    }

    Returns true;

    }

    }

Maybe you are looking for

  • Numbers - how to import external data to a cell in a single file into a new cell in another file?

    Numbers - how to import external data to a cell in a single file into a new cell in another file? I want to do the same thing in numbers (3.6.2 (2577) I used to do in Excel (any version):) to import a calculation of a cell in a file in a new cell in

  • iMac restarts after the first start since 10.11.6

    Hello Since updating to OS X 10.11.6 my mid 2010 27 "iMac (iMac11, 3) restarts after a few minutes of availability. It happens right after a few seconds. The screen goes black, and then it displays this message. After the reboot, everything works fin

  • Satellite A110 - BIOS password after update BIOS interruption

    Hello I have a Satellite A110, I did a flash update using the Phoenix utility within windows XP. Upgrade flash my office, I need to disconnect the battery to be placed to restart the laptop. After that whenever I try to turn on the laptop it ask me a

  • I need some updates

    Hi guys,. I try to install windows live messenger 11 in my computer laptop win vista but when I try to install show me a message that says that I need a few windows updates: Addition of the plataforma para Windows Vista (KB971644) En multiple additio

  • to upgrade, but not sure I still want windows10

    My old computer has Windows Vista, but I can't download the latest version of my antivirus (Bitdefender). Can I download another Windows operatating system that will accept my virus protection? I would like to download something for free if possible.