Can a Compiled and saved AppleScript File be modified?

What I mean is, If i were to create an AppleScript file with default variable, functions etc. Could I,say sometime in the future, edit those variables dynamically?
So for example, I have a script file that customizes an XCode project and  creates an .app file and an .ipa file. Would it be possible to edit the Applescript file, thereby generating a new .app and .ipa file?
Send  Parameters to -----> Default AppleScipt file ---> Modified AppleScript File ----> New .app and .ipa File

Hello
You can use "load script" command and modify the properties of loaded script. Something like this:
    [1] a.scpt is assumed to be coded :
property p : 0
tell application "SystemUIServer"
    activate
    display dialog "p = " & p
end tell
    [2] When b.scpt is opened in AppleScript Editor, decompiled source shows exactly the same as a.scpt
        although its property p's current value is not 0 but 1 as set in this script.
        In other words, decompiled source code shows static value as defined in source code
        whilst the loaded script stores and uses dynamic value at runtime.
-- load script
set f to (path to desktop)'s POSIX path & "a.scpt" -- [1]
set o to load script POSIX file f
-- run it (p = 0)
tell o to run
-- modify it
set o's p to 1
-- run it (p = 1)
tell o to run
-- store modified script to new file
set f1 to (path to desktop)'s POSIX path & "b.scpt" -- [2]
store script o in POSIX file f1 with replacing
-- load modified script from file
set o1 to load script POSIX file f1
-- run it (p = 1)
tell o1 to run
If you want to modify the source code, you may use osadecompile(1) and osacompile(1). Something like this:
#!/bin/bash
cd ~/desktop || exit
osadecompile a.scpt | perl -CSDA -lpe 's/property p : 0/property p : 2/' | osacompile -o c.scpt
osascript c.scpt
Or to run modified script without saving:
#!/bin/bash
cd ~/desktop || exit
osadecompile a.scpt | perl -CSDA -lpe 's/property p : 0/property p : 2/' | osascript -
* The above is true for plain AppleScript script. Don't know about AppleScriptObjC script. Also in recent OSes, applet might need to be re-signed after modification.
Regards,
H

