Applescript to convert from AW6 spreadsheets to Excel

I have an iMac (iMac12,2) running OS 10.9.1 with applications of Pages’09 (4.3), Pages (5.0.1), Numbers’09 (2.3) and Numbers (3.0.1) available.
One of my laptops is a MBA (MacBookAir1,1) that I have kept at 10.6.8 with applications Appleworks (6.2.2) and Appleworks (6.6.9) available.
Recently, I converted many CWWP documents from AW6 into Pages.  This was done on the iMac with an Applescript that copied a file (AnyDocumentCWWP) to the desktop as a file named AWV6, opened AWV6 with Pages’09, saved the result as AWV6.Pages, applied the creation date and modify dates of the original to AWV6.Pages, moved the new AWV6.Pages to the original directory and moved the original file to the trash, renamed AWV6.Pages to the original filename (excluding extension).  The Pages version of the original document does not preserve the formatting of the CWWP, but the content was now discoverable with Spotlight.  Since I was primarily concerned with the content, I would consider the conversion effort successful enough.
I performed the same sort of process on the iMac with CWSS documents converting from AW6 into Numbers.  Here the results were less successful.  I discovered that many of the converted spreadsheets had cells where the cell contained the last calculated value in substitute for the formula originally present -or- Numbers was unable to open the CWSS spreadsheet due to size limitations.  Neither problem occurs when the file is converted on the MBA by Appleworks into an Excel format.  For those CWSS files that did not properly convert to Numbers, I would like to perform a conversion to Excel.
When a given spreadsheet is manually opened on the MBA with either version of Appleworks, one can “Save as” using several formats of Excel.  That operation will preserve the formula which cannot be recognized in Numbers’09. An example of this issue is when a spreadsheet has a cell that contains a formula with the function “ISNUMBER”.  When I manually open a CWSS in Appleworks (either 6.2 version), I can Save As Excel Win 97 … or Excel Mac 98 … creating an XLS file that preserves the formula.
I have attempted two techniques with Applescript to be able to convert my CWSS documents into XLS format.  Neither seem to work.
The first technique is very similar to a few lines extracted from a canned script found on http://macscripter.net/viewtopic.php?id=8296 the relevant code is:
set theSprTranslator to "Excel Win 97, 2000, XP 2002 spr"
tell application "System Events" to set mfpath to get path of disk item ("~/desktop/" as string)
set newfile to (mfpath & "AWV6" as string)
set NewFilename to AWV6XLS
tell application "AppleWorks 6"
    activate
    open newFile -- alias reference is ok
    save using translator theSprTranslator with NewFilename and replace
    close front document without saving
end tell
When this did not work, I attempted a scripted GUI solution as a second option.  The GUI code I had found at http://stackoverflow.com/questions/17348326/applescript-to-save-an-appleworks-do cument-wont-compile-end-tell-vs-end-easy is:
tell application "System Events"
         tell process "AppleWorks"
                 click menu item "Save As…" of menu "File" of menu bar 1
                 click menu button "File Format" of window "Save : AppleWorks 6"
                 click menu item "Excel Mac 5 spreadsheet" of menu 1 of menu button  "File Format" of window "Save : AppleWorks 6"
                 keystroke return
         end tell
end tell
Unfortunately there is no “File Format” menu button, after a bit of further research, I discovered UI Browser and wrote my own Applescript equivalent:
set mytempwork1 to AWV6
set theSprTranslator to “Excel Win 97, 2000, XP 2002 spr”
tell application "Finder" to open file (mytempwork1 as string) of the desktop
tell application "System Events"
    tell process "AppleWorks"
        click menu item "Save As…" of menu "File" of menu bar 1
        tell text field 1 of window "Save : AppleWorks 6"
            set value to "XX" & mytempwork1
        end tell
        click pop up button 1 of group 1 of window "Save : AppleWorks 6"
        click menu item theSprTranslator
        —click radio button 2 of group 1 of window "Save : AppleWorks 6"
        —delay 3
        —click radio button 1 of group 1 of window "Save : AppleWorks 6"
    end tell
end tell
tell application "System Events"
    tell process "AppleWorks"
        delay 10 — <<<<<IF YOU CLICK ON THE BUTTON WHILE IN THIS DELAY, THE SCRIPT WILL BEHAVE PROPERLY
        click button "Save" of window "Save : AppleWorks 6"
        delay 1
    end tell
