Passing 2 Text Strings to Applescript Action

I am trying to make a Automator Workflow that Checks if an RSS Feed has Changed & if there is a change then Tweet the New Update.
I have managed to get the URL and Extract the Text from the feed. and limit it to just the very latest 1 Item from the feed, Then i  have 2 Variables set-up one Called OldText and Another Called NewText.
I Need to compare the 2 Variables for any change.
In an applescript action i tried the following
on run {input, OldText, NewText}
          if NewText = OldText then beep
          return input
end run
I Get a Syntax Error
current application, current application} doesn’t match the parameters {input, OldText, NewText } for run.
I was using beep just for testing code will work
can it not pass 2 variables at a time ?

The parameters to an Automator action are already defined - you can't just put in your own.  In the case of the Run AppleScript action, the run handler is defined as:
   on run {input, parameters}
where the input parameter is a list (even if there is only one item) of the items passed from the previous action, and the parameters parameter is a list of the user interface settings (text fields, check boxes, etc) and options of the action itself.  If you are passing items to your script from previous actions in your workflow, you can get the desired item number from the input list (e.g. item 2 of input - I am guessing that you would know the order), and to get the value of a named variable from the workflow you can just ask Automator, for example:
   set oldText to (get value of variable "oldText" of front workflow)

Similar Messages

  • Pass rich text string from webdynpro java into interactive form

    Hi, experts:
      I know rich text-related questions have been asked by many other forum member.
      But I still cannot figure out how to display rich text string in the interactive form.
      below code is set rich text string in my webdynpro program.
    wdContext.currentDataForPDFElement().setDescription("<html xmlns:xfa=\"http://www.xfa.org/schema/xfa-data/1.0/\" xfa:contentType=\"text/html\"><body><p>20100730 0950</p><h1><strong>test1</strong><br /></h1></body></html>");
    or
    wdContext.currentDataForPDFElement().setDescription("<p>20100730 0950</p><h1><strong>test1</strong><br /></h1>");
    Text field in the interactive form has been assign "Field Format" to "Rich Text", "Data Format" to "XHTML".
    I also check XML in the "XML source" tab of interactive form.
    <field name="Description" w="152.817mm" minH="25.2984mm" colSpan="3" access="readOnly">
      <ui>
      </ui>
      <font typeface="Myriad Pro"/>
      <bind match="dataRef" ref="$record.Description"/>
      <value>
         <exData contentType="text/html">
            <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="2.4.5277.0"/>
         </exData>
      </value>
    </field>
    My development tool version is NWDS CE EHP1 SP4, LiveDesigner v 7.1.
    What I miss? Any hints would be very appreciated.

    What about these:
    Formatting in SO10 texts into the form
    Trouble with xhtml text in adobe forms
    Prevent HTML escaping in RichText fields
    regards Otto

  • Is it possible to pass a string from an applet to the web site?

    Hi, everybody!
    Is it possible to pass a String from an applet to a web site (as a field value in a form, an ASP variable, or anything else). Basically, I have a pretty large String that is being edited by an applet. When a user clicks on the submit button, a different page will show up which has to display the modified string. The String is pretty large so it doesn't fit into the URL variable.
    Please, help!
    Thank you so much!

    Why do you want to do this in Java?
    Javascript is the correct language for these type of situations.
    for instance:
    in the head of your html document:
    <script language=javascript type="text/javascript">
    createWindow(form){
    if(form.text.value!=""){
    newDoc = new document
    newDoc.write(form.text.value)
    newWin = window.open(document,'newWin','width=200;height=150')
    </script>
    in the body:
    <form onSubmit="createWindow(this)">
    <p>
    Enter a String:<input type=text size=30 name="text">
    </p><p>
    <input type=submit value="submit"> 
    <input type=reset value="reset">
    </p>
    </form>

  • Cp4 AS3 - using Javascript to generate a text string

    I'm a complete Javascript beginner, so please forgive me if this is a stupid question!
    I need to generate a pseudo random text string. I'm using the unpatched version of Cp4, AS3, Internet Explorer 7
    I've had a look at Captivate.Dev.com and the w3schools site to try to understand how to pass variables & basic javascript, and this is what I've come up with:
    var objCP = document.Captivate;
    function GenerateCode(){
    var rngen = new Array(8);
    var tgits = new Array(8);
    var cdrtn="";
    var lpdx=0;
    var mulier=1;
    for (lpdx=0;lpdx<=5;lpdx++){
    rngen[lpdx]=(Math.floor(Math.random()*9)+1);
    mlier=mulier*(rngen[lpdx]);
    tgits[lpdx]=rngen[lpdx]+"";
    cdrtn=cdrtn+tgits[lpdx];
    rngen[6]=(mlier%17)%10;
    rngen[7]=(mlier%13)%10;
    for (lpdx=6;lpdx<=7;lpdx++)
    tgits[lpdx]=rngen[lpdx]+"";
    cdrtn=cdrtn+tgits[lpdx];
    objCP.cpEISetValue('MyJavascriptVariable', cdrtn);
    GenerateCode();
    I've created a user variable called MyJavascriptVariable , put the code above in the On Slide Enter, Execute Javascript window on the first slide, and on the second a simple caption box showing the variable contents.
    However, when I press F12 I get an orange playbar at the top of the window, and in the middle the preloader and the captionbox (without the return value) flickering. i.e. classic sign of wrong AS version.
    If I change to AS2 the movie progresses ok, but the value the caption reports back for MyJavascriptVariable is blank.
    I know my core code works correctly - if I use the w3school's tryit editor with the code after the function declaration up to the closing curly before the objcCP line, with an addeded document.write to show the variable it works fine.
    It's clearly something to do with the way I'm declaring/passing the function or the way Cp runs the javascript. But what?
    Any help greatfully appreciated!
    Thanks

    Hi Jon,
    You are right... it works great on the W3Schools site.  Although in Cp, you ran into quite an issue using the modulus operater (%).  Looks like Cp needs the encoded version of this operator which is (%25).  Also, if you're using Cp4, then when you go to set the caption, you want to use objCP.cpSetValue();  Cp5 uses cpEISetValue.  I also try to use single quotes when working with strings.
    Here's the updated code:
    var objCP = document.Captivate;
    function GenerateCode() {
    var rngen = new Array(8);
    var tgits = new Array(8);
    var cdrtn='';
    var lpdx = 0;
    var mulier=1;
        for (lpdx=0; lpdx<=5; lpdx++){
            rngen[lpdx]=(Math.floor(Math.random()*9)+1);
            mlier=mulier*(rngen[lpdx]);
            tgits[lpdx]=rngen[lpdx]+'';
            cdrtn=cdrtn+tgits[lpdx];
    rngen[6]=(mlier %25 17) %25 10;
    rngen[7]=(mlier %25 13) %25 10;
       for (lpdx=6; lpdx<=7; lpdx++){
            tgits[lpdx]=rngen[lpdx]+'';
            cdrtn=cdrtn+tgits[lpdx];
    objCP.cpSetValue('MyJavascriptVariable', cdrtn);
    GenerateCode();
    This looks like some really crazy math.
    Let me know if this helps.
    Jim Leichliter

  • How to pass text in MDX query

    Hi All,
    I was wondering how to pass text in MDX query.
    Below mentioned is my sample query and it is working fine.
    SELECT
    {[Measures].members} ON AXIS(0),
    NON EMPTY [0MATERIAL].[LEVEL01].MEMBERS
    *[0DOC_NUMBER].[LEVEL01].MEMBERS ON AXIS(1)"
    FROM [$ZTEST]"
    WHERE {[0MATERIAL].[000012345]} ";      
    But in data base 000012345 consists of material name as “ Pepsi “
    Now based on Pepsi I want to fetch results? Is it possible?
    Thanks in advance.

    Srinivas,
    So you are using JAVA, if you consult the developer's guide there is a section specifically addressing your question the ResultSet API should handle this via the formatted
    <b>Retrieving Result Sets
    ResultSet API</b>
    Note that the concept allows for more than two axes, however a two-dimensional, table-like data set makes the
    example easy to illustrate. On the columns axis, two members (“Store Cost” and ”Store Sales”) of the measures
    dimension have been selected; on the rows axis, three members (“Berlin,” ”Hamburg,” and ”Munich”) of the City level
    of a geographical hierarchy. The dataset has six cells:
    Cells provide four mandatory properties:
    • Value — supports all common column types, for example:
    o numeric types
    o dates
    o time values
    o strings
    o null
    • Data type — int value describing the data-type (see java.sql.Types)
    • Status — state of the cell (for example, error or null)
    <b>• Formatted value — a string representation of value</b>
    You can retrieve text in this manner.
    Do you want to be able to pass text as if it were a value as well?
    Cheers,
    Scott

  • Converting text String to XML file data

    need some guidance. I have to create a XML file of a huge Text File.
    I am parsing the text file according to relevance and passing a set of data each element and attribute seperated by "_".
    I need to create to Xml file out this. It has to be current process as I need to keep on adding new elements and attributes.
    e.g.
    Passing this string
    String temp("Name_Age_Birthdate_Birthplace_Place_teleNumber");
    Need to add this to XML of format
    <Directory>
    <Person>
    <Name>
    <Age>
    <Birthdate>.....
    </Person>
    <Person>
    </Person>
    </Directory>
    The problem not all attributes may be present at some time..
    e.g.
    the person's age may be absent some times.. during that time the xml file should look like <Age/>
    I will need to keep on updating Person list concurrently after the file has been created..
    Need Urgent guidance.. I am still New to java
    A guidance code or link is awaited..
    Thanks.. a Lot

    Do you need to stick to the XML support that comes with Java 1.4 or can you use Third-Party stuff? I'm asking, 'cause I think JDOM is much easier to use for a newbie than the build-in XML API ... and it comes with a VERY easy to use class XMLOutputter that creates XML files!
    Take a look at JDOM:
    http://www.jdom.org/

  • Passing (byref) String from Java to C++ via JNI

    I wish to pass a string to a C++ Dll as a parameter in a function. The problem is that I don't know howto receive back the data after it is filled in the C++ dll. I am trying to do what is called passing parameters by reference.
    Java Code:
    public class ABKeyBoard {
    public native long leerBanda(int pista, String datos);
    public static void main(String[] args) {
    String datos=new String();
    System.loadLibrary("ABKeyBoard");
    new ABKeyBoard().leerBanda(1,datos);
    System.out.println(datos); //the content of datos here is empty.
    C++ Code:
    Java_ABKeyBoard_leerBanda(JNIEnv *env, jobject obj,jint pista, jstring datos)
         char buffer[2024];
         memset(buffer,     0x00,     sizeof(buffer));
         strcpy(buffer, "xxxx");
         datos = env->NewStringUTF(buffer);
    return;
    Thanks for your help.

    In java every parameter are always passed by value.
    The datos parameter is a local copy of the string
    reference you pass to the method.This is wrong. The String passed to the native method is the same String object you use in Java. Although everything is passed by value in Java, what is actually passed by value is the reference to the String. This means that you can modify the object you pass, but you are not allowed to change the reference to point to a totally different object. That is where the problem is coming in.
    The trouble is that it is illegal to modify a String, even from native code. If you need to make changes in-place to the text, pass an array of chars (if your native code uses Unicode), an array of bytes (if it uses normal 8-bit characters) or a StringBuffer. You can legally modify any of these data structures with the new data. But the StringBuffer object is the only one whose length can be changed after it is created. Unfortunately it is also the hardest to use from JNI.
    Generally I think you should always pass arrays of bytes/chars to native code instead of Strings when possible. They can be modified in place, and you can use String's methods to get a byte-array in the platform's proper encoding. Using the GetStringUTFChars method is problematic because UTF only maps directly onto ASCII in the case of characters which are in the set of 7-bit ASCII characters. Your code will do wrong things if your String happens to contain some other character, unless your native code expects UTF format strings.
    The good news is that C(++) functions which return results in their arguments do not ordinarily change the length. So you should be able to allocate a byte[] or char[] ahead of time of the appropriate size (don't forget to add the trailing null, which is not a component of Java strings). I think byte[] or char[] is the best answer because you can easily map those onto C-style arrays with Get[Primitive]ArrayRegion; the return of that is suitable for passing directly to native code, as long as you have remembered the null-terminator. For instance you could do (*env)->GetByteArrayRegion(env, javaArray, 0, arrayLength, CArray) and then your CArray would be changed to point at the contents of the javaArray (note: it does not copy data into CArray, it changes CArray to point at the array contents, so do not allocate memory for CArray first). Then when you do ReleaseByteArrayRegion the results will be propagated back to Java.

  • How can I pass a String by reference in java?

    Hello!
    My question is how to pass a String by reference in java.
    I tried to declare my variable, instead of using "String xxx = "f";", I used "String xxx = new String ("f");" :
    public static void main (String []args)
    String xxx = new String("f");
    StatusEnum result2 = getErrorPointStr(xxx);
         public StatusEnum getErrorPointStr(String text)
              StatusEnum testStatus = StatusEnum.PASS;
              StringBuffer buffer = new StringBuffer();
    buffer.append("123");
              text = buffer.toString();
              return testStatus;
    After calling to getErrorPointStr(String text) function, xxx = "f"
    So it does not work.
    How can I solve this? It is very important, the function will receive String and not something else.
    Thanks!

    Tolls wrote:
    Which is why I said:
    Which is why you only managed to change what 'text' referred to in the methodExcept that's not why. Even if String was mutable, doing text = whatever; would have the same effect; it would change what that variable refers to in the method, but it would not change the object's state.
    I meant that, since there was no way to actually change the data (ie the char[] or whatever) within the object 'text' referred to, the OP was attempting to change what 'text' referred to and hoping it would be reflected outside the method...which we know won't happen as Java is pass-by-value.\Ah, now I see.
    These by-value/by-reference threads tend to get confusing, because usually the person is passing a String, so the immutability of String tends to get in the way and just muddy the waters.

  • Perform URL Encoding in a Text String

    I need to be able to convert some characters ("/", ":", "@", " ") in a few text strings (SentDate, SentTime, EmailAddress) so that the strings can be incorporated into a URL that will be passed to FileMaker Pro Unlimited.
    SentDate is currently "2/22/2006" but I need to replace the "/" with "%2F" to get "2%2F22%2F2006"
    SentTime is currently "12:56:32 PM" but I need to replace the ":" with "%3A" and the " " with "%20" to get "12%3A56%3A32%3A%20PM"
    EmailAddress is in the format "[email protected]" but I need to replace "@" with "%40" to get "first%40last.com".
    I've tried using ACME Script Widgets' ACME Replace command but it only seems to work with the first replace; it hangs my script on subsequent replaces.
    Does anyone have a handler to substitute characters in a string with a group of characters like this? It's driving me nuts and I can't figure it out...
    Thanks in advance,
    Robert

    Hi Robert.
    try this
    set {SentDate, SentTime, EmailAddress} to {"2/22/2006", "12:56:32 PM", "[email protected]"}
    set SentDate to findAndReplace("/", "%2F", SentDate)
    set SentTime to findAndReplace(":", "%3A", SentTime)
    set EmailAddress to findAndReplace("@", "%40", EmailAddress)
    return {SentDate, SentTime, EmailAddress}
    on findAndReplace(tofind, toreplace, TheString)
    set {ditd, text item delimiters} to {text item delimiters, tofind}
    set t to text items of TheString
    set text item delimiters to toreplace
    set t to t as string
    if tofind is ":" then
    set text item delimiters to " "
    set t to text items of t
    set text item delimiters to "%20"
    set t to t as string
    end if
    set text item delimiters to ditd
    return t
    end findAndReplace

  • Pass query string in Flex Builder debug?

    Hi,
    I'm trying to figure out how to launch a debug session while passing query strings in Flex Builder. If I open up the Debug dialog, and uncheck "Use Defaults" and attempt to add my query string to the Debug Path text field, Flex Builder states that "The file cannot be found to launch".  How do I pass a query string to debug in a SWF with Flex Builder?
    Thank you.

    If I understood your question correctly.
    go to html-template/index.template.html and add the query string there and everything you run the app the query string should be there.
    Hope this helps,
    BaBo,

  • Normalisation of text string on import through import manager

    Hi There, we have just uncovered an issue with our workflows where a submitted file that contains 'special' characters in a description field (text string) will cause the jobs to fail. Is there a way i can tweak the normalisation feature in the import manager to remove these special characters, while leaving 'normal' characters (such as spaces, commas and other punctuation) in tact?

    Hi Adam,
    The failure is happening at the import stage and not the workflow stage ,As your import of records are triggering the workflow action(Trigger action being record Import).The records may not be getting imported rightly and so the workflow failing.
    But as far as i know the Text data type in MDM allows special characters entry without much problem.
    Try the following:
    - Check to see if the charater length of this special characters holding  field is sufficiently large it could be the problem that the length of the incoming charaters are more than the length mentioned in the console settings and so truncation of charaters are causing the failure of import.
    - Check to see if values of all other fields especially the date and numeric fields if any are holding correct data .
    - Lastly if you find out that the special charaters are the only cause of the failure then you will have to perform the normalization of the values and save the settings in the map and then use this saved map.Try to accomodate all the possible charaters faults.You can normalize the Field by right clicking on it and say value conversion filter >Normalize.If your values are lesser you can normalize them at the value level itself using the right click.
    Hope It Helped
    Thanks & Regards
    Simona Pinto

  • Chaining "Get Value of Variable" and "Run AppleScript" actions in Automator

    I'm attempting to access a variable I've set in Automator from within a "Run AppleScript Action". On occasion, generally when I start in a fresh new file, I can chain the "Get Value of Variable" action with the "Run AppleScript" action as you would expect.
    Most times, though, they will not chain together. I haven't specified that the "Run AppleScript" action should ignore input, but it behaves that way. I've tried everything I can think of, but I'm out of ideas.
    Am I going about this all wrong? (Thanks in advance for any suggestions!)
    Message was edited by: rch_nashville (for clarity)

    The *Get Value of Variable* action is another quirky one. I'm not sure what causes it to fail, but sometimes putting another (dummy) action in between gets it to work. You can also access workflow variables directly from the Run AppleScript action, so you might also give that a try:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 680px;
    color: #000000;
    background-color: #B5FF6C;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters} -- get values of workflow variables
    set output to {}
    set theVariables to the name of variables of front workflow
    if the result is not {} then
    set theVariables to (choose from list theVariables with multiple selections allowed and empty selection allowed)
    if result is false then error -128 -- cancel
    repeat with someVariable in theVariables
    set the end of the output to (get value of variable someVariable of front workflow)
    end repeat
    end if
    return output
    end run
    </pre>

  • I can't pass empty string as column of Table Valued Parameter.

    Hello.
    I have stored procedure which accept TVP with columns of 'sql_variant' type. And I have C++ application which call this stored procedure.
    When i pass some non-empty string as sql_variant from my application - all works fine.
    But when I need to pass empty string ("") as sql_variant - I get following error:
    "OLEDB hr = 0x80040e14
     #0:  OLEDB provider error 3621  "The statement has been terminated."
     #1:  OLEDB provider error 8062  "The data for the table-valued parameter 1 doesn't conform to the table type of the parameter."
     #2:  OLEDB provider error 8046  "The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Table-valued parameter 0 (""), row 1, column 1: The supplied length is not valid for data type sql_variant.
    Check the source data for invalid lengths. An example of an invalid length is data of nchar type with an odd length in bytes."  
    Could you please help me deal with that issue?
    Thanks,
    Vitaliy

    Dear Vitaliy,
    Thank you for your question.
    Based on my understanding of your question, the issue is related with passing SQL_VARIANT data type in C++ application using Microsoft OLE DB Provider.
    As we can see from http://msdn.microsoft.com/en-us/library/ms173829(v=sql.100).aspx:
    ODBC does not fully support sql_variant. Therefore, queries of sql_variant columns are returned as binary data when you use Microsoft OLE DB Provider for ODBC (MSDASQL). For example, a sql_variant column that contains the character string data 'PS2091'
    is returned as 0x505332303931.
    According to above statement, as you are using OLEDB provider for ODBC with sql_variant in your application, it is not fully support. Seems there are some conversion failure within the Stored Procedure calling. You may consider to adjust your application
    slightly to use other commonly supported data types which also fits your application requirements.
    I listed some more information regarding sql_variant below for your reference:
    A column of type sql_variant may contain rows of different data types such as int, binary and char values.
    A sql_variant data type must first be cast to its base data type value
    before participating in operations such as addition and subtraction. You can find the conversion details in "Comparings sql_variant Values" part.
    Below types of values cannot be stored by using sql_variant:
    varchar(max)
    varbinary(max)
    nvarchar(max)
    xml
    text
    ntext
    image
    timestamp
    sql_variant
    geography
    hierarchyid
    geometry
    User-defined types
    Hope it will be helpful.
    Thank you!
    Best Regards,
    SQL Team - MSFT

  • Pulling text strings from a file in Quartz Composer

    I want to create a screensaver that randomly displays quotes from a specified file. It doesn't matter how the file is formatted -- txt, xls, etc. -- as long as Quartz can randomly display quotes from the file. I know how to display text strings in Quartz, and I know how to randomize graphic functions, but not how to randomize display of text strings.
    Any ideas?

    Here is a shuffling algorithm:
    http://tekpool.wordpress.com/2006/10/06/shuffling-shuffle-a-deck-of-cards-knuth- shuffle/
    Basically, pass through the file once to get the number of strings (n), than shuffle an array of integers 1 to n using an algorithm like the above. As each number comes up, pull that string out of the file.

  • Set Mail Signature with Run AppleScript Action inside an Automator workflow

    Hello,
    Not sure if I am posting this at the right spot, but I would need some assistance. I am trying to write an Automator Workflow application. The purpose for this application is to:
    1. Drag one or more attachments on the application/droplet icon
    2. Automator workflow creates a new mail message in Mail with the attached items already addressed and ready to go to
    I setup the following Workflow inside Automator:
    1. New Mail Message
    2. Add Attachments to Front Message
    So this is all working just fine. Now I would like to add a step in between of type "Run AppleScript". In this "Run AppleScript" action I have the following code:
    on run {input, parameters}
    tell application "Mail"
    set the message signature of input to signature "My Signature Name"
    end tell
    return input
    end run
    So my workflow looks now like this:
    1. New Mail Message
    2. Run AppleScript
    3. Add Attachments to Front Message
    I am getting the following error:
    Can’t make «class situ» "My Signature Name" of application "Mail" into the expected type.
    So, in essence I am trying to select a signature for that particular new mail message in this workflow. And that does not work. Any help would be appreciated.
    Martin

    first, you don't need the extra action to add attachments. if you drop some items on the saved application they will be passed to the "new Mail message" action as input and will be added as attachments. also, in my testing it seems that the processes of attaching the attachments seem to bump against the process of adding the signature. it get the same result as you originally but if I add a delay to the run applescript action then it works as it should so try
    1. new mail message.
    2. run applescript
    on run {input, parameters}
    delay 1
    tell application "Mail"
    set the message signature of (item 1 of input) to signature "My Signature Name"
    end tell
    return input
    end run

Maybe you are looking for

  • OSX Remote Desktop and RDGateway Remote Resources

    Is it possible or planned to support RDGateway for published Remote Resources, using Microsoft Remote Desktop for OSX? thanks

  • Ipod isnt recognized by itunes or computer

    I have had my ipod fer like 3 months now without any problems. maybe a week ago my ipod froze up on me so i had to restart it. the my itunes will not recognize that my ipod is hook into the usb port(which is fully functional).im wondering what to do

  • Update from windows 8.1 pro evaluation copy to windows 8.1

    Greetings. Today i suddenly got BSOD when i play some games. It was too fast i cant see what the error is. And after my pc restart thers an error messege it says my windows evaluation copy has expired and will restart every 2 hour and it told me to d

  • XML File to 3rd Party Provider w/o any Middleware

    Hi I have a requirement wherein we are required to send XML files to 3rd Party Supply chain provided w/o using any middleware in most secured form. The Customer is on ECC5. One of options i could think about is as mentioned below. -  file based and u

  • Exporting large amount of assets

    So it's been awhile since I've used illustrator and I'm currently using CS5. I'm creating UI sets for different applications. I have several button states -nuetral, hover, pressed- I am trying to export these as png's using artboards. However when I