Similar Messages

  • How can i see and cancel hidden files on a external HD?

    How can I see and cancel hidden files on a external HD with macbook pro and Lion?

    Use this AppleScript, saved as an application to toggle hidden files/folders on and off:
    if (do shell script "defaults read com.apple.finder AppleShowAllFiles") is equal to "0" then
              do shell script "defaults write com.apple.finder AppleShowAllFiles 1"
    else
              do shell script "defaults write com.apple.finder AppleShowAllFiles 0"
    end if
    do shell script "killall Finder"

  • I am getting messages that I can't download and read .pdf files since I have the wrong Adobe reader. I know about their security disasters of course, but I downloaded the latest version of Adobe Reader from the Adobe web site and I have other ,pdf file re

    I am getting messages that I can't download and read .pdf files since I have the wrong Adobe reader. I know about their security disasters of course, but I downloaded the latest version of Adobe Reader from the Adobe web site and I have other ,pdf file readers as well, and for some reason they won't work either. I have 5 computers running top end processors and RAM. By this I mean I have one, this one which I am using that has an AMD Phenom Black 3.2 Quad-core with 8 GBs of Corsair top DDR2 RAM, my other two AMD have either an Athlon II triple core with 4 GBs of DDR2 Corsair RAM, one with the Phenom X4 965 3.4 GHz Quad-core with 8 GBs of their best DDR2 RAM, and two Intels with the i7 920 Processors using the triple channel 1366 socket processors and one with 8 GBs of low latency DDR3 RAM and the other with 4 GBs of the same RAM. I am getting the message on this one, which has a fresh install of XP Pro X64 operating system, as do the other 4 as well. I have run Avast Business Pro Anti-virus on this one, which I am getting the message on with a single result which I deleted, and also both Spybot Search and Destroy, which came back clean as well as Malwarebytes Antimalware, which got a lot of tracing cookies now removed, and SuperAntiSpware which also found a few cookies also now deleted. Can you tell me what I need to do to get these files to show as .pdf files rather than as a clean blank page. One other issue is that I wish to know how to turn off my downloads so they are saved and Mozilla will give me the option of returning them instead of me losing them all together as it does now. Thanks for your assistance. If there is another Adobe reader I should download and install, could you provide me with the link to it? I appreciate your assistance here
    == When I download and try to read a .pdf file and when I am asked to turn off all Firefox files and if I do, I lose them since I need to know how to save them without rebooting my computer.

    Brilliant! Problem solved! Thanks so much.

  • Can we load and unload the files in the run time?

    Can we load and unload the files in the run time?
    For example there are four files named "test1.h & test1.c" and another set "test2.h & test2.c" (I attached them as attachment to this post).
    test1.h contains code:
    int variable; //variable declared as integer
    test1.c contains code:
    variable = 1; //variable assigned a value
    test1.h contains code:
    char *variable; //variable declared as string
    test1.c contains code:
    variable = "EXAMPLE"; //variable assigned a string
    So here, in this case can I dynamically load / unload the first & second group of files so that the same variable name "variable" can be used both as integer and string? And if yes, how is that to be done?
    Solved!
    Go to Solution.
    Attachments:
    test.zip ‏1 KB

    What do you mean by "dynamically"?
    If you want to have a variable that either is an int or a char in the same program run, I'm afraid your only option is to define it as a variant and assign from time to time the proper data type in the variant according to some condition. Next, every time you access the variable you must firstly check which data type is stored in it, next access it in the proper way.
    If on the other hand your option or to have a run in which the variable is an int, next you stop the program and in a following run it is a char, you may have it by using some appropriade preprocessor clause:
    #ifdef  CHAR_TYPE
    #include "test1.h";        // variable defined as a char
    #else
    #include "test2.h";        // variable defined as int
    #endif
    Next, every time you want to access the variable you must proceed in the same vay:
    #ifdef  CHAR_TYPE
      variable = "string";
    #else
      variable = 1;
    #endif
    Does it worth the effort?
    Additionally, keep in mind that this "dynamical" approach can work only in the IDE, where you can properly #define your CHAR_TYPE or not depending on your wishes: when you compile the program, it will have only one #include depending on the definition of the macro.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • I can't save and open .ai files.

    Hello.
    I can't save and open the file with special character in virtual drive(using communications). -> refer to this.. ( http://software.naver.com/software/summary.nhn?softwareId=MFS_105031 )
    *Special character I used is 黒(not 黑).
    If I rename the file name(黒.ai -> test.ai), the file is opend successfully.
    And when I save the file as "Illustrator ver.8 format", the file is saved well.
    This is the error message I have.
    - open : this file cannot be found.
    - save : The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder.
    Please answer me~.
    Version :     Illustrator CS5
    OS :            Windows 7 32bits

    Firefox now always stores the old session, and you can access it by going to the History menu and selecting "Restore Previous Session"
    If you want Firefox to display the message to save the session, it can be turned back on by changing some preferences.
    # Type '''about:config''' into the location bar and press enter
    # Accept the warning message that appears, you will be taken to a list of preferences
    # Locate the preference '''browser.tabs.warnOnClose''', if its value is set to '''false''', double-click on it to change its value to '''true'''
    # Repeat this for these 3 preferences '''browser.warnOnQuit''', '''browser.warnOnRestart''' and '''browser.showQuitWarning'''

  • How to compile and run java files on a mac using command line?

    can someone tell me or link me to some article on how to compile and run java files from command line on a mac? I have mac OS X leopard

    What do you mean by "where to put them" ? What do you want to put anywhere ?
    Have you read Peter's comment in brackets ? Perhaps you have a classpath problem ?
    Edited by: Michael_Knight on Aug 31, 2008 4:23 AM

  • Can't find my saved iWeb file

    I can not find my saved iWeb files on my hard drive? I have searched every where. It opens fine in iWeb. What am I doing wrong?

    It is there, but you have to remember to look in your Home User Library and not your System Library.
    If you can't find it, then do a Spotlight search.
    The fact that when you open iWeb your site is there means that it has to be somewhere.

  • Can not edit my saved .ai files

    I created and saved several files today, both as .ai and as .pdf. Then I quit illustrator. Now when I re-open the files, they are opening as .ai* (with the astrisk) and I can not edit them. How do I edit them?!?

    Are your files saved on a server? Sounds like a permissions problem, save them to your desktop and open them and see if that works, if so, it's definitely permissions.

  • After I have combined some files together to make them into one pdf, can I add and take out files?

    After I have combined some files together to make them into one pdf, can I add and take out files?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • Hi my question is how can I sort and delete photo files which I have had backed up multiple times? Another way how can I get rid of from the duplicate?

    Hi my question is how can I sort and delete photo files which I have had backed up multiple times? Another way how can I get rid of from the duplicate?

    Provide the name of the program you are using so a Moderator may move this message to the correct program forum
    The Cloud is not a program, it is a delivery process... a program would be Photoshop or InDesign or Muse or ???

  • I can't drag and drop word files to a folder

    I can't drag and drop word files to a folder. When I click and hold over a file, nothing happens. Normally it goes where I drag it.

    thanks for the patiance
    with my old ipod (ipod nano 1st gen) i could easily drag and drop my mp3s from windows explorer to ipod by using itunes. is it itunes new version problem so that i couldnt drag and drop manually, or ipod shuffle problem.
    thanks again.

  • How can u insert and retrieve text files in any format using forms6i.

    how can u insert and retrieve text files in any format using forms6i.
    can u give me an example of an insert statement, let's assume the file is located in the a:drive.
    and retrieving the files, i would give the user a list of all the files that are in the database, the user would select one, but what command(or piece of code) would open the file in its apppropriate editor.
    e.g .pdf formatted file would open in acrobat.
    any help would be appreciated.
    Thanks
    Hussein Saiger

    the filereference class is for downloading and uploading files.
    if you want to load xml, use the xml class.
    and, if you want to write to an xml file and don't want to use server-side code, wait.

  • How can I identify and remove duplicate file (audio & photo)

    How can I identify and remove duplicate file (audio & photo)?  I have quite a few libraries created as backup files.

    Terence,
    Yes, the duplicates appear in the iPhoto window. I have folders with same name occuring two or even three times sometimes with exactly the same set of photos (ie photos with the same ID) and sometimes with a limited set of photos. Other  folders appear only once.
    I normally take my MacBook with me if I'm shooting a lot of photos, such as on holiday, and then want to transfer them to my iMac when i get home. Other times I transfer the camera's memory stick directly to my iMac.
    I have great difficulty transferring the photos from my MacBook to my iMac. I don't want to store my photos on my iDisk due to the length of time it takes to upload them.
    Thanks again.
    Simon

  • How can I open and print PDF files?

    How can I open and print PDF files?

    With the free Reader if they are not print protected. With Acrobat otherwise.

  • Receive mail with POP3 and saving to file using XI

    Hello! I'm new to XI, could you help me with this "simple" task: Receive mail with POP3 and saving to file.
    Thanks!

    Hi,
    you will need:
    Mail Sender Adapter
    http://help.sap.com/saphelp_nw04s/helpdata/en/23/c093409c663228e10000000a1550b0/frameset.htm
    and File Receiver Adapter
    http://help.sap.com/saphelp_nw04s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm
    Regards
    Patrick

Maybe you are looking for

  • How do I find hidden files/folder in the Users folder?

    Hi, Is there any way to make certain files visible in the Users folder? I purchased a plug-in and in order for the update to correctly work, I need to find the old file (which is hidden.) I tried Spotlight but it didn't find anything. Any tips/help w

  • IDoc HRMD_A

    Hi, In order to send employee maseter data like infotypes like IT0000, IT0001, IT0002, IT0105 (Sty 0001/0010), HRP1000 and HRP1001 , which are the fields on which filtering should be used for the iDoc HRMD_A. Points will be rewarded. Thanks & Regards

  • Sometimes when I try to go to a web page I get a message," Problem Loading Page". Can't get anywhere when this happens.

    When this happens it useally takes a long time for the web page to respond. Get a timed out message.

  • How to see the publised event in EDN

    I am publishing on event in mediator without anybody subscribed to that event. I want to know where I can see the published event. I investigated and figured out that it is using the "EDNDataSource" to write it to DB but not able to see any table hav

  • R12 External Access

    Hi Hussein, In my test env, I have one single node instance of R12 (12.0.6) running over RHEL 5.3. This instance environment is wrapped within a VPN. I want to give access to R12 instance to some users for testing who are outside the VPN (through int