end tell
This GUI script behaves almost as I would like.  It seems to ignore the setting of the “pop up button 1” unless I actually intervene while the script is running and I click on the button.  When I do so, the script runs as intended.
Is there a way to force Appleworks to recognize the Applescripted value of the “clicked” menu item?

Hello
As far as I know, there's no need to resort to GUI scripting. The problem in exporting in AppleScript is that AppleWorks 6 only accepts typeChar (TEXT) data as translator name while AppleScript string has become always being represented as typeUnicodeText (utxt) since OS X 10.5. This makes passing translator name to save command difficult but there's a workaround method as shown in the sample code below. The |TEXT|() handler does the job. Tested with AppleWorks 6.2.4 under 10.6.8.
main()
on main()
    set export_translator to "Excel Mac 98, 2001 spreadsheet"
        "Excel Mac 5 spreadsheet"
        "Excel Mac 98, 2001 spreadsheet"
        "Excel Win 5 spreadsheet"
        "Excel Win 97, 2000, XP 2002 spr"
    set export_translator_TEXT to my |TEXT|(export_translator)
    set src to (path to desktop)'s POSIX path & "in.cwk"
    set dst to (path to desktop)'s POSIX path & "out.xls"
    set srca to src as POSIX file as alias
    set dsta to touch(dst) as POSIX file as alias
    tell application "AppleWorks 6"
        --return export translators
        open srca
        tell document 1
            if document kind = spreadsheet document then
                save in dsta using translator export_translator_TEXT
            end if
            close saving no
        end tell
    end tell
end main
on touch(f)
    do shell script "touch " & f's quoted form
    return f
