Edit and Store a Script Object

Hi, All!
I know there must be a way to do this:
I want to be able to create a script based on user input and then store it for later use. Here's an example:
display dialog "How many beeps?" default answer "1"
set beepNum to text returned of result as string
script beeper
beep beepNum
end script
store script beeper in ((path to desktop as string) & "Beeper.scpt")
So, what I don't want is the stored script to need the variable to be defined.
So, say the user types in a 5. Then, I'd want the stored script to read "beep 5".
Thanks in advance!

I use a couple of tools for something similar, although they just paste handlers or code snippets into the front Script Editor document. The following script will compile script text to an application on your desktop:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #DAFFB6;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
set theDesktop to quoted form of POSIX path of (path to desktop) -- this will be where the application is saved
-- a couple of example variables
tell (current date) to set theDate to (it's month) & " " & (it's day) & ", " & (it's year)
set theDescription to "osacompile example -- saves the specified script text as an application"
-- this is the script text - pay attention to quoting
set theScript to "
" & theDescription & "
created on " & theDate & "
on run -- example
set the clipboard to escapeString(the clipboard as string)
display dialog (the clipboard) with title \"Clipboard Contents\" buttons {\"OK\"} default button \"OK\" giving up after 5
end run
on escapeString(someText)
escapes a list of characters for an AppleScript string
parameters - someText [text]: some text to look at
returns [text]: the text with matching characters escaped
set someText to someText as text
-- set escapeList to {\"\\\\\", \"\\\"\"} -- backslash, quote
set escapeList to {ASCII character 92, ASCII character 34} -- backslash, quote
set escapedText to \"\"
repeat with theChar in (get characters of someText)
if theChar is in escapeList then set escapedText to escapedText & (ASCII character 92)
set escapedText to escapedText & theChar
end repeat
return escapedText
end escapeString
-- add a here-doc wrapper if not using a file
set theScript to "<<_script-contents_
" & theScript & "
_script-contents_"
do shell script "cd " & theDesktop & "; osacompile -o 'forum test.app' -t APPL " & theScript -- make it
</pre>
Since just saving a script object by itself won't do anything (additional code will be needed to run it or call it from another script), the sample text is one of the tools I use to escape AppleScript text strings - it replaces the contents of the clipboard with the escaped text. To test with other script text, just copy the text to the clipboard, run the escape tool, and paste into the theScript variable.

Similar Messages

  • I have a family video DVD that was originally on tape, but is now on disc. I want to import it onto my MacBook to edit and store. However the files are IFO, BUP and VOB and the Mac is saying 'unable to import' as it doesn't recognise the file. Help !!

    I have a family video DVD that was originally on tape, but is now on disc. I want to import it onto my MacBook to edit and store. However the files are IFO, BUP and VOB and the Mac is saying 'unable to import' as it doesn't recognise the file. Help please !!!!!

    Those are the constituent parts of a standard mpeg2 DVD. Storing them is easy: just copy the folder to your hard drive and they will play in DVD player or VLC.
    But that format is not intended for editing. To do so:
    You need to convert the VOB files in the TS-Folder of the DVD back to DV which iMovie is designed to handle. For that you need mpegStreamclip:
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    which is free, but you must also have the  Apple mpeg2 plugin :
    http://store.apple.com/us/product/D2187Z/A/quicktime-mpeg-2-playback-component-f or-mac-os-x
    (unless you are running Lion in which case see below))
    which is a mere $20.
    Another possibility is to use DVDxDV:
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm
    which costs $25.
    For the benefit of others who may read this thread:
    Obviously the foregoing only applies to DVDs you have made yourself, or other home-made DVDs that have been given to you. It will NOT work on copy-protected commercial DVDs, which in any case would be illegal.
    And from the TOU of these forums:
    Keep within the Law
    No material may be submitted that is intended to promote or commit an illegal act.
    Do not submit software or descriptions of processes that break or otherwise ‘work around’ digital rights management software or hardware. This includes conversations about ‘ripping’ DVDs or working around FairPlay software used on the iTunes Store.
    If you are running Lion:
    From the MPEG Streamclip homepage
    The installer of the MPEG-2 Playback Component may refuse to install the component in Lion. Apple states the component is unnecessary in Lion onwards, however MPEG Streamclip still needs it. See this:
    http://support.apple.com/kb/HT3381
    To install the component in Lion, please download MPEG Streamclip 1.9.3b7 beta above; inside the disk image you will find the Utility MPEG2 Component Lion: use it to install the MPEG-2 Playback Component in Lion. The original installer's disk image (QuickTimeMPEG2.dmg) is required.
    The current versions of MPEG Streamclip cannot take advantage of the built-in MPEG-2 functionality of Lion. For MPEG-2 files you still need to install the QuickTime MPEG-2 Playback Component, which is not preinstalled in Lion. You don't have to install QuickTime 7.

  • Difference in printing and preview of scripted object

    Hi guys,
    I designed a form (printform) where I implemented a "watermark" text which is displayed dependent on SID. It's just showing on our dev- and test-systems. This text (text-field) is rotated by 60° using javascript.
    This works well in preview mode but doesn't rotate while printing directly. The script itself actually is OK, because other things in the same script are processed OK and the same script works fine on my other forms.
    Did anyone face similar behaviour yet or have an idea where to look for a solution?
    I already tried different combinations like script on client, server or both. There is even no difference using javascript or formcalc.
    regards

    I finally managed to solve this by myself.
    It was just again, one these strange lifecycle designer behaviours.
    I deleted the textfield from the form and activated the form.
    Then I copied the textfield from another form into my form and activated again.
    And guess what: It works, even tough the fields are absolutely identical incl. script
    regards

  • Edit and save dynamic alv.

    Hi Experts
    I have created a dynamic table then filled this dynamic table with the help of field symbols and then passed this dynamic table to grid1->set_table_for_first_display and hence the dynamic alv is shown on the screen. Now, can I do something to make this alv editable and store these values in z table. I have tried the method get_changed_cell method, but no help.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_CAT
        IMPORTING
          EP_TABLE        = LP_TABLE.
      ASSIGN LP_TABLE->* TO <LT_DATA>.
    *Create structure = structure of the internal table
      CREATE DATA LP_STRUCT LIKE LINE OF <LT_DATA>.
      ASSIGN LP_STRUCT->* TO <HEADER>.
    *  SORT gt_data BY erdat.
    *sort IT_VEWAO by MATNR.
      LOOP AT IT_VEWZO INTO WA_VEWZO.
        AT NEW VKBUR.
          CLEAR <HEADER>.
          ASSIGN COMPONENT 'VKBUR' OF STRUCTURE <HEADER> TO <FIELD>.
          IF SY-SUBRC NE 0.
            EXIT .
          ENDIF.
          <FIELD> = WA_VEWZO-VKBUR.
        ENDAT.
        MOVE WA_VEWZO-PD_HIER  TO L_COL.
        ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
        IF SY-SUBRC NE 0.
          EXIT .
        ENDIF.
        <FIELD> = WA_VEWZO-PLAN_QTY.
        CONCATENATE WA_VEWZO-PD_HIER '_AP' INTO WA_VEWZO-PD_HIER .
        MOVE WA_VEWZO-PD_HIER  TO L_COL.
        ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <FIELD>.
        IF SY-SUBRC NE 0.
          EXIT .
        ENDIF.
        <FIELD> = WA_VEWZO-APROV_QTY.
        AT END OF VKBUR.
          APPEND <HEADER> TO <LT_DATA>.
        ENDAT .
      ENDLOOP.
    CREATE OBJECT CUSTOM_CONTAINER1
             EXPORTING
                  CONTAINER_NAME = 'CUST_CONT'.
      CREATE OBJECT GRID1
              EXPORTING
                  I_PARENT = CUSTOM_CONTAINER1.
      CALL METHOD grid1->REGISTER_EDIT_EVENT
              EXPORTING
                  i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
    *      I_STRUCTURE_NAME = lv_lp_struct
          IS_LAYOUT        = LS_LAYOUT
        CHANGING
    *      IT_SORT          = LT_SORT1
          IT_FIELDCATALOG  = LT_FIELDCAT
          IT_OUTTAB        = <LT_DATA>.

    Hi,
    What help u need?
    to activate the editable field u need to pass the field catalog parameter
    EDIT = 'X'
    Then Edit values in your alv
    and press enter or define any icons in ur alv list useing user command
    check the changed values using the method
    CALL METHOD g_alvgrid1->check_changed_data( ).
    It will help you i think.
    Regards,
    Nandha

  • Using a script object

    Hi,
    I have beginner skills using LC Designer ES and am trying to insert and use a script object. I found a JavaScript function online: http://home.online.no/~pjacklam/notes/invnorm/impl/misra/normsinv.html and am trying to get it to do some math calculations in a Designer form.
    I've uploaded a sample test form at: http://elearningprojects.com/TestFormula1.pdf
    Can't get it to work.Trying to run the JS formula in the script object (by clicking on a button), using a few hard-coded variables, and display the results (Dprime1 and Dprime2) in 2 text fields.
    I would much appreciate if someone can take a look and suggest how to get it working correctly.
    Thanks for your help.
    Kind Regards,
    saratogacoach

    Hi Paul,
    Thank you for your reply and suggestions. With beginner skills in LC Designer (I'm a retired social worker), I am not sure how to do this.
    Is my identifying the script object path correct?
    form1.#subform[0].#variables[0].SO1.function_name(NORMSINV(p));
    When you say "You are calling this function a few times in your code so you will have to modify each call." I am not sure how to change this.
    I currently have (note that I added the SO1. to the function calls):
    var p = totalscore5
    var probit1 = SO1.NORMSINV(p)
    var p = totalscore6
    var probit2 = SO1.NORMSINV(p)
    var Dprime1 = probit1-probit2
    var p = totalscore8
    var probit3 = SO1.NORMSINV(p)
    var p = totalscore7
    var probit4 = SO1.NORMSINV(p)
    var Dprime2 = probit3-probit4
    Can you specify what a modified script would look like? I'm stuck.
    Also, have I set up displaying the Dprime1 variable's value in the TextField1 correctly?
    Thanks very much for your help.
    Regards,
    saratogacoach

  • Importing Script Object

    Is it possible to make a Script Object part of the library in order for quick drag-and-drop additions to forms?

    I don't know what you're doing wrong. It works for me. The subform acts as a wrapper so that you can add the script object to the custom library.
    - From the library tab, drag a subform onto your form.
    - In the hierarchy tab, right click the subform that you just added and click "insert script object"
    - Put your code in the script object.
    - Drag the subform from the Design View (not the hierarchy) to the Custom library tab for sharing/reuse.
    - In the hierarchy, move the script object from the subform node to the page node
    - Delete the subform.
    To use the script object.
    - Drag the custom subform onto the Design View
    - In the hierarchy, move the script object under the page node
    - Delete the subform.

  • Photoshop bug: Smart Objects overwriting other Smart Objects when edited and saved in Illustrator

    Experiencing issues when working with a large number (over 200) vector smart objects brought into Photoshop CS4 from Illustrator. 
    Things seemed to be going along nicely; if I needed to edit a Smart Object, I could double-click it, it would open in Illustrator and then I could edit and save it.  Return to Photoshop and the Smart Object is updated.  Swell and dandy.  The issue started happen when I hit a large quantity of either vector smart objects (remember, over 200) or the many layers and groups within Photoshop (must be over 500).  When I would double-click, open, edit, and save the vector Smart Object, the Photoshop Smart Object I was working on would update AND another/several other Smart Objects would update as well.  Which, of course, would ruin the artwork, as suddenly I was seeing several instances of the same object.  If it hadn't have been for ForeverSave, I many not have recovered the work.
    It's rather hard to isolate the issue to see what's causing the problem.  Here are some of the possible causes:
    Running Snow Leopard on Mac
    Many, many Smart Objects in file, perhaps enough to ruin the naming convention and cause bugs when Photoshop referenced the temp file
    Many, many Photoshop layers and groups
    Illustrator vector files copy+pasted from several different files (affects the naming convention perhaps?)
    Some groups/layers in Photoshop are duplicates
    To help make it a little clearer, you should know:
    Running the most updated software / OS (that is until CS5 comes out)
    Smart Objects showed no error until I had actually opened, edited, and saved the referenced temp file (i.e. VectorSmartObject1.ai)
    Files saved and worked on from Dropbox (network folder)
    Not looking for much of an answer to this question; I just wanted to see if anyone else had come across this bug.  Also, Adobe PLEASE look into this as you begin testing for the next update.  I have the file(s) if you need to replicate the issue.  My best guess is that the naming convention of Vector Smart Objects has an odd character limit so when Vector Smart Object 200.ai is saved, Vector Smart Object 2.ai gets overwritten.

    Have you tested this with Photoshop CS5 and Illustrator CS5? (the current versions, that came out last month)
    If you duplicated a smart object layer, both layers refer back to the same file content. So when you change the file, both layers would be updated.  That is intentional and explained in your manual.  If you didn't realize this, that could explain what you are seeing.
    If you placed separate files, then they should not be updated at the same time, because they will refer to separate files.
    Yes, Smart Objects only update when you save the file.
    You would need over 4 billion smart objects in one document to get Photoshop confused about which one refers to which file.  And since the layer limit is much less than 4 billion, I doubt that is the cause.
    There is no naming convention involved. We don't limit the filenames (except to platform standards and to include a file type extension).

  • Can I hide the Adobe Reader panel with "Export, Create and Edit PDF and Send and Store Files"? I don't use it and it takes up space

    Can I hide the Adobe Reader panel with "Export, Create and Edit PDF and Send and Store Files"? I don't use it and it takes up space

    If you just mean, can I close it, sure. In Reader XI click the Tools button to close or reopen it.

  • How to create unique objects in class and store

    Hi, I have a class that opens a text file and reads in the
    lines. each line holds an ip address. i need to create x amount of
    objects, and each object is assigned a unique ip address from the file.
    and here i am stuck. the class reads in the file, then i think it should create an object for each line read in and assign that object the ip address. i want to store the objects in some sort of array or collection, and i guess each object will need a unique name, but i dont know how many objects until i read in the file and count the number of lines. can anyone give me any pointers as to how i should create/store the objects
    many thanx
    ness

    You could use your own object:
    public class Test {
      public class IPNumber {
        public int ip;
        public IPNumber(int ip) {
          this.ip = ip;
      public Test() {
        int numberOfIPs = 5; // this is your number of lines
        IPNumber[] ips = new IPNumber[numberOfIPs];
        for (int i = 0; i < numberOfIPs; i++) ips[i] = new IPNumber(i); // assign ip address from file
      public static void main(String args[]){
        new Test();
    }or you could store the ips as strings:
    public class Test {
      public Test() {
        final int numberOfIPs = 5; // this is your number of lines
        final java.util.ArrayList al = new java.util.ArrayList(numberOfIPs);
        for (int i = 0; i < numberOfIPs; i++) al.add(""+i); // assign ip address from file   
      public static void main(String args[]){
        new Test();
    }p.s Objects don't have names

  • How can I get an object from a vector, modify it and store it back ?

    Hello all,
    I have created the clase "node", this class has a "name" property and and "counter" property, and the associated method to set the name and make the couter increase value.
    In a different class I have a vector, and I add "node" objects to this vector.
    Once I've added a few objects "nodes" I need to get one, modify the value and the store it back in. Better if it is in the same position. ..
    Thanks, alot guys. I could not copy an paste the code because I have a whole bunch of things mixed in the same code. I'd not be understanble.
    Thanks again !!

    Never mind, thanks anyway ..

  • Getting text object content and position via script / extra?

    Hello everybody,
    we have several Freehand files on OS X (maps) where I need to
    get the text content and the coordinates of objects in a given
    layer. I could not find a possibility how to achieve this via
    Freehand's Applescript support. Am I missing something or is this
    impossible with the standard scripting support?
    I have found a website about an older Xtra (CARTO-INDEX) that
    seems to something along those lines but it was written in the
    Classic days of the Mac OS. Is there a possibility or maybe even
    some sample code showing how this can be done with an Xtra? Is it
    possible to call an Xtra function via AppleScript?
    Illustrator seems to be no alternative here because although
    it seems to provide better scripting support, I get conversion
    errors with my Freehand documents and the object parameters do not
    match.
    Thanks in advance for your advice.

    > we have several Freehand files on OS X (maps) where I
    need to get the text
    > content and the coordinates of objects in a given layer.
    I could not find a
    > possibility how to achieve this via Freehand's
    Applescript support. Am I
    > missing something or is this impossible with the
    standard scripting support?
    MaPublisher 5 for FreeHand might do what you wish to do.
    http://www.avenza.com/products.mapub50.html
    Boris Jerenec and Michael Slomski have written useful Xtras
    for FreeHand.
    You can find contact info for them here, under "Other
    Plug-ins/Xtras".
    http://www.freehandsource.com/_frames/_misc/plugins.html
    If you decide to work in Illustrator, a script called "Make
    Point Type"
    converts FH text to AI point type. There's also a script to
    "Make Area
    Type".
    http://kelsocartography.com/scripts/
    Judy Arndt

  • I've tried to convert the obkect into bytes and store it. But while retreiving it using JNDI, its giving me an object. That's not the object I need.

     

    You must convert and store the object into Base64. On read of the attribute convert from Base64 back into binary.

  • Scan all objects and store their information

    Hi
    Could any one give me an idea for a loop, where I can scan through all the objects in a panel and store their information (type of object, location and size) in a file? So that later I can read the file and and place (or create if possible) the objects exactly in the same place as they were in the panel.
    This is like a software where you have different objects in a panel and the user can dynamically add and remove different types (and any number) of objects
    Thanks a lot

    Maybe this posting will help:
    http://forum.java.sun.com/thread.jspa?threadID=5127130

  • Editing Inbound IDoc and store it in an Ztable

    Hi
    I need to Edit an inbound IDoc(IDOcs through mail or XI) and store the details in an Ztable depends upon the message type (eg UTILMD).plz help me with step by step process
    thanks in advance
    shibu

    for idoc stpes check this:
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/sapR3%28Idocs%29ToXI--Steps+Summarized&

  • Upon Opening and Editing I have a Script Error

    This Error Appears in my Contribute CS5 if I click through yes/or no I can make some edits and revisions but my Navigation on the top of the Tri-Oak.com site dissapears.
    VS

    I've been having the same kind of problem with scripts in my pages that work fine in every browser but cause incessant error messages in Contribute.
    And even if you do click "No" to continue running scripts on the page, it will still pop up error alerts for this and other scripts.
    Any idea how to kill off these bogus error messages? They are in no way relevant to what my Contribute users are supposed to be editing on the page.
    Here's another error I'm getting a lot.
    This is in reference to a third party modal window script I am using. (http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/documentati on) As perscribed on their site, in my code I have a block at the end of the page:
    <script type="text/javascript" charset="utf-8">
      $(document).ready(function(){
        $("a[rel^='prettyPhoto']").prettyPhoto();
    </script>
    This references 'prettyPhoto' which is defined in the javascript included in the <head> section of the page as:
    <!--  Begin prettyPhoto  -->
    <script src="https://ssl.acesag.auburn.edu/main/jquery/prettyPhoto/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
    <link rel="stylesheet" href="https://ssl.acesag.auburn.edu/main/jquery/prettyPhoto/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
    <!-- End prettyPhoto  -->
    Again, the script works fine, without any errors, in Chrome, Firefox, Opera, Safari, & even IE 8-10 on Windows, Chrome, Firefox, Safari on Mac, Safari on iOS, Chrome and Firefox on Android. I'm running Contribute 6.5 on Windows 8 but have seen the same errors in older versions of Contribute. I had one user with Contribute CS4 having the exact same errors.
    These scripts are included in the standard templates used throughout the ACES website (http://www.aces.edu/). So this is something that causes a lot of anoyance for a lot of our users who maintain pages through Contribute.
    I'd really appreciate any help or insight anyone can offer on this. Thanks.

Maybe you are looking for