Script to change a character in a file and opening it in Numbers

Hello,
Is there an easy way with Applescript to replace all the "," with a "; " in a csv file and open it in Numbers ? The best would be to be able to drag/drop the file over an icon in the dock to do that.
Thank you

Yes, it's easy to do, but depends on the complexity of the csv file. For instance, if you're sure that the csv is simple (in the sense that commas only appear as delimiters and never occur inside text data), then the following will work. Save it as a script application and then drop your files on it):
on open csvFiles
          repeat with thisFile in csvFiles
                    set fp to open for access thisFile with write permission
                    set csvText to read fp
                    set csvSplitText to tid of csvText by ","
                    set csvNewText to tid of csvSplitText by ";"
  set eof fp to 0
  write csvNewText to fp
  close access fp
          end repeat
end open
on tid of input by delim
  -- handler for text items
          set {oldTID, my text item delimiters} to {my text item delimiters, delim}
          if class of input is list then
                    set output to input as text
          else
                    set output to text items of input
          end if
          set my text item delimiters to oldTID
          return output
end tid
If you have a more complx csv format and you have to account for commas that are within text data, then it would help to know more about the structure of the document. I mean, it could be done generically, but I'd rather not fiddle with the code if I don't have to.

Similar Messages

  • HT2493 How to change preview image of a file and NOT the icon ?

    Hello dear Mac users
    How to change preview image of a file and NOT the icon ?
    I know how to change the icon of a file, but I wish to know how to change the preview of any file.
    For example: my file is "mysong.aif", I changed the icon to be "mylogo.png" using cmd+i, cmd+v on the icon. But the preview of the file still remain the same.
    I know it can be changed using iTunes, but I don't want to import all my files in iTune, and iTune cannot import all type of files.
    I hope someone will understand my needs...
    Thanks!

    Thanks BeerbarX
    You can't change the preview image for anything
    hoo
    QuickLook plugin
    what are the plugin ?
    In the case of a music file, it will be that generic black box with a note on it
    That is exactly what I'm asking about !
    MP3 which has a special tagging standard that can include artwork
    How can I "tag" my MP3 without going thru iTunes ? Is it possible to do it dirrectly in the Finder ? Is there other type of files that can include such tags ?
    Thank you for answering my question , wich I have to admit may seem useless, but I wish I could put something like a signature logo on each of the different file I produce (as AIF for music and MP4 for video clip) instead of that generic black box with a note on it, and by the meantime keeping a different icon for all of them in order to illustrate theire content.

  • HT201303 Hi trying to change my credit card on file and it won't let me

    Hi,
    Trying to change my credit card on file and it won't let me.

    Why won't it let you? Is there an error? More information is needed to assist you.

  • Big Colour and detail changes between Original Nikon RAW files and the images created on the Preview page!

    Big Colour and detail changes between Original Nikon RAW files and the images created on the Preview page! Yes there are distinct visual changes when I preview my Nikon NEF RAW Files.Please note I do not use iPhoto at all.
    If you view it as a contact sheet straight from the original folder there are no alterations but the moment you double click and want to 'Preview' it, this new preview page introduces very noticeable distortions : lighter shading goes missing and colour goes darker e.g orange turns red and mid blue goes deep blue!  Alarmingly the little column on the left of the preview page showing the collection shows the original file colours and then after a few seconds show the new distorted image...you can see this visible change and it takes place after a few seconds once you double click! Also if you use Apple's 'Cover Flow' to preview, this function will replace your original RAW file with the new 'altered preview' image!
    I have raised this with Apple but they have yet to reply...has anyone ever experienced this? I have used my Mac book for 18months only noticed it about 5 days ago!
    I went to Apple store and we tried it in other laptops and Macs and it happened to all of them so we think this is a software issue and not down to the laptop.
    Any help is much appreciated!

    Big Colour and detail changes between Original Nikon RAW files and the images created on the Preview page! Yes there are distinct visual changes when I preview my Nikon NEF RAW Files.Please note I do not use iPhoto at all.
    If you view it as a contact sheet straight from the original folder there are no alterations but the moment you double click and want to 'Preview' it, this new preview page introduces very noticeable distortions : lighter shading goes missing and colour goes darker e.g orange turns red and mid blue goes deep blue!  Alarmingly the little column on the left of the preview page showing the collection shows the original file colours and then after a few seconds show the new distorted image...you can see this visible change and it takes place after a few seconds once you double click! Also if you use Apple's 'Cover Flow' to preview, this function will replace your original RAW file with the new 'altered preview' image!
    I have raised this with Apple but they have yet to reply...has anyone ever experienced this? I have used my Mac book for 18months only noticed it about 5 days ago!
    I went to Apple store and we tried it in other laptops and Macs and it happened to all of them so we think this is a software issue and not down to the laptop.
    Any help is much appreciated!

  • HT3986 I've had MS Office:mac 2011 on my imac for around 18 months now.  Outlook has just disappeared and when I find the file and open it it tells me that there is a problem and I may need to re-install it.  I've just done this using the installation dis

    I've had MS Office:mac 2011 on my imac for around 18 months now.  Outlook has just disappeared and when I find the file and open it it tells me that there is a problem and I may need to re-install it.  I've just done this using the installation disc which, then said the installation had been successful.
    Outlook is still not working.  Can anyone please advise me on what to do next.

    Remove MS Office 2011 completely (here are instructions) and reinstall it.
    It's not a simple or fast process but it is important to follow all of the steps in order to get all the files that Office scatters around. This will not affect your data files, only MS Office and its preferences.

  • I have text documents in my email folders which I can't open.They are PDF files and Open Office files.How do I open these documents or type additional text documents?

    I have text documents in my email folders which I can't open. They are PDF files and Open Office documents. How do I open these documents?

    These are the "out of the box" file formats that you can view on the iPad as mail attachments. If the file is not listed here, you cannot view it without a compatible third party app. What is the file extension?
    Viewable document types: .jpg, .tiff, .gif (images); .doc and .docx (Microsoft Word); .htm and .html (web pages); .key (Keynote); .numbers (Numbers); .pages (Pages); .pdf (Preview and Adobe Acrobat); .ppt and .pptx (Microsoft PowerPoint); .txt (text); .rtf (rich text format); .vcf (contact information); .xls and .xlsx (Microsoft Excel)

  • How do I download a received e-mail into a program "directory file" and open it later by a related program with a different name.

    Each week day afternoon I receive an e-mail bulletin and previously, using AOL, I downloaded it into a directory file located as a part of computer programs and then read it later with a related program with a slightly different name. Now when I try to do this using Mozella Firefox I don't see a way to download the e-mail bulletin into the directory program file and open it with another program related to the directory program. Firefox only shown the file name to read the download with but doesn't give me an option to download it to the program directory file. Please give me some detailed instructions.

    Hello Explorer.ph
    If safari recognizes it as a PDF then when you open it, you should see something in the right corner below the search box that says open in "" and another with "open in another app". If not try tapping the middle of the screen once tomake it appear. You may need to download iBooks, which is free from the AppStore ,to have an app to download it to.
    I hope this helps.
    Imaestro

  • Change the package of boudle files and pagedef files

    I need to change the default package for bundle files and pageDefs files to new package
    now i am changing the files manually , and I need automatically method to do that
    I am using bundle file for each file

    Scrolled through the Preference but count find any for web layer. there are option available for Model layer though. EOD runnig a batch script will do the work and you can configure the batch script to run for IDE

  • Shell scripts to read data from a text file and to load it into a table

    Hi All,
    I have a text file consisting of rows and columns as follows,
    GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
    GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001 My requirement is that, i should read the first 3 columns of this file using a shell script and then i have to insert the data into a table consisting of 3 rows in oracle .
    the whole application is deployed in unix and that text file comes from mainframe. am working in the unix side of the application and i cant access the data directly from the mainframe. so am required to write a script which reads the data from text file which is placed in certain location and i have to load it to oracle database.
    so I can't use SQL * loader.
    Please help me something with this...
    Thanks in advance.

    1. Create a dictionary object in Oracle and assign it to the folder where your file resides
    2. Write a little procedure which opens the file in the newly created directory object using ULT_FILE and inside the FOR LOOP and do INSERTs to table you want
    3. Create a shell script and call that procedure
    You can use the post in my Blog for such issues
    [Using Oracle UTL_FILE, UTL_SMTP packages and Linux Shell Scripting and Cron utility together|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com

  • My file was changed from psd to "5 file" and won't open

    Hi,
    I just spent 2+ hours woking on a difficult mask, saving as I worked.
    I left for dinner and closed down photoshop.
    When I returned I couldn't open my file.  This message appeared:  could not complete your request because it is not the right kind of document
    The file is no longer a psd is a "5 file".
    Any suggestions to what happened to my file and how can I get ps to open it?
    Thanks,
    Alison

    AlisonKaMail wrote:
    Hi,
    I just spent 2+ hours woking on a difficult mask, saving as I worked.
    I left for dinner and closed down photoshop.
    When I returned I couldn't open my file.  This message appeared:  could not complete your request because it is not the right kind of document
    The file is no longer a psd is a "5 file".
    Any suggestions to what happened to my file and how can I get ps to open it?
    Thanks,
    Alison
    It sounds like you have Windows set to hide the extension of common file types, which means that a photoshop file called Pix03.psd will show up in Windows Explorer and in file open/save dialogs as Pix03 with the file type Photoshop file.  This is not desirable because it means you don't know what your files are actually named.  It also makes it harder to fix situations like this. 
    I would strongly suggest that you open Windows Explorer (My Computer icon, or WindowsStart+E), then go to Tools > Folder Options > View and UNcheck "Hide extensions for known file types."  
    Once you've done that, you will see your file names as Pix03.psd (the ".psd" is the "extension" that you need to see).  In Windows Explorer, or a File Open dialog with the criteria set to All Files (*.*), find the file you are having trouble with.  It will have a .5 extension, like Pix03.5.  Click on it once, wait a second, and click again.  This will let you rename it.  All that you need to change is the extension, so click at the end, backspace over the "5" and replace it with "psd".  That should make your photoshop file openable in Photoshop again.

  • How to insert special character in sgm file and interprete it without isoents while opening in FM9.0

    I have an sgm file which contains special characters in different languages.
    <!DOCTYPE MANUAL PUBLIC "-//SWE-XXX//DTD XXX MANUAL-DTD 2.0//EN">
    <MANUAL LANG="CS">
    <TITEL>
    Polish characters: &oacute;&ecirc;&iquest;&ntilde;&aelig;&Ntilde;&AElig;&Ecirc;&yen;&Oacute;&pound;
    Czech characters: &eacute;&igrave;&oacute;&iuml;&aacute;&oslash;&egrave;&iacute;&ugrave;&ograve;&uacute;&Og rave;&Igrave;&Eacute;&Oacute;&Uacute;&Ugrave;&Egrave;&Oslash;&Iacute;&Aacute;&Iuml; aacute: &aacute;</TITEL>
    </MANUAL>
    Is there any way to insert special character directly in sgm file, so that it won't have to be interpreted by isoents mapping rules?
    isoent.rwr interpretes oacute as:
    entity "oacute" is fm char 0x00F3;
    But I would like to use 0x00F3 directly in fm file, so that if any additional character is needed - I won't have to update isoent files
    I've tested already:
    &#x00F3;
    &x00F3;
    &0x00F3;
    but with no luck
    Is there anyone who could help me with it?
    I will really appreciate your help
    /Joanna

    Hi Michael. Thank you for your reply.
    There is no declaration within sgm file itself - but while opening the file I use sgml application definition with the following settings:
    Default API client:  FmTranslator
    SGML character encoding:  ISO Latin1
    XML character encoding:  UTF-8
    Namespace: Enable
    CSS2 Preferences:
    Generate CSS2: Disable
    Add Fm CSS Attribute To XML: Disable
    Retain Stylesheet Information: Disable
    Entity locations
    Entity search paths
    C:\Program Files\Adobe\FrameMaker9\Structure\sgml\isoents
    So as you can see, character encoding is set to ISO Latin1 (there is no way to use UTF-8 encoding in sgml files)
    Typing ź or ć in sgm document and opening it with framemaker sgml application - I receive: ¿æ and message: "Non-SGML character found; should have been character reference"
    Everything works fine when I type f.ex.: &x016B; and insert appropriate reference lines into isolat1.rw and isolat1.ent files
    But what I would like to avoid is editing those isoent files each time new character is be needed.

  • Can't change permission on Time Capsule files and folders

    I am using my Time Capsule as a storage device that everyone on my network can access, and I also have a fairly small (~5000 songs) iTunes Library as well. This was all working fine, until I decided to try to get a second computer, beside my MacBook Pro (8,1) to connect to the iTunes Library. Suddenly strange things started happening, like the network dropping at seemingly completely random times, certain people being kicked of the network, etc. So then I thought "well maybe its because of the iTunes Library." So I did a 'Get Info' to the Library folder, named iTunes Library, and it showed this:
    This didn't seem too strange, except for the (unknown) name. I then learned (http://pondini.org/TM/E10.html) that this may actually be causing the problem, so I hit the minus button while hovering over it, only to see this:
    Now, as far as I can tell, this shouldn't be happening. So I tried it on many different computers (10.8.4, 10.6.8, 10.7.5, among others), and they all said this. Then, back on 10.8.4, I decided to try to add my name, even though it said that everyone can read and write, and it said this:
    Now I knew this was strange, since it has never, ever happened to me since OS 7. What was also strange, instead of showing the usual selection window, it asked me to type in my username, like so:
    This happened on every computer, and in every directory and every file (or at least the couple dozen I tried, including ones outside the Library folder that I had already changed permissions on before normally), so I knew something was definetly up. So of course, I turned to my friend, the Terminal. I tried doing sudo chmod 555, 755, 775, 777, and a+x, and none of them worked, again, on multiple different files and folders. Also, since I have connected the second conmputer to the Library, it seems as though the file iTunes Library.itl is no longer executable, because it looks like this:
    Also, no one but me can connect to it anymore, even though they can all see it. Any help would be greatly appreciated.
    EDIT: Sorry for the low-res images, Apple seems to have done something to them

    Verify volume failed with error Could not unmount disk (-10000)
    That could happen if there is another process that is presently accessing the volume.  I don't think it related to the volume having data corruption.  The fact that is it a "server" may be relevant.
    In the time that you have had this problem, has it been shut down and restarted? 
    You can also try restarting it with the Shift key held down.  That should do a Safe Mode startup, if an Xserve acts like a regular Mac.
    http://support.apple.com/kb/HT1564
    http://support.apple.com/kb/HT1455
    The Safe Boot will do some maintenance and tests during startup, and start up with only essential proceses running.  Try accessing that folder now.  If you can access it, you should probably save it off on another volume, such as an external drive, so that you have a current backup.
    Try running Repair Disk Permissions and Verify Disk again in Disk Utility.  Repair Disk Permissions will probably give you a lot of messages; they are usually just "informational" so don't be concerned.  However, if Verify Disk reports an error, that is a serious problem that needs to be addressed.
    Edit:  If the volume being tested is NOT the startup disk, then Repair Disk Permissions will be disabled.  It only applies when there is a system installed on that volume.

  • VB Script That Detects if A Specific Excel File is Open

    Hi Guys,
    I'm trying to move away from Task Scheduler as my trigger for opening an Excel file. The problem there is it has a minimum of 5 min interval (I need at least 30 sec) and If the process of the initial instance of the Excel file is longer than the usual that
    after 5 min another instance executes it messes up my memory bandwidth. What I want is to use VB Script that first check if a particular Excel file is open if yes then wait for another 30 sec to check.
    Question: What is the right syntax/code for detecting a specific Excel file and loops every 30 sec. But I also want to be able to end the loop if I want to.
    Here is my current code:
    Gateway Timeout
    RequestURI=http://timeentry/
    Set Recordset = CreateObject("ADODB.Recordset")
    ConnString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=PHMNWWKS027604; DATABASE=db_skusetup; " &_
    "UID=root;PASSWORD=; OPTION=3"
    'Check for Export Query'
    Recordset.ActiveConnection = ConnString
    exportSQL = "SELECT * FROM tb_queue_export WHERE request_status = 'Pending' ORDER BY request_id DESC LIMIT 1"
    Recordset.Open exportSQL
    Set objExcelExtract = CreateObject("Excel.Application")
    Set objWorkbookExtract = objExcelExtract.Workbooks.Open("C:\Users\ushuam00\Desktop\LAPTOP.xlsx")
    If objWorkbookExtract.ReadOnly then
    if Recordset.Fields(3) <> "" then
    end if
    end if
    test= MsgBox(Recordset.Fields(3),3,Recordset.EOF)
    Recordset.Close
    ReadOnly is not doing it for me. 

    The only way to test it is to open it. Just open writable and, if the file is open you open with fail  then loop and try again until you can open it.  Once open just execute your macro.
    This can loop until you can open the file.
    Set xl = CreateObject("Excel.Application")
    Do While True
    Set wb = xl.WorkBooks.Open("C:\scripts\test.xlsx")
    If wb.ReadOnly Then
    MsgBox "readonly"
    wb.Close()
    Else
    MsgBox "OK"
    Exit Do
    End If
    WScript.Sleep 5000
    Loop
    xl.Quit
    ¯\_(ツ)_/¯

  • Script to change the priorty of all rules and monitors in a Management Pack

    Script to change the priority and severity  of all rules and monitors in a Management Pack in an override MP .We are deploying an MP in production and don't want the helpdesk to take any action on any alerts, so want to set all of them as informational.Once
    they are reviewed then we will delete that override mp
    Can some one help me with a script
     

    Is this MP sealed?  Doesn't really matter..  Unseal the MP if it is sealed.  Now you have access to the RAW XML.  Alert severity and priority have xml tags.  You should be able to do a search and replace and change all the various
    levels (0-3 or whatever they are) to the levels and priority you want.
    Then you can seal the mp with your own key, or just roll it into prod as an unsealed MP.
    This seems, to me, like the quickest and easiest way to make all of these changes at once.  To bulk override everything, not even sure it's still around or even works, there was a tool called Override Explorer, and you could select multiple monitors/events
    and create overrides.  I can't remember very much about the tool because we didn't use it much, but I think it did this with live data, meaning it connected to your management server, and you made the changes in real time.  
    Of course you wouldn't want to do this in production, so do it in a lab, then export the override mp and put it in prod.
    There is probably some snazzy way to do this with PoSh, but I am not aware of any atm.
    Regards, Blake Email: mengotto<at>hotmail.com Blog: http://discussitnow.wordpress.com/ If my response was helpful, please mark it as so, if it answered your question, then please also mark it accordingly. Thank you.

  • Illustrator Crashes when creating new file and opening a file

    Every time I try to create a new file, or even open an existing file Illustrator crashes. I have re-installed illustrator...no luck. I have tried running Illustrator while holding SHIFT...no luck. I am using windows 7, and have no crazy drivers that I believe need to be updated.
    Thank you for your help!
    -Patrick

    Have been Googling like always after Illustrator CC crashes with these specific symptoms (Opening fine, New file of Opening existing file crashes).
    All other threads had no working solution for me and the symptoms seemed little different - Opening the program and keeping it open without opening or creating a file was no problem.
    This was the well-appreciated solution that did the trick for me.
    Re: Illustrator CC 17.1 Crashing on New File or Open File (Win 7) works under a different user?
    (In my case I think my default printer had been changed in the background by using a VPN connection this morning which I hardly use ever. Never had been thinking in that direction of course.)
    Good luck to you all.

Maybe you are looking for

  • Purchase of Raw Mat by New Plant (CoCd New) from Old Plant (CoCd Old), STO?

    Dear all Our HQ which has an operating Plant A belonged to Company Code (CoCd) A,has acquired Plant B belonged to Company Code B. And due to the supply change management issue and strategic business location, HQ has decided to move both Plant A and P

  • Unable to restart after software update

    the last 2 times that i have installed "restartable" updates from the "software update" option i have been unable to start my computer without having to boot from my Snow Leopard install disc and reinstall it. has anyone else come upon this issue? wh

  • FaceTime not working after changing Apple ID Password

    Using an iPad 2, FaceTime and Messages was working fine.  Since changing my Apple ID password, FaceTime and Messages are no longer working.  When I enter the the new password within FaceTime it states the password is not correct.  I'm able to update

  • URL stream won't work in iTunes 11

    Hello everybody, We have a strange thing! We used a MacBook Pro and a iMac both are updated to OS X Lion 10.8.2 with on both computers iTunes 11.0.1. Now here is the thing! We add the URL stream ' http://icecast.omroep.nl/3fm-bb-mp3 ' to both our mac

  • How to determine the app's install directory?

    Hi, At runtime how can I get the path to the directory where my AIR app is physically installed on the client machine?