Multiple keypress using applescript

Hi there.
I would like to be apple to have a script to quickly press three keyboard key (q,w,e) when I hold them down. I'm playing a videogame slowly breaking my hand... :-(. I tried to write it in applescript, but I'm really a newbie. Could someone help me. I don't mind the script to be in function outsite the game application (it would then be a "simple" multiple key hold repetition). I would really appreciate help...
Max

Be careful what you ask for:
The literal answer to your question looks like:
tell application "System Events"
  key down "q"
  key down "w"
  key down "e"
end tell
However, that only addresses half the problem. This will run indefinitely, and I'm assuming at some point you want to let go of the keys, too? You don't specify that part of the equation. How do you intend to signal the keys to be released.
Ultimately the script should include corresponding 'key up' commands to release the keys. You just need to work out the mechanics of how to do that.

Similar Messages

  • Multiple conditional using AppleScript in Indesign - won't work?

    When I enter in a height and width of, say, 5 inches, it returns with a build size that doesn't make sense, according to the logic gate I built. Here's a stripped-down snippet of the code I wrote that should work in InDesign CS6. Any help would be greatly appreciated.
    tell application "Adobe InDesign CS6"
    activate
    set myDoc to active document
    set origLevel to user interaction level of script preferences
    set user interaction level of script preferences to interact with all
    set myDialog to make dialog with properties {name:"Make Template", can cancel:true}
    tell myDialog
    tell (make dialog column)
    tell (make border panel)
    tell (make dialog column)
    make static text with properties {static label:"Width:", min width:60}
    make static text with properties {static label:"Height:", min width:60}
    make static text with properties {static label:"Bleed:", min width:60}
    end tell
    tell (make dialog column)
    set myWidth to make text editboxes with properties {edit contents:"", min width:60}
    set myHeight to make text editboxes with properties {edit contents:"", min width:60}
    set myBleed to make text editboxes with properties {edit contents:"", min width:60}
    end tell
    tell (make dialog column)
    make static text with properties {static label:"in", min width:0}
    make static text with properties {static label:"in", min width:0}
    make static text with properties {static label:"in", min width:0}
    end tell
    tell (make dialog column)
    make static text with properties {static label:"", min width:25}
    end tell
    end tell
    end tell
    end tell
    set userResponse to show myDialog
    if userResponse is true then
    set docWidth to edit contents of myWidth as string
    set docHeight to edit contents of myHeight as string
    set docBleed to edit contents of myBleed as string
    destroy myDialog
    else
    destroy myDialog
    error number -128
    end if
    set bigDim to docWidth as string
    if docHeight > docWidth then
    set bigDim to docHeight as string
    end if
    set buildSize to 1
    if bigDim > 216 and bigDim ≤ 432 then
    set buildSize to 2
    else if bigDim > 432 and bigDim ≤ 864 then
    set buildSize to 4
    else if bigDim > 864 and bigDim ≤ 2160 then
    set buildSize to 10
    end if
    set newWidth to (docWidth / buildSize)
    set newHeight to (docHeight / buildSize)
    set newBleed to (docBleed / buildSize)
    tell myDoc
    set document bleed top offset of document preferences to newBleed
    set page width of document preferences to newWidth
    set page height of document preferences to newHeight
    end tell
    set user interaction level of script preferences to origLevel
    end tell

    This solved it. I needed to swap the variable with the number. I didn't know that was a rule...
    set buildSize to 1
      if 216 < bigDim and 432 ≥ bigDim then
      set buildSize to 2
      else if 432 < bigDim and 864 ≥ bigDim then
      set buildSize to 4
      else if 864 < bigDim and 2160 ≥ bigDim then
      set buildSize to 10
      end if

  • How I generate index markers using Applescript and tagged text!

    One of the challenges I've faced in automating the book making process using Applescript with inDesign is that there don't seem to be any AS commands for making new index markers (anyone please correct me I if I'm wrong about this).
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    Recently, I read a tweet from someone with a link to a technique which uses tagged text and find and replace with GREP to edit the tags, inserting the tagged text index tags in the text file and then re-placing the text file in the ID page. In itself, this works great. But I'm dealing with literally thousands of separate text frames, none of them connected in a story.
    The books typically consist of around 1200 pages with almost that many people, each of whose names I need to index with "Lastname, Firstname" references. And those particular strings don't (can't) appear anywhere on the pages. There will also be about 50 ID files all combined into one book. So it is imperative that I have ID generate the native index markers. To help keep things straight and efficient, I'm creating separate small text frames to hold the lastname, firstname strings. I created an object style for these frames which sets the attributes to "nonprinting", and I place the frames in the margin.
    Then I realized that I don't actually have to have ID export the tagged text files for each. I exported one prototype and copied its tags to properties in my script, and then I concatenate them with the respective list item values I import from the database.
    At the proper point in the page building script, I tell "textwrangleer" to make a new document, set its contents to the index string for the current record, save it to disk, overwriting the previous one, and then tell ID to "place" it in the index text frame, which generates the ID index mark.
    I actually got an AS error when I first tried this: "file doesn't exist" or some such. Then I realized that the "place" command was happening too soon, so I inserted a .5 sec delay in the script, and it worked.
    This is actually my first major script for actual work, and I'm so excited about it! I promises to cut production time down to about a thenth of what it was.
    I still have to add some logic to branch between handlers with slightly different parameters for five different page formats, but the same page building handler will work on all of them.

    A note on this:
    Daniel Swanson wrote:
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    These scripts typically search for words and immediately write out the page numbers they are found on -- one shot indexing.
    The solution is to add both the topic and its page reference to the current document's index:
    if (app.activeDocument.indexes.length == 0)
        app.activeDocument.indexes.add();
    app.activeDocument.indexes[0].topics.add(app.selection[0].contents).pageReferences.add(app.selection[0]);
    The first lines only make sure there is an index to add to (per default, a new document has none).
    The last line adds a selected word to the index (it must be a plain text string, hence the use of its 'contents'), and then adds a reference to the selection in the text itself.
    Adding the same word a second time will for a change (quite untypically for ID's Scripting) not result in an error but simply add another page reference to the existing one.
    When doing this in a loop: remember to work backwards, because the index marker itself gets inserted into the running text, and that will throw off your text indices.

  • Multiple Keypresses in FL 1.1

    Hi guys,
    How do you capture simultaneous multiple keypresses in FL
    1.1? I used a key catcher (button) to catch all events like:
    quote:
    on(keyPress "1"){call("moveUp1")}
    on(keyPress "7"){call("moveDown1")}
    on(keyPress "3"){call("moveUp2")}
    on(keyPress "9"){call("moveDown2")}
    There are 2 objects on the stage and I want them to move up
    and down independently. In most cases, users get to press 2 keys at
    the same time. When this happens, the object stops moving.
    Please help! Thanks!
    Jon

    I think Flash Lite only responds to 1 key press, and ignores
    any subsequent key press, until the user releases the first
    key.

  • Multiple KeyPress - Ctrl + A to start an event

    Hi All,
    PL HELP....
    The application require multiple keypress to trigger an
    event, for example, press CTRL + A to go to other frame.
    I have used the following function, It does not work out.
    _root.onEnterFrame=function()
    someListener = new Object();
    someListener.onKeyDown = function () {
    if (Key.isDown(65) and Key.isDown(66)) {
    gotoAndPlay("v1");
    Key.addListener(someListener);
    Thanks in advance
    Sonum

    ok the issue here seems to be that this is within an
    onEnterFrame event - this is not needed, it's continually tell the
    timeline to play the label over and over - as a result, does
    nothing.

  • Using applescript to open "any" images in an specified application?

    I want to use applescript as part of a workflow in Automoator.
    Automator already takes care of the renaming and resizing of my pics.
    Then I want applescript to take each pic that I throw at it and apply it to an image optimizer application I have.
    I've looked all over gooel and I can' find anything.
    Everyscript I see has a specific file name or folder.
    I want applescipt to take a file with any name and launch "ImageOptim" and open the file with ImageOptim.
    This app is a drag and drop app, just drop your pictures on the window or on the icon and it'll optimize your pics on the spot. It doesn't create a new file, the file itself is changed.
    And that's it.
    I had this but it doens't work
    set this_file to choose file without invisibles
    try
              tell application "Finder"
      activate
                        open application file "ImageOptim.app" of folder "Applications" of startup disk
                        set this_image to open this_file
              end tell
    end try
    Thanks for the help.

    Red's already shown you one solution, but your script has multiple errors and it's worth clarifying them
    set this_file to choose file without invisibles
    OK, nothing wrong with this line
              tell application "Finder"
      activate
    There's no need to activate the Finder to perform this task. The Finder's quite happy to run in the background.
                        open application file "ImageOptim.app" of folder "Applications" of startup disk
    This opens the application.
                        set this_image to open this_file
    This would open this_file - except that this command is completely independent and disconnected from the previous command - in other words you're just telling the Finder to open the file, it doesn't care about what other commands you might have asked it to run previously.
    The solution is to tell the Finder to open the file using the specific application you want.
    Another option may be to eschew the Finder altogether, and just tell the app to open the file:
    set this_file to choose file without invisibles
    tell application "ImageOptim" to open this_file

  • How to use applescript to open speech calibration window

    I am having a problem with applescript.  I am trying to open the speech calibration window in System Prefrences using applescript.  I am really bad at GUI Scripting.  I don't know if there is some other way to open the window, but I would like to have it appear when the user clicks a button.  I am using Xcode ApplescriptObjC, but I don't think that matters.  Could someone show me a script that opens the accessibility (or universal access) pane, click speakable items, then the "calibrate" button.

    Another way to do this in Captivate 3, to open new window
    using javascript with multiple files:
    Create button and choose Execute Javascript:
    Click the "..." button and type command using the following
    format:
    JavaScript:mynameLaunch();
    ["myname" is the name of the javascript function in relation
    to the file you want to open]
    Publish the Cp file.
    Copy the file to be opened over to the root of the htm file
    folder (for this example "myname.pdf").
    Place the below javascript in the head of the main htm file
    after publishing.
    <head>
    <script src="standard.js"
    type="text/javascript"></script>
    <script type="text/javascript">
    function mynameLaunch(){window.open("myname.pdf",
    "","toolbar=no,location=1,top=50,left=50,status=no,menubar=no,scrollbars=yes,resizable=ye s,width=400,height=575");
    </script>
    </head>
    Test on a web server.

  • How to use Applescript to print out a certain calendar at 7am every morning?

    Hey guys,
    I am trying to use AppleScript to print out one of my calendars each day at 7am every morning.
    I have come up with this so far:
    tell application "Calendar"
           view calendar "My Appointments" at (my (current date))
           switch view to day view
           activate
                        tell application "System Events"
                     keystroke "p" using command down
                     delay 1 -- (seconds)
                     tell process "Calendar"
                                                      tell window "Print"
                                                                     if value of checkbox "Calendar Keys" is not 0 then
                                      click checkbox "Calendar Keys"
                               end if
                                                      end tell
                                       end tell
                        end tell
    end tell
    The problem with this is that it will print out whatever calendars are currently viewable. I can't figure out how to tell it to deselect other calendars and just select the one I want. I also want to tell it to print this out at 7am every morning.
    Any help would be very appreciated!

    If you wanted to do the printout over multiple days, you would be best to loop through each day's events in the way the current script does, but to put a new loop around it that gets each new day's data:
    --opens a temporary file
    set fileRef to open for access ((path to desktop) as string) & "meetings.txt" with write permission
    --effectively empties the file
    set eof fileRef to 0
    tell application "Calendar"
              set dayCount to 9 --this will be the number of days to look forward (not including today)
              repeat with currentDay from 0 to dayCount
                        set startList to {}
      --get's today's date
      --set startRange to ((current date) + 12 * days) -- I used this for testing, to point to a day that had many appointments.  I've left it so you can use it, too.
                        set startRange to ((current date) + (currentDay * days))
      --set the start of the range to previous midnight
                        set hours of startRange to 0
                        set minutes of startRange to 0
                        set seconds of startRange to 0
      --set end of the range to next midnight
                        set endRange to (startRange + 1 * days)
      --get today's events
                        set todaysEvents to get (events of calendar "My Appointments" whose (start date is greater than startRange) and (end date is less than endRange))
      --make a new list with start time of the event for sort purposes
                        repeat with theEvent in todaysEvents
                                  set end of startList to {startdate:start date of theEvent, eventID:theEvent}
                        end repeat
      --sort using a bubble sort (suitable for short lists)
                        repeat with i from 1 to (count of startList) - 1
                                  repeat with j from i + 1 to count of startList
                                            if startdate of item j of startList < startdate of item i of startList then
                                                      set temp to item i of startList
                                                      set item i of startList to item j of startList
                                                      set item j of startList to temp
                                            end if
                                  end repeat
                        end repeat
      --empty the original list
                        set todaysEvents to {}
      --repopulate the list in correct chronological order
                        repeat with theEvent in startList
                                  set end of todaysEvents to eventID of theEvent
                        end repeat
      --write today's date to the file
      write (date string of startRange & return & return) to fileRef
      --if there are no events, write this to the file as well
                        if length of todaysEvents is 0 then
                                  write "No events" & return & return to fileRef
                        else
      --process each event into format: hh:mm-hh:mm/new line/event summary
                                  repeat with theEvent in todaysEvents
                                            set startdate to start date of theEvent
                                            set enddate to end date of theEvent
                                            set startHours to hours of startdate as string
                                            if length of startHours is 1 then set startHours to "0" & startHours
                                            set startMins to minutes of startdate as string
                                            if length of startMins is 1 then set startMins to "0" & startMins
                                            set starttime to startHours & ":" & startMins
                                            set endHours to hours of enddate as string
                                            if length of endHours is 1 then set endHours to "0" & endHours
                                            set endMins to minutes of enddate as string
                                            if length of endMins is 1 then set endMins to "0" & endMins
                                            set endTime to endHours & ":" & endMins
      --write the event to the file
                                            set theSummary to (starttime & "-" & endTime & return & summary of theEvent & return & return) as string
      write theSummary to fileRef
                                  end repeat
                        end if
      write return to fileRef
              end repeat
    end tell
    --close the file
    close access fileRef
    --print the file
    set theFile to (((path to desktop) as text) & "meetings.txt") as alias
    tell application "TextEdit"
              print theFile without print dialog
    end tell

  • Sending email to multiple address using Utl_Smtp

    Hi,
    I want to send email to multiple address using the Utl_Smtp feature.
    When I am sending email to one email address in the To:Field it works fine.However, when I send
    to multiple address I am getting the below error.I am using a table(Email_test) to store all email id.
    Error report:
    ORA-29279: SMTP permanent error: 501 5.1.3 Invalid address
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 98
    ORA-06512: at "SYS.UTL_SMTP", line 240
    ORA-06512: at line 48
    29279. 00000 - "SMTP permanent error: %s"
    *Cause:    A SMTP permanent error occurred.
    *Action:   Correct the error and retry the SMTP operation.
    I am trying two options both ways I am getting error
    Option 1:
    Selecting two email id indivually in the select query as below
    select email into v_Recipient1 from Email_test where Key_name='U1';
    select email into v_Recipient2 from Email_test where Key_name='U2';
    v_Recipient := v_Recipient1||';'||v_Recipient2;
    Option 2:
    Is there a way to use option
    select email into v_Recipient1 from Email_test where Key_name='U4';
    ===========================================================
    Create table Script
    ===========================================================
    create table Email_test (Email varchar2(100),Key_name varchar2(10));
    insert into Email_test values ('[email protected]','U1');
    insert into Email_test values ('[email protected]','U2');
    insert into Email_test values ('[email protected]','U3')
    insert into Email_test values ('[email protected];[email protected];[email protected]','U4');
    select * from Email_test
    [email protected]                         U1
    [email protected]                         U2
    [email protected]                         U3
    [email protected];[email protected];[email protected]     U4
    select * from Email_test where Key_name in ('U1','U2','U3')
    [email protected]     U1
    [email protected]     U2
    [email protected]     U3
    select * from Email_test where Key_name='U4'
    [email protected];[email protected];[email protected]
    =======================================================
    PL/SQL Block
    ===========================================================
    declare
    v_From VARCHAR2(80) := '[email protected]';
    v_cc VARCHAR2(80);
    v_Recipient VARCHAR2(80) ;
    v_Recipient1 VARCHAR2(80) ;
    v_Recipient2 VARCHAR2(80) ;
    v_Subject VARCHAR2(80);
    v_Mail_Host VARCHAR2(50);
    v_Mail_Conn utl_smtp.Connection;
    crlf VARCHAR2(2) := chr(13)||chr(10);
    begin
    --Mail Host name
    select VALUE into v_Mail_Host from Server_info where server_name = 'SMTPServer';
    select email into v_Recipient1 from Email_test where Key_name='U1';
    select email into v_Recipient2 from Email_test where Key_name='U2';
    v_Recipient := v_Recipient1||';'||v_Recipient2;
    --for CC
    select email into v_cc from Email_test where Key_name='U3';
    v_Mail_Conn := utl_smtp.Open_Connection(v_Mail_Host, 25);
    utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
    utl_smtp.Mail(v_Mail_Conn, v_From);
    utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
    utl_smtp.Rcpt(v_Mail_Conn, v_cc); -- To CC recepient
    utl_smtp.Rcpt(v_Mail_Conn, v_BCC); To BCC recepient
    utl_smtp.Data(v_Mail_Conn,
    'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
    'From: ' || v_From || crlf ||
    'Subject: '|| v_Subject || crlf ||
    'To: ' || v_Recipient || crlf ||
    'Cc: ' || v_cc || crlf ||
    'Content-Type: text/html;' ||crlf ||
    --'Hello this is a test email');
    crlf || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf );
    utl_smtp.Quit(v_mail_conn);
    end;
    Any suggestion how to approach this issue.
    Thank you

    Simple Mail Transfer Protocol RFC 5321 specifications.
          RCPT TO:<forward-path> [ SP <rcpt-parameters> ] <CRLF>
       The first or only argument to this command includes a forward-path
       (normally a mailbox and domain, always surrounded by "&gt;" and "&lt;"
       brackets) identifying one recipient.In other words, you can only define a SINGLE mailbox address at a time. Multiple addresses requires multiple repeats of this command verb, once per maibox.
    Do not confuse this and the To: tag line in the Mime header that contains a comma delimited list of recipients. That tag line can contain anything - it is not parsed, not checked, and not verified as matching the actual recipient mailboxes as specified via the RCPT TO verb.

  • Adding data to multiple tables using one form in Access 2010?

    Hi All,
    I have a access database with two tables and I want to create a single form to enter data into that tables.
    How to adding data to multiple tables using one form in Access 2010?
    I don't have to much knowledge of access database?
    Please help me
    Thanks
    Balaji

    You really don't enter identical data into 2 tables.  You enter dat into one single table, and then you have an unique identifier that maps to another table (you have a unique relationship between two tables). 
    Maybe you need to read this.
    http://office.microsoft.com/en-001/access-help/database-design-basics-HA001224247.aspx
    Think about it this way...  What is you update data in 2 tables, and then the data in one of those tables changes, but the data in the other table does NOT change.  WHOOPS!!  Now, you've got a BIG problem.  For instance, you have a customer
    named Bill Gates.  In one Table you update Bill's address to 1835 73rd Ave NE, Medina, WA 98039 and in the other table you accidentally update Bill's address to 183 73rd Ave NE, Medina, WA 98039.  Now you have 2 addresses for Bill.  Why would
    you want that???  Which is right?  No one knows.  If you have one address, you just have to update one address and if there is a mistake, you just have to update one address, but you don't have to waste time trying to figure out which is right
    and which is wong...and then update the one that is wrong.
    Post back with specific questions.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

  • Using Applescript for uploading pictures on the Internet

    Hello!
    I was wondering if there was a way to use Applescript with Firefox (or another browser)...?
    We have many many villas on our website, each one with lots of pictures. We are constantly adding new villas to our site and amending old ones.
    To add pictures we go to a page in our cms for each villa, located there is a drop down menu - image 1, image 2, 3 etc etc etc
    For each one we have to manually browse for and attach the photo. As you can guess this is a time consuming process, we have asked the web designer before for this but he is so busy and we have other more important stuff for him to be working on.
    As Applescript is so nifty I was wondering if anybody had an idea on how to use it for this process - i.e. have a folder full of pictures on the desktop and Applescript can add them?
    I have no idea if this is possible, any ideas?
    Many thanks and regards.
    Simon

    Yeah I completely understand, I just wanted to see if anybody knew if it could be done.
    Obviously for security reasons I can't let anybody into our CMS, so looks like it's a bit of an impossible task.
    Although it would be awesome to simply change the script slightly for each villa and let it do it all, this would be stupidly complicated as there are many menus to navigate to get to the uploading picture area.
    It would be great if I could do all that manually then once on that page (or given the page url to Applescript) set Applescript running to upload all the images for me.
    This is what that page looks like, if this helps?!:
    http://img535.imageshack.us/img535/241/screenshot20100415at141.png
    The drop down menu contains:
    Villa Plan
    Small Location Map
    Image Gallery 1
    Image Gallery 2
    etc
    etc
    I could arrange a folder with the pictures in order (i.e. Villa Plan first, then Small location Map, then the picture for 1 etc) so no worries about the Villa Plan and location map.
    I've got a feeling I'm just going to have to do it manually (I shall forever be uploading pictures), but I thought I would give it to some of you geniuses to mull over!
    For whoever creates a script I'll give you a discounted stay in Paradise... there's an incentive!!
    Many thanks and regards,
    Simon

  • How to get multiple values using HttpSession.getAttribute(java.lang.String)

    Hey Guys
    I'm trying to find a way to get multiple values using the following method
    HttpSession.getAttribute(java.lang.String)
    Here's the scenerio. Its a already written application and now i'm trying to make some changes. earlier in the jsp page a combo box was used and value was retrieved in the servlet using the getAttribute method of Session. Now I'm using a html multiple selection list and have to retrieve all the values selected in the list in the servlet. Can anyone please suggest me how to do that. HTTPRequest class has a method getParameterValues which will let me do that but i have to do is using HTTPSession.
    Thanks for your time to read this

    I'm not sure what you are trying to do. You can only use session.getAttribute to retrieve something that has already been stored in the session with a previous setAttribute. If you need to store multiple values under one attribute name using setAttribute, you can store an array, or an ArrayList or whatever type of Collection you want. The request.getParameterValues method is the only way you can retrieve form parameters than can have multiple values. If the servlet hasn't already processed these parameters and put them into the session for you, you have to use request.getParameterValues.

  • New to applescript. need to create a plist file using applescript

    Needed some help I need on creatinga plist file below using applescript and I can't make it happen needed some hand on this.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Username</key>
    <string>${localAdminUser}</string>
    <key>Password</key>
    <string>${localAdminPassword}</string>
    <key>AdditionalUsers</key>
    <array>
    <dict>
    <key>Username</key>
    <string>${userName}</string>
    <key>Password</key>
    <string>${userPassword}</string>
    </dict>
    </array>
    </dict>
    </plist>
    I have tis code but it doesn't seems to work.
    tell application "System Events"
      -- create an empty property list dictionary item
              set the parent_dictionary to make new property list item with properties {kind:record}
      -- create new property list file using the empty dictionary list item as contents
              set the plistfile_path to "~/Desktop/example.plist"
              set this_plistfile to ¬
      make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
      -- add new property list items of each of the supported types
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Username", value:"${localAdminUser}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:list, name:"AdditionalUsers"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Username", value:"${localAdminUser}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
    end tell
    The result of the above code will generate a plist file below
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>AdditionalUsers</key>
              <array/>
              <key>Password</key>
              <string>${localAdminPassword}</string>
              <key>Username</key>
              <string>${localAdminUser}</string>
    </dict>
    </plist>

    Hello
    You need to create elements at correct container. Like this.
    set plist_file to (path to desktop)'s POSIX path & "example.plist"
    --set plist_file to "~/desktop/example.plist"
    tell application "System Events"
        tell (make new property list file with properties {name:plist_file})
            make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
            make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
            tell (make new property list item at end with properties {kind:list, name:"AdditionalUsers"})
                tell (make new property list item at end with properties {kind:record})
                    make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
                    make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
                end tell
            end tell
        end tell
    end tell
    Or you may create a record in AppleScript and set the value of plist file at once. Like this.
    set plist_file to (path to desktop)'s POSIX path & "example.plist"
    --set plist_file to "~/desktop/example.plist"
    set dict to ¬
        {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} & ¬
        {|AdditionalUsers|:{¬
            {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} ¬
    --set dict to {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}", |AdditionalUsers|:{{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"}}}
    tell application "System Events"
        tell (make new property list file with properties {name:plist_file})
            set value to dict
        end tell
    end tell
    Regards,
    H
    Message was edited by: Hiroto (PS. Fixed second script so that it uses the original case (uppercase)  in key string)

  • Multiple attachment using SO_NEW_DOCUMENT_ATT_SEND_API1

    HI geeks,
              Can anyone pls tell me how to attach multiple files using function module SO_NEW_DOCUMENT_ATT_SEND_API1.
              I have seen example of multiple attachments using same file type.I mean 1 or more files are same type like PDF or Excel.
              But my requirement is i have to send multiple attachment,1 file as PDF and other three excel file.
              Can anyone pls let me know,if anyone done this already,
    Thanks in advance
    Srini.

    Hi Srinivasn,
    Please see the below code u need to follow.  In the object pack table u might specified the number of lines per each attachement.  At the same time u need to specify the document type as  PDF  or XLS.  Please see the below code which is wrote for two attachments as xls.  In your case one attachment should be PDF.  This can be specified in the field
    LT_OBJPACK-DOC_TYPE = 'PDF'.
    IF NOT LT_ATT_TAB[] IS INITIAL AND
        NOT GV_ERR_REC IS INITIAL.        
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_SUC_REC.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = 1.
        LT_OBJPACK-HEAD_NUM = 0.
        LT_OBJPACK-BODY_START = 1.
        LT_OBJPACK-BODY_NUM = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE = LC_XLS.
        LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
        LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME2(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    File2 attachment for processed records.
      IF NOT LT_ATT_TAB[] IS INITIAL AND
         NOT GV_SUC_REC IS INITIAL.
        CLEAR LT_OBJPACK.
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.
        GV_ERR_REC = GV_ERR_REC + 1.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = GV_ERR_REC.
        LT_OBJPACK-HEAD_NUM   = 0.
        LT_OBJPACK-BODY_START = GV_ERR_REC.
        LT_OBJPACK-BODY_NUM   = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE   = LC_XLS.
        LT_OBJPACK-OBJ_NAME   = 'ATTACHMENT'(009).
        LT_OBJPACK-OBJ_DESCR  = LV_ATTACH_NAME(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    Thanks
    IF NOT LT_ATT_TAB[] IS INITIAL AND
        NOT GV_ERR_REC IS INITIAL.        
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_SUC_REC.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = 1.
        LT_OBJPACK-HEAD_NUM = 0.
        LT_OBJPACK-BODY_START = 1.
        LT_OBJPACK-BODY_NUM = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE = LC_XLS.
        LT_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
        LT_OBJPACK-OBJ_DESCR = LV_ATTACH_NAME2(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    File2 attachment for processed records.
      IF NOT LT_ATT_TAB[] IS INITIAL AND
         NOT GV_SUC_REC IS INITIAL.
        CLEAR LT_OBJPACK.
        DESCRIBE TABLE LT_OBJBIN LINES LV_TAB_LINES.
        LV_TAB_LINES = LV_TAB_LINES - GV_ERR_REC.
        GV_ERR_REC = GV_ERR_REC + 1.
        READ TABLE LT_OBJBIN INDEX LV_TAB_LINES.
        LT_OBJPACK-DOC_SIZE =
       ( LV_TAB_LINES - 1 ) * 255 + STRLEN( LT_OBJBIN ).
        LT_OBJPACK-TRANSF_BIN = 'X'.
        LT_OBJPACK-HEAD_START = GV_ERR_REC.
        LT_OBJPACK-HEAD_NUM   = 0.
        LT_OBJPACK-BODY_START = GV_ERR_REC.
        LT_OBJPACK-BODY_NUM   = LV_TAB_LINES.
        LT_OBJPACK-DOC_TYPE   = LC_XLS.
        LT_OBJPACK-OBJ_NAME   = 'ATTACHMENT'(009).
        LT_OBJPACK-OBJ_DESCR  = LV_ATTACH_NAME(50).
        APPEND LT_OBJPACK.
      ENDIF.                               " IF NOT lt_att_tab[] IS ...
    Venkat

  • How to get multiple records using fn-bea:execute-sql()

    Hi,
    I created Proxy service(ALSB3.0) to get records from DB table. I have used Xquery function(fn-bea:execute-sql()). Using simple SQL query I got single record, but my table having multiple records. Please suggest how to get multiple records using fn-bea:execute-sql() and how to assign them in ALSB variable.
    Regards,
    Nagaraju
    Edited by: user10373980 on Sep 29, 2008 6:11 AM

    Hi,
    Am facing the same issue stated above that I couldnt get all the records in the table that am querying in the Proxyservice.
    For example:
    fn-bea:execute-sql('EsbDataSource', 'student', 'select Name from StudentList' ) is the query that am using to fetch the records from the table called StudentList which contains more than one records like
    Id Name
    01 XXX
    02 YYY
    03 ZZZ
    I tried to assign the result of the above query in a variable and while trying to log the variable, I can see the below
    <student>
    <Name>XXX</Name>
    </student>
    I want to have all the records from my table in xml format but it's not coming up. I get the value only from the first row of my table.
    Please suggest.
    regards,
    Venkat

Maybe you are looking for