end touch
on |TEXT|(u)
        string u : source text
        return data : «data TEXT...» representing u converted to MACROMAN encoding
    do shell script "u=" & u's quoted form & "; printf '%s' \"$u\" | iconv -f UTF-8 -t MACROMAN | xxd -p"
    run (run script "
script
    «data TEXT" & result & "»
end script")
end |TEXT|
Hope this helps,
H

Similar Messages

  • How long does it normally take to convert from PDF to Excel files?

    How long does it normally take to convert from a PDF to Excel files?

    Sara-
    I did see your response.  Thanks.  The other thing that happened was after I enabled Adobe on my Dell it apparently knocked out my Mozilla.  Now I can't get internet connection unless I use Internet Explorer which I would prefer not to.  I'm going to visit our IT folks tomorrow and see if I can get some of this resolved.
    The PDF files I obtained that I am trying to transfer to Excel may be too complex because there is a great deal of extraneous text information in the basic document that lies outside of the tables I want to transfer.  I'm going to try and highlight the tables only and see if this works.
    Thanks for taking the time answering.
    Best,
    Henry

  • How to I convert data from oracle database into excel sheet

    how to I convert data from oracle database into excel sheet.
    I need to import columns and there datas from oracle database to microsoft excel sheet.
    Please let me know the different ways for doing this.
    Thanks.

    asktom.oracle.com has an excellent article on writing a PL/SQL procedure that dumps data to an Excel spreadsheet-- search for 'Excel' and it'll come up.
    You can also use your favorite connection protocol (ODBC, OLE DB, etc) to connect from Excel to Oracle and pull the data out that way.
    Justin

  • Converting from excel 2004 to ical with Snow Leopard

    tried to import data via iCalMaker but was informed by the software maker that they don t support Snow Leopard. So ... a bit lost.
    I have the custom of preparing data in Excel, and would want to import some data into iCal. However I cannot find a good converter from either tab (preferred) or csv to ics. Similarly have no experience with applescripts and other fancy things. Is there somewhere an easy system to convert?

    Ali,
    Appears the iCal and Excel "wizards" forgot to supply us with a simple and much need way to import excel events, dates, birthdays, games etc. from excel to iCal..
    ...even the "wizards" at Ms Office 2011 do not allow an easy import from MS Office 2011 Excel to MS Office 2011 Outlook/Calendar...
    ...Yikes

  • How to convert an output retrieved from database to an excel sheet?

    Hello friends,
    I am preparing an online JSP based project for our training and placement department.
    In this context, I am showing an output into a JTable format to the user for the shortlisted candidates by retrieving this information from my database (MySQL).
    Now I need to convert this output into the Excel Sheet so that I can perform various operations over there.
    So, what are the things required to perform from my side for implementing the same.

    The easiest thing for you to do would be to save it as CSV (Comma Separated Values). In general, your fields would be separated by commas, and any fields that are not numbers would be surrounded with double quotes:
    1,"text",...
    Dates and times are semi-tricky, but excel is pretty good about accepting "YYYY/MM/DD" and "HH:MI AM" format.
    Other than that, you'll be learning the internal structures of Excel or perhaps there is a third-party library that can do this for you...

  • How do I maintain column formatting when converting from PDF to Excel?

    How do I maintain column formatting when converting from PDF to Excel? All info is no longer on the lines or in the columns they started out being in? Any help would be appreciated.

    Sara,
    Perhaps I am expecting too much from Adobe ExportPDF. The reason I subscribed to this service, for which I pay a yearly fee, was that I need a way to  convert scanned and digital documents to Word &/or Excel. I read the link you included but to be candid the more I tried to understand what was written the more confused I got. The process should not be this difficult. Currently I am using a NEAT scanner to create PDF documents of whatever I scan. After I changed the OCR setting on Adobe ExportPDF the output was much better but not to the point it was usable as it was. Information that appears to be lines and columns are sometimes not recognizing two columns and just putting them together in one. Obviously not usable. The other thing it does is bunch numbers that appear in a column that are just a bunch of numbers that I have no way of fixing. 
    Please let me speak to someone who can help me. Right now I not getting anything of value in my paid subscription.

  • Converting from PDF to excel

    I have just been upgraded to Windows 7 and I am now unable to convert a PDF document to excel or word.  When I press convert it comes up with an error message.
    "An Error occurred while signing in"
    Also when I log into Adobe Export PDF it comes up with a blank page.

    Hi Wendy,
    Have you rebooted your computer and cashed your cookies, etc?
    Let me know!
    Kind regards, Stacy

  • Can I convert many XMLs into one Excel Sheet?

    Hi:
    I get 20-30 XMLs daily from client and I want them all converted and merged in single excel sheet through AppleScript. Can any one help?
    Thank you.

    Hi:
    I get 20-30 XMLs daily from client and I want them all converted and merged in single excel sheet through AppleScript. Can any one help?
    Thank you.

  • Having trouble converting array to spreadsheet string, storing the file and coverting back to array with complex numbers

    I am working with a network analyzer. I have arrays made of 5 columns the first consisting of an integer and the next four consisting of complex numbers. I am converting the array into a spreadsheet string and then saving the file using the write characters to a file VI. That seems to work well as when I open the file in Excel all the data is there. However when I try to reverse the process, open file and convert back to array, I loose some of the data. Specifically the imaginary parts of my complex numbers are all going to zero. I have narrowed down the problem to be in the conversion from spreadsheet string to array and vice versa. I
    think the problem may be with the 'format' input to the VI. I do not have an adequate resource for this so I am not sure what to put in to accomplish my task. Any takers?

    Hi Biz
    I don't think there is a direct way of converting a complex number to a
    string, so when you convert the array to a spreadsheet string, the
    numbers would be converted to real data.
    However, you could try separating the real and imaginary parts using the
    "Numeric: Complex to Re/Im" function, and then store these - either in
    separate files or in adjacent columns/rows in the same file. Then, when
    you read in the data again, use the "Numeric: Re/Im to Complex" function
    to put the two "halves" together.
    If you actually want Excel to interpret the numbers as imaginary, then
    you'll probably want to create a string for each complex number of the
    form "Re + Im*i" (after separating the Re and Im parts), by using
    "String:Format into String" with 2 numeric inputs and the format string
    "%f+%fi".
    Reading the data back into Labview then would require splitting the
    string into the 2 pieces by using "Stringcan from String" with 2
    numeric outputs (smae precision as original numbers specified by the 2
    Default Value inputs) and the same format string "%f+%fi", and then using
    the above-mentioned "Numeric: Re/Im to Complex" function. It worked for
    me, so if you can't follow what I am describing, send me an email and I
    can email you what I did (LV 5.1.1).
    Paul
    Biz wrote:
    > Having trouble converting array to spreadsheet string, storing the
    > file and coverting back to array with complex numbers
    >
    > I am working with a network analyzer. I have arrays made of 5 columns
    > the first consisting of an integer and the next four consisting of
    > complex numbers. I am converting the array into a spreadsheet string
    > and then saving the file using the write characters to a file VI. That
    > seems to work well as when I open the file in Excel all the data is
    > there. However when I try to reverse the process, open file and
    > convert back to array, I loose some of the data. Specifically the
    > imaginary parts of my complex numbers are all going to zero. I have
    > narrowed down the problem to be in the conversion from spreadsheet
    > string to array and vice versa. I think the problem may be with the
    > 'format' input to the VI. I do not have an adequate resource for this
    > so I am not sure what to put in to accomplish my task. Any takers?
    Research Assistant
    School of Physiotherapy, Curtin University of Technology
    Selby Street, Shenton Park, Western Australia, Australia. 6008
    email: [email protected]
    Tel. +61 8 9266 4657 Fax. +61 8 9266 3699
    "Everyone who calls on the name of the Lord will be saved." Romans 10:12
    "For all have sinned and fall short of the glory of God, and are
    justified freely by his grace through the redemption that came by Christ
    Jesus." Romans 3:23-4

  • MS Project - can you merge from a spreadsheet/access database based on task names?

    I'm wondering if it's possible to import data on certain tasks from a spreadsheet or access database. I know you can import tasks and append them, but I was hoping to:
    - Match a task name with the task name on the spreadsheet/access database
    - Update that task in MS project with information/fields in the spreadsheet/access database
    Can this be done? Thanks.

    Hi,
    In regarding the issue, my understanding is that you want to use Excel spreadsheet as database for the Project.
    I recommend you develop an import map that includes the key fields. Please refer to the link and do it step by step:
    http://www.techrepublic.com/blog/tech-decision-maker/importing-a-vendors-excel-schedule-into-microsoft-project/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    If I misunderstanding something, please let me know and upload some sample about the Excel spreadsheet.
    Regards,
    George Zhao
    TechNet Community Support

  • I converted from a PC to a Mac Mini.  I have my PC documents backed up on a DVD disk.  I have an external DVD drive connected to the Mac Mini.  I want to open them up and save them to the Mac, BUT....when I put the DVD disk in the Mac is NOT reading it!

    I converted from a PC to a Mac Mini.  I have my PC documents backed up on a DVD disk.  I have an external DVD drive connected to the Mac Mini.  I want to open these documents up from the DVD storage and save them to the Mac, BUT....when I put the DVD disk in the Mac is NOT reading it!

    Hi Joe,
    Thanks for your quick response.  I should add....it worked before.  When I previously inserted the two DVDs into this remote drive, and I went into finder, I could click on the "remote device" line and see all my saved documents (excel, word, etc) on the DVD and open them on the Mac.  Now I cannot see them, when I try to open them on the Mac, nothing happens, nothing is displayed.  I just re-tested the remote DVD drive with a CD and, no problem, it opened up the CD via iTunes and I cold play the CD.  SO......I know the remote DVD drive (it's an LG by the way) is fine, it's something to do with some settings on my mini mac,especially where I could open it previously.  I do not remember changing any settings since then. 
    When I go into system preferences and click on CD/DVD it gives me options of how to open up a music CD (default is iTunes), a DVD (default is iMovie), etc.  The problem is my DVD is all miscellaneious files/documents.  I just want to be able to see them in the finder.  I also tried to open them via microsoft word, from the remote disk and again, it could not open the drive, even though some of the documents were microsoft word documents.  Again, I was able to open them previously and the DVD is not corrupted in any way.  
    Any additional advice? 
    Thank you!

  • Upload data from multiple worksheets of excel file into SAP by using MIME?

    Hi all,
    I'm trying to getting the data from a multiple worksheet excel file by usin the MIME Repository.
    First of all i realizied it like [here|http://abap-explorer.blogspot.com/2008/12/upload-data-from-multiple-worksheets-of.html] in a normal ABAP Report.
    By trying to transfer the code to a WebDynpro Component, i get problems.
    With this part of code, because ActiveX is not allowed in our Webbrowser. So i have to find another solution to get the data from the excel file.
    CALL METHOD c_oi_container_control_creator=>get_container_control
    IMPORTING
    control = iref_control
    error   = iref_error
    I tried to rebuild this solution in webdynpro. But it dont works.
    So my next step was trying to Read the Excel sheet directly from MIME by getting the Content (XString).
    But there is no useful information Just a mix out of '######' and other symbols.
    By converting it into String the same problem.
    Maybe someone has an idea how to rebuild [this code|http://abap-explorer.blogspot.com/2008/12/upload-data-from-multiple-worksheets-of.html] in Webdynpro that it works correctly.
    Currently Im Using the Fileupload UI Element. All Works fine. I can Upload the Excel file to MIME Repository and i can open it from there.
    But i cant get the same clear informationen from the file, to write it later in a Database, like before without webdynpro.
    i hope someone can help me.
    Edited by: Sascha Baumann on Apr 20, 2009 4:28 PM

    You can't read the native binary Excel Format in server side ABAP.  The functions and classes that did this in Classic Dynpro used OLE Automation via the SAPGUI Control Framework to remotely control Excel to read the data.  Because in the browser you have no connection to the SAPGUI or are sandboxed inside the browser; the same functionality is not possible. 
    I would suggest that you look into saving the Excel file as a open, text format.  You might be able to use XML (although the Excel XML format can be complex) to support multiple sheets. You would have to build the logic yourself (using XSLT or the iXML parser) to process the XML format back into ABAP data.

  • Converting from WORD to pdf always fails the first time

    OS is XP. Acrobat Pro 8.1.5. When I first convert from WORD, EXCEL, whatever the program appears to be working but no file is created.  This happens always on the first time I convert to pdf for the day.  Once I do it again, it works and continues to work throughout the day.  I turn off my computer at night and again the next day when I come in it doesn't convert the first time but will work again.  Is there something in Windows or Acrobat that I can fix to get this to work properly?

    If you are using Word 2007 (you don't say) you might try the Microsoft plugin... this is instead of Acrobat
    http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87 041&displaylang=en
    If you are using an earlier version of Word (or Word '07) make sure you have installed all Microsoft Office updates, so you'll know this is not a Microsoft bug

  • After 9.3 update getting error printing to Adobe PDF while converting from Powerpoint to PDF

    That happened after upgrading Acrobat Pro 9.1.2 to 9.2->9.3 on Windows XP sp2 platform. Converting from other Microsoft Office 2003 products is totally normal(Excel, Word) Did anyone came accross and know how to fix that?? We have many users with exactly same issue.

    thanks...figured out my problem!
    Date: Wed, 3 Feb 2010 12:24:29 -0700
    From: [email protected]
    To: [email protected]
    Subject: Re: After 9.3 update getting error printing to Adobe PDF while converting from Powerpoint to PDF
    What happens if you try to print to the Adobe PDF printer?
    >

  • Applescript to update multiple Linked Files Powerpoint-Excel

    Hello all,
    I have a powerpoint presentation with many linked fields that are sourced from an excel workbook. To update these in Microsoft Office 2004 and 2008, I have to manually click on each, update it, etc. It simply takes forever to complete when there are 50 fields... On top of that, this has be done multiple times per week.
    Is there an AppleScript that exists to do this automatically? I have searched for a long time and have yet to find one.
    Ideally this would work with both Office 2004 and Office 2008 for mac. Any help would be appreciated, as I am pretty unfamiliar with coding AppleScript. Again, I need a script that will update parts of my powerpoint presentation from data in my excel workbook.
    Thanks,
    Charlie

    I started with something pretty simple like this, but I do not really know what might be missing or anything ...
    tell "Microsoft Powerpoint"
      update links active presentation
    end tell

Maybe you are looking for

  • Kobo and library books

    Now that I've downloaded a book from the library, How do I get it on to the Kobo?  It's really frustrating.

  • ActionListner question

    Hi, I am pretty new to swing. I am creating a menuItem and also a toolBar item which both listen for the same event SamAction copyAction = new SamAction("Copy", new ImageIcon("copy.gif")); copyItem = editMenu.add(copyAction); copyItem.setIcon(null);

  • Putting iTunes list from G5 to a Windows Vista computer

    My son has recently purchased a new windows computer ( his problem , and mine now too I guess ) and he wants to transfer all his music from the G5 to it. He has it all on a backed up on a Lacie hard drive that has Firewire, but the new windows comput

  • Best way to transfer iphoto library to Picasa -- I've given up on iphoto

    Iphoto just causes too many problems. All I ever do is import from my camera and things seem fine. I just checked the 357 pictures from NY that I have, and found it duped every one. I then saw an option called duplicate unders 'photos' so I assumed t

  • Cannot connect PPC to Intel

    I have a G5 PPC running OS 10.4.11, and a MacPro desktop running OS 10.5.4. They are connected tom each other via ethernet. I can connect TO the PPC FROM the Intel with no problem, but when I try and connect TO the Intel FROM the PPC, the PPC won't f