New Applescript version breaks old code

Hi there,
First off, I'm not an Applescripter, but I have one script I wrote a few years back (with help from kind people on the net) to generate and save tiny applications which, when called from within an Adobe Flash executable, would open the required file using the Mac OS native application associated with them (i.e a doc file wouldbe opened by Word if installed, TextEdit if not...)
It used to run fine on my old Powerbook G4 on an old version of AppleScript, but times change and, one whizzy Intel processor later, I'm trying to get the same script running on OS 10.8 with AppleScipt 2.5.1, with varied results.
Basically, what the script should do is read a comma delimited file in the same folder as the script, called 'fileNames.csv' which contains the names of all the files that I want the tiny apps to open. Each item will then have its own file created by the AppleScript, named after each item, which get saved in an pre-existing folder in the same directory as the script and fileNames.csv file, called 'fscommand'.
The example of the fileNames.csv file I'm having issues with:
yr2_unit_1_tn.doc,yr2_unit_2_tn.doc,yr2_unit_3_tn.doc ... etc up until  yr2_unit_20_tn.doc
The script always used to work fine, but the new version of AppleScript seems to have broken it. When I run it now, it creates all the .app files up until 'yr2_unit_11_tn.doc.app' but then stalls in 'Running...' mode in the AppleScipts editor, and refuses to save apps for the final nine files in the .csv file.
It still runs ok from an older AppleScript editor (2.2.1) but this only saves PowerPC applications, which won't run on Intel Macs. And this would be me running away from the problem, rather than attempting to solve it ;-)
I'm thinking it's a filename issue, as it always seems to break when attempting to save "yr2_unit_11_tn.doc.app" when "yr2_unit_1_tn.doc.app" already exists in the 'fscommand' folder. If I create a new 'fileNames.csv' file which only contains ten entries from 'yr2_unit_11_tn.doc' to  'yr2_unit_20_tn.doc', and run the script to an empty 'fscommand' folder, it processes all the files fine. It just won't do all twenty entries from 1 to 20.
Here's the script. I know I'm doing something really stupid here, but as a rock bottom novice AppleScripter, I can't see the error, or why it would work in one version of AppleScript and not another. I can post a link to the zipped files if this is any help in solving it. Thanks in advance for any help! :-)
tell application "Finder" to get folder of (path to me) as Unicode text
set cwd to result
set fileRef to open for access alias (cwd & "fileNames.csv")
set theList to read fileRef using delimiter ","
close access fileRef
set theFolder to alias (cwd & "fscommand")
set theFolderPath to theFolder as string
#Create the .app files and save them in theFolder
set NL to ASCII character 10
tell application id "com.apple.ScriptEditor2"
launch
          repeat with theItem in theList
                    set x to make new document
                    set x to the front document
                    set theCharacters to characters of theItem
                    set theReversedCharacters to reverse of theCharacters
                    set theReversedFileName to theReversedCharacters as string
                    set theOffset to offset of "." in theReversedFileName
                    set theReversedSuffix to text 1 thru (theOffset - 1) of theReversedFileName
                    set theSuffix to (reverse of (characters of theReversedSuffix)) as string
                    set the text of document 1 to "tell application \"Finder\"" & NL & "activate" & NL & "set cwd to get folder of container of (path to me) as Unicode text" & NL & "open file (cwd & \"assets:" & theSuffix & ":" & theItem & "\")" & NL & "end tell"
  compile document 1
                    set file_path to theFolderPath & theItem & ".app"
                    save document 1 as "application" in file file_path
  close window 1
          end repeat
end tell

That seemed to be it. I put a tiny delay in between saving the document and closing the window and the file runs smoothly through all 20 items.
compile document 1
set file_path to theFolderPath & theItem & ".app"
save document 1 as "application" in file file_path
delay 0.3
close window 1
Never thought that I'd reach the day where I was trying to slow the computer down to process something more carefully :-D

Similar Messages

  • Install newer OS version on old mac

    Hi,
    I was wandering if it's possible to install the latest OS version available on an old iMac.
    Here's the specs:
    Processor: 2 GHz Intel Core 2 Duo
    Memory: 1 GB 667 MHz DDR2 SDRAM
    The reason why I'm asking this, is that in order to use the iPad 2, I need a Mac OS X v10.5.8 or later, which I obviously don't have. So, in order to have the new gadget within few weeks, the only solution is to install a new OS on my old mac. If this is not possible, I'll have to use my money towards a new machine first and then the iPad.
    Any suggestion?
    Thanks for your time and consideration to this matter.

    Hi,
    You can upgrade to Leopard v10.5.8 on your iMac.
    Leopard requirements:
    http://support.apple.com/kb/SP517
    You will need to purchase Leopard. Might be better prices elsewhere but start with Amazon as Leopard is no longer available from the Apple online store. I strongly recommend not purchasing from eBay.
    Before you upgrade make sure there's enough free space on the iMac disk. Right or control click the MacintoshHD icon. Click Get Info. In the Get Info window you will see Capacity and Available. *Make sure you always have a minimum of 15% free disk space.*
    Good idea to check out the iPad online manual here before purchasing.
    http://manuals.info.apple.com/enUS/ipad_2_userguide.pdf
    Carolyn

  • Creation of new sort version in T.code OAVI

    Hi  Gurus,
    Can you please help me,
    I am Supposed to create  New sort version(Tcode OAVI), is it possible to create a version with more than 5 fields?
    I am not able to create a sort version, with more than 5 fields,
    If possible , kindly provide a solution.........
    Regards
    VSK

    hi Santosh,
    unfortunately there is no way. It is prohibited in the program (i.e. : only 5 lines are whown for maintenance, if you want to page down to the 6th line, than the first line is shown again)
    ec

  • How to run setup for new datasources without breaking old datasources?

    Hi,
    I am wondering how to install some more data sources (2LIS_05_Q0NOTIF, 2LIS_17_10NOTIF and 2LIS_18_10NOTIF) without breaking the delta mechanism for other data sources when I start to use the new datasources.
    I have installed some QM cubes (0QM_C04, -05, -08 and -11) and delta loads run every night.  Now I want to add two more cubes (0QM_C02 and -03). The new cubes use datasources that are not yet available.
    If I now activate the needed datasources, delete the content of the setup tables again and run 'Application-Specific Setup of Statistical Data' for 'Quality Management', 'Plant Maintenance' and 'Service Management', I am afraid that I will re-initialize the delta queue for the datasources that are already in use... In other words: I am afraid of breaking all datasources in application 05, 17 and 18...
    I cannot find documentation addressing this problem. Any input, anyone?
    Best regards,
    Christian Frier

    Hi all,
    if I understand you all correctly, I can use the following plan:
    0) Wait until no documents are posted on the R/3 side.
    1) Run the delta loads and check that the queues are empty (RSA7 and LBWQ).
    2) Delete the setup tables.
    3) Run the 'Application-Specific Setup of Statistical Data'
    4) Create and execute infopackages for initial dataload (for the new datasources).
    5) Create and execute infopackages for delta loads      (for the new datasources).
    6) Run the infopackages for delta load from the 'old' datasources without running a new initial dataload.
    So basically 6) is the step I worry about.
    That is that I can start to use 2LIS_05_ITEM, 2LIS_17_ITEM and 2LIS_18_ITEM without breaking the delta sequence for 2LIS_05_TASK, 2LIS_17_TASK and 2LIS_18_TASK.
    regards,
    Christian

  • I don't like this new iTunes version 12, old one was better, this version is complicated to use

    its not easy to use, its kinda messed up

    This article has troubleshooting information for that error message:
    https://support.mozilla.com/kb/Server%20not%20found
    Also, it is possible your profile might have become damaged during the upgrade. You could try creating a new one.
    Step 1 is to make a backup of your existing profile in a safe place. More information: [https://support.mozilla.com//kb/Backing+up+your+information Backing up your information].
    Step 2 is to start Firefox in the Profile Manager and create a new profile. More information: [https://support.mozilla.com/kb/Managing+profiles Managing profiles].
    If it works well, step 3 is to move your bookmarks (and other settings if you like) to the new profile. More information: [https://support.mozilla.com/kb/Recovering+important+data+from+an+old+profile Recovering important data from an old profile].
    Hope this helps.

  • When new update for N95 ,the code is 0551989

    Hi body here ,when is the new firmware version for N95(code is 0551989)? my version is V12.1?
    thanks!

    First of all, there is no AppleWorks "staff" - we are all just users like you.
    AppleWorks 6 has not been updated since January, 2004, for the Mac & PC. The odds of another update are "slim & none" since iWork ’05 was announced as "building the successor to AppleWorks." I've not used XP, but have used AppleWorks 6 on Windows 95, 98 & 2000 with it being less stable on each successive version. I currently use AppleWorks 5 on my work PC with Win2K. I had read that AW 5 wasn't stable on Win2K, but it is certainly better than AW 6. When they "upgrade" us to XP Pro next month, I'm going to try to get the "helpless" desk to install my AW 6 again & see how it does. Meanwhile, I find it easier to take my MacBook Pro to work & use it along side the PC.

  • Trying to load illustrator 6cs onto new mac and the old activation code for my ill cs doesn't work with it

    Trying to load a downloaded version of illustrator 6cs onto new mac and the old activation code for my illustrator cs doesn't work with it.  Do I need a new code or am I missing something?  Same goes for my Photoshop cs.

    you need your serial number.
    if you purchased from or registered with adobe check your account, https://www.adobe.com/account.html

  • I moved to a new pc but have the FF profile from the old one and how do I find out which FF version the old FF was?

    I want to use the old version of FF from my previous pc. I saved the profile folder etc on the old pc. The old HD is attached to the new pc via USB. How do I tell what version the old one was?
    After installing the old version on the new pc I want to use the former FF profile file on the new pc installation of FF.
    I have the sessionstore backups etc. from 3/21.
    BTW I typed all this info earlier and support automatically butted in with a guess to what would be an answer. And in the process overwrote what I typed. Please try to get mozilla to prohibit this behavior.

    Sorry to hear that the forum lost your question.
    I'm not sure I understand why you need an old version of Firefox. Were you way behind in updates? Normally when you install the current version, it will seamlessly update/convert any obsolete files in your profile folder to current versions.
    Perhaps I'm answering the wrong question. If the question is: "how do I get a new installation of Firefox to use all my old settings" then I can give you a way to do that.
    ''This assumes you might have data in your new Firefox that you don't want to overwrite and preserves your current profile.''
    Go ahead and open your old profile folder in a Windows Explorer folder. At this level you should see a bookmarkbackups folder, among others. Later you'll copy the ''entire contents'' of the old profile folder to a new location on your C drive.
    '''Overview'''
    These are the steps:
    # Create a new Firefox profile
    # Remove everything from that new profile folder
    # Copy in everything from the old profile folder
    '''Create a new Firefox profile (Windows)'''
    Exit Firefox and start up in the Profile Manager by pasting the following into the Start menu search box (or Run dialog) and pressing Enter:
    firefox.exe -P
    ''Do not delete anything here! Any time you want to switch profiles, exit Firefox and return to this dialog.''
    Click the Create Profile button, assign a name like OldSettings, and skip the option to change the folder location. Then select that new profile in the dialog and start Firefox.
    '''Open the New Profile folder in Windows Explorer'''
    Firefox in the new profile should look like a factory fresh installation. Open the Troubleshooting Information page using either:
    * "3-bar" menu button > "?" button > Troubleshooting Information
    * Help menu > Troubleshooting Information
    * type or paste about:support in the address bar and press Enter
    In the first table, click the "Show Folder" button. Firefox will launch your brand new profile folder in Windows Explorer.
    Leaving that folder open, switch back to Firefox, and Exit. Either:
    * "3-bar" menu button > "power" button
    * (menu bar) File > Exit
    When Firefox closes, the profile folder should be front and center, or you can activate it using the Task bar.
    '''Copy Old Data in Place of New'''
    In that new profile folder, select all the contents and delete.
    Leaving that window open, switch over to your old profile folder. At this level you should see a file named places.sqlite. If that isn't visible, try moving up a level until you find it.
    Select everything (Ctrl+a) and Copy (either right-click > Copy or Ctrl+c).
    Switch to the empty new profile folder in other window and Paste (either right-click > Paste or Ctrl+v). This may take a minute since some of the files are large.
    '''Start Firefox'''
    Firefox should start up in that new profile with the resurrected old profile data. Success?

  • Multiple number change - old to new - CC version

    Hi all,
    Can anyone help me out with the following:
    I got a document which have got around 200 article numbers which need be changed from the old number to a new number, desciption, image etc will not change. I got an Excel list which got the old code in A1 and the new code in B1.
    Instead of changing all the codes by hand one by one, i would like to know if it is possible as a mass change.
    Thanks i advanced
    Best regards,
    Phillip

    Hi,
    So your script could look like:
    var myFilePath = "~/Desktop/oldnew.txt",
    myDoc = app.activeDocument,
    mySource = myDoc.textFrames.add(),
    mySource.place(File(myFilePath) );
    var myStory = mySource.parentStory,
    mTextArr = [],
    paras = myStory.paragraphs.everyItem().getElements(),
    myStyle = myDoc.paragraphStyles.item("articlenumber"),
    currCont, k;
    for (k = 0; k<paras.length; k++) {
              currCont = paras[k].contents;
              if (currCont !="" && currCont.indexOf("\t") > 0)
              mTextArr.push(currCont.split("\t"));
    for (k = 0; k < mTextArr.length; k ++)
              myReplace(myStyle, mTextArr[k][0], mTextArr[k][1]);
    mySource.remove();
    app.findTextPreferences = app.changeTextPreferences = null;
    function myReplace(style, find, change) {
              app.findTextPreferences = app.changeTextPreferences = null;
              app.findChangeTextOptions.wholeWord = true;
              with (app.findTextPreferences) {
                        appliedParagraphStyle = style;
                        findWhat = find;
              app.changeTextPreferences.changeTo = change;
              myDoc.changeText();
    Assumings:
    - oldnew.txt path is Desktop or to modify;
    - txt line is oldnumber - tab - newnumber - enter
    - there is a para style "articlenumber" defined and applied to each old number to be changed
    Jarek

  • I cannot locate my cs6 redemption code and I just purchased a new computer because my old one doesn't work anymore. How can I get my photoshop on this computer? All my other products are registerd with a serial number

    I cannot locate my cs6 redemption code and I just purchased a new computer because my old one doesn't work anymore. How can I get my photoshop on this computer? All my other products are registerd with a serial number

    The activation servers for CS and CS2 stopped working and were taken down. You'll need to take a look at this link for your issue: https://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.ht ml
    Benjamin

  • I use an Iphone 4 which had to be replaced recently. However when i did a backup it was on the new IOS version 7, but now that my phone was replaced and i am back on the old IOS version 6 i how do i restore my backup??

    I use an Iphone 4 which had to be replaced recently. However when i did a backup it was on the new IOS version 7, but now that my phone was replaced and i am back on the old IOS version 6 i how do i restore my backup??
    When i try to restore my Back up using Itunes this is the message i get - "Unable to restore backup as the software is old - Please setup as a new device and then try to restore your backup" - Please advise. If i do so are there any chances of loosing my data. At this point in time i would be happy if i could just retreive my contacts list. Any suggestions would be greatly appreciated.

    Nope - you cannot restore a backup from a newer iOS version on to a device running an older iOS version.  The reverse works, but in your case to use your backup, you must update to iOS 7.0.3 - no other option if you want to use that backup.

  • I just bought a new computer.  My old computer was a 32bit system but my new one is a 64bit.  I own ps cs6.  My question is"will I be able to deactivate ps on my old system, and download the 64 bit version and install and activate it or do I have to buy t

    I just bought a new computer.  My old computer was a 32bit system but my new one is a 64bit.  I own ps cs6.  My question is"will I be able to deactivate ps on my old system, and download the 64 bit version and install and activate it or do I have to buy the 64bit version in order to move forward.

    Nope, you can install it on your new computer with no issues. The disc contains both the 32 and 64 bit versions.
    Benjamin

  • After much consideration, today I decided to join Adobe Photoshop CC only to discover it is not available to me as my laptop has Windows Vista.  What are my options other than having to buy a new computer or an old version like Ps5 or 6?

    After much consideration, today I decided to join Adobe Photoshop CC only to discover it is not available to me as my laptop has Windows Vista.  What are my options other than having to buy a new computer or an old version like Ps5 or 6?

    1-Do some more reading about a Windows "upgrade version" which, according to my experience, does NOT require you to format your drive... it upgrades over what you have, without disturbing installed programs... at least that is what happened the ONE time I installed an upgrade version, so I can't give a 100% assurance it will work that way with your computer... search link for all things Microsoft http://search.microsoft.com/search.aspx?mkt=en-US&setlang=en-US
    2-Depending on the hardware you have, you may not be able to run CC programs well, if at all
    3-CS6 is 3+ years old and is the ONLY non-CC version still being sold... unless you can find a "legal" CS5 somewhere
    Old or Used Software http://www.emsps.com/oldtools/
    http://forums.adobe.com/message/1636890 warns about buying from eBay

  • Moving all records- old  code (G/L/Cust/Vend) to new code (G/L/Cust/Vend)

    Hi Friends,
    I have created a customer code (say for e.g. C001 for  ABC LTD.), and did some SD & FI transactions (data entry) using that code.
    After few days, I realized that this above stated customer code (C001) is not correct. So I blocked this customer code (C001 stated above) from doing further transactions.
    Then, I opened a new code for this same above stated customer (ABC LTD.). The new code is now (say for e.g. C005 for ABC LTD.).
    From now onwards I can do transactions in C005. But I want to transfer (in one shot / in one go) - all the previous old FI & SD transactions / records of C001 into C005.
    SAP provides a standard Transaction Code for doing this in one shot; but I have forgotten that.
    By running that transaction code, I can move all records from old customer code (C001)to the new customer code (C005).
    Can anybody please help.
    Same facility (SAP Standard Transaction Code) exits for Vendor Codes as well as G/L Codes also.
    I mean to say that there are SAP Standard Transaction codes available - one each for G/L / Vendor / Customer
    i.e.
    To move all previous entries / records from old G/L / Vendor / Customer code(s) to New G/L / Vendor / Customer code(s) in one shot / in one go.
    I will definitely reward points to everybody who tell me those TCodes.
    Regards,
    Rajeev.
    Message was edited by:
            Rajeev Sharma

    You can use F-30 to transfer invoices, however you need to consider a few things here.
    If you have billed via SD it may be worth issuing a credit for all of the invoices, and creating a new sales order for the new customer. This will help in the future if you want to analysis the total amount you have sold to this customer, as there may be some rebates due or something similar.
    You could also look at FBR1.
    You can use this to create a copy of the original document and then change the customer or vendor number, you must then also remember to reverse the posting to the first customer.
    Award points if this is useful.

  • I can't connect to the new downloaded version of Skype, as my old one is in the way, and don't know how to get rid of it.

    I can't connect to the new downloaded version of Skype, as my old one is in the way, and I can't get rid of it.  what do I do?

    We'll need more details.
    What happens when you drag the old version to the Trash?

Maybe you are looking for

  • Moving SharePoint back up files to different server

    hi friends i have back up file (.bak) of SharePoint 2013 web application. i want to restore this .bak file to another SharePoint 2013 server. is it possible ?

  • How to Save for Web in the correct size?

    So i created a new project in Illus. CS5 with an artboard size of 700x150 pixels. I have two graphics in there that are about 215 pixels tall so part of it flies off the artboard, but i have a clipping part that hides all the parts that i dont want t

  • Distribution of Costs from CCA to CO-PA

    Hi All, Can someone please help me find a solution to the following scenario? There is a requirement to distribute costs from CCA to Cust/Prod level in CO-PA. *The cost allocations factors can only be provided at the Customer Group/Product level. *Us

  • Employee Discount (from the company you work for, not Verizon employee)

    When trying to pre-order or now order an iPhone 4s while logged in to our account we get a message: "Employee Discounts will not be applied to this order, do you want to proceed?" If you say no then you exit, if you say yes then sure enough the voice

  • Cannot edit the Abap program

    Hello everybody Im new in SAP, I run the minisap when user bcuser and ddic but tell me no have permision for create, I need other user please tell add new user for work in  edit abap