BloggyThingy

Creating a txt file for Importing into MT4

Vote 0 Votes

Hi.

I’m trying to use MT4’s Import function to bring in information from Microsoft Word.

I’m putting it into the correct format — the same format that MT uses when it Exports the blog_name.txt file. I’ve made sure that all the spacing is correct, that the hyphen-separators are correct, and that all fields are correct. I’ve also saved this as a txt file.

But when I try to import it, although I get a notification that the import went successfully, none of the entries show up on the Manage Entries page.

I’ve tried copying my data into Notepad (thinking that Word might be adding something nasty to the txt file. But the same thing happens.

I’ve also tried copying it into even more basic text editors, like Text Pad, and also copying and saving it as a txt file in Dreamweaver, but the results are the same.

In testing, when I open the blog_name.txt file in Notepad, after MT exports it, and copy it into another text editor, save that, and try to import this new txt file, the same thing happens. That is, something is getting messed up in the copy process.

I AM able to use Notepad to make minor edits to the file after MT exported it, save that, and import it successfully into MT.

But I am totally unable to create a txt document that MT will successfully import, not matter how basic a text editor I use.

I seem to recall doing this several years ago with an earlier version of MT, perhaps as early as 2.x. But it doesn’t work now.

Is there anyway to do what I’m trying to do?

Thank you. And Happy New Year!

Reported on Movable Type 4.2

22 Replies

| Add a Reply
  • Without sample data, I don't think you'll be able to get much help debugging this. In my experience, which comes from writing a fairly well-used script used for exporting from WordPress to Movable Type, the Movable Type import mechanism is very, very anal about the format. Even down to stuff like it will choke on unicode data if the text encoding isn't set to unicode.

  • I'm having the exact same problem, but the kicker is... I'm actually trying to use the EXAMPLE file at:

    http://www.sixapart.com/movabletype/docs/mtimport

    I still can't even get those example posts to import into Movable Type, so what's the problem here? Is this an encoding issue? I saved the file as Unicode, and even tried setting it as UTF-8 and specifically selecting UTF-8 in the text formatting to no avail.

  • Have you verified that your original copy, that you opened in notepad imported?

  • None of my copies imported. As we discussed in a previous post, I actually created a .NET library that converted BlogML to MT format. That didn't work, even with ONE entry, didn't work.

    So, I used the EXAMPLE text from the mtimport documentation. That didn't work either, copied EXACTLY off the page.

    Neither would import, not even in the Database.

    Any suggestions?

  • None of my copies imported. As we discussed in a previous post, I actually created a .NET library that converted BlogML to MT format. That didn't work, even with ONE entry, didn't work.

    So, I used the EXAMPLE text from the mtimport documentation. That didn't work either, copied EXACTLY off the page.

    Neither would import, not even in the Database.

    Any suggestions?

  • I just imported the sample at the bottom of http://www.sixapart.com/movabletype/docs/mtimport just fine into sockfish (development branch of the next version of MT) just fine...

    Try this:

    http://www.codemonkeyramblings.com/sockfish/import/test.txt

  • Actually, that Test.txt file worked. I can't figure out why for the life of me my test file isn't working though.

    http://www.mma-analyst.com/mt/import/t.txt

  • Crap, forgot to hit reply on yours:

    Actually, that Test.txt file worked. I can't figure out why for the life of me my test file isn't working though.

    http://www.mma-analyst.com/mt/import/t.txt

  • BloggyThingy

    Thanks for looking into this.

    That text.txt file for me as well. As do any files that I export from MT and then try to import back into MT *without* first doing any editing of them.

    The problem is in creating a plain text file, from scratch, that appears to conform to the import/template in all outward appearences, but that failes to successfully import. The import process begins, and it says:

    Importing entries into blog
    Importing entries as user 'Name'

    And then nothing else, even though I get the "All data imported successfully!" notice.

    What I (and I assume others) would like to do is create import files from existing non-MT text, e.g., in Word, format it correctly, save it as a text file, and import it into MT. That is what is proving to be VERY "anal" as describe above.

    I realize that word might be anal in its own way, and it could be adding things to the file that MT doesn't like.

    However, after opening the test.txt file (as linked above), and simply opening it *as a text file* in Dreamweaver and immediately saving it unchanged *as a text file*, MT still had problems with it.

    I was able to open it in TextPad (a text editor), edit it and save it, and it opened correctly.

    But generally, the process seems too fragile and anal to reliably be able to do a import a file created outside of MT

    In earlier versions of MT, this worked, and several times I created files for import using Word, then copied those and pasted them into a plain text editor, and imported them. But the process seems ot have become much more sensitive.

    I suppose it's could be done by not using Word, but the very sensitivity of the import/export format itself makes doing it with Word a virtual necessity, since you can use Word macros to duplicate the format precisely for each entry.

  • Well, Firefox sees a distinct difference between them. Try loading yours and mine in Firefox. You'll notice that yours doesn't seem to have any line breaks that Firefox can recognize in a text file. I'm coming from MacOS X, which means that I have Unix end of line characters. Try comparing my file to yours in something like Text Pad and making it use the same end of line characters.

  • What I (and I assume others) would like to do is create import files from existing non-MT text, e.g., in Word, format it correctly, save it as a text file, and import it into MT. That is what is proving to be VERY "anal" as describe above.

    NEVER use something like Word for this. Word does not give a dead rodent's posterior about things like proper HTML formatting, end of line characters, etc. If you need to see why I say never use it, just look at all of the junk it generates when you convert a Word doc to HTML.

  • BloggyThingy

    I understand that Word outputs very messy and cluttered HTML formatting. I see it all the time and have found ways around it. Just as I've found ways around pasting from Word in MT's Rich Text format, which maintains all of Word's HTML garbage and creates extremely bloated entry code.

    However, Word is what I (and un-counted others) write in. And that's not going to change anytime soon.

    And there was a time when it WAS possible to use Word macros to create a proper multi-entry MT import/export layout from Word-generated text, and THEN either copy and paste that to a plain text or ascii editor such as TextPad, or Dreamweaver, or even Notepad, and have it successfully import into MT. I did it many times with ease. That now appears to be extremely elusive if not impossible.

    In other words, I'm not actually trying to directly import into MT a txt file saved from Word (although it SHOULD be possible; how Word saves txt files is known, and MT *could* account for it in its import process.) I'm simply trying to create, *non-manually*, a properly laid-out multi-entry import file from text written in Word.

    That doesn't seem like all that radical an idea, for a top of the line CMS to work with the most commonly used non-plain-txt word processor, especially when the user is ready to take intermediate steps (e.g., copying stuff to TextPad, or Notepad, or TopStyle, etc.) to get from one to the other.

    As it it, the only files that seem to successfully import into MT are those that have been exported from MT and that remained unedited. Doing that is not without value. But it's not what I and others are trying to do.

    (Apologies if this sounds snippy, but this is a very frustrating problem, and is one of the perpetual clouds hanging over my use of MT: How to get from where I write to where I publish, without either having to retype it all in an ascii editor, or having to live with pasting in Rich Text and having my entries filled with Word's bloated css and other nonstandard junk. I appreciate your help.)

  • Bloggy,

    I think you are having the same problems I'm having as far as the import goes. I literally COPIED VERBATIM the EXAMPLE file on the import documentation, and that did not work, so I'm assuming either there is an encoding problem and/or a line ending problem as well.

  • If you think MT's import/export system, WordPress used to (and possibly still does) have problems exporting content that it can later reimport :)

    That said there are two things which can help you:

    1) Upgrade to Word 2007 because it has XHTML support built-in.

    2) Download HTMLTidy. I would have recommended that earlier, but didn't realize it had been packaged for Windows.

    In the meantime, run HTMLTidy, and give it the command line argument -asxhtml to generate XHTML 1.0 Transitional docs from Word HTML exports. So, for example, tidy.exe -asxhtml "My Latest Post.htm" > latestpost.html.

  • BloggyThingy

    Thanks, Mike. I'll try those.

    In fact, I recent;y upgraded to Word 2007 partly in the hope that it might produce cleaner HTML, or at least let me paste from it into MT's Rich Text-formatted entry without pulling in all the msoNormal etc junk. But on that count it's no different than the Word 2000 I'd been using. (That said Word 2007 does have many improvements over previous versions.)

    I'll look into XHTML from Word 2007, and also check out HTML Tidy.

    Thanks again.

  • Okay, Mike was able to fix my problem.

    If you are simply typing it up in Word, then copying/pasting to a text editor, I suggest trying this...

    Notepad++, and use the Convert to UNIX format.

    The problem seems to be that our files are in DOS format, using CHR(13) as the line break, but in UNIX format, CHR(10) is used. Perl is only recognizing the CHR(10), and that's a major problem.

    I suggest copying/pasting what you format, then converting to UNIX format and trying it. Worked for me.

  • BloggyThingy

    Thanks much! Notepad++ seems to work when text from Word is pasted into a *new* Notepad++ document an the default is set to save new docs as Unix.

    Plus, Notepad++ is a way better "notepad" and txt and similar file editor than MS's Notepad.

    Thank you to you and to Mike!

  • I use TextPad for this sort of work.

  • You and LeLand might benefit from this plugin that I just created. It enables selective exporting of entries from the Manage Entries screen via the drop down for actions.

  • For this type of work, I use UltraEdit ;)

  • I was having issues with exporting from MT 2.66 and then importing the file into MT 4.32 on a UNIX install. What I ended up doing was putting the export file in the import directory in the MT installation via FTP. Then I used SSH and I opened the file with VI and saved it again. That seemed to format the file correctly. Everything imported successfully.

  • MT_NEWBIE

    I was successful in creating a .txt file to import by using NotePad and by pulling data from a database and formatting the output using .asp.

    I did experience a minor problem. The import is *really* picky regarding format. You have to be sure there aren't any hidden spaces. My data got hung up on the Body: tag.

    For example:

    BODY:[sp]
    This is body content.

    vs.

    BODY:
    This is body content.

    That extra space cause the Body information not to be loaded.

    My problem now is getting the import to work by using the BROWSE to file option. The import works great when the file exists in the MT/import directory, but no where else. Any suggestions?

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

code.sixapart.com

137 479

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

238 797

Last Topic: Manifest Schema Compatibility Issue When Restoring Blog by Matt on Oct 17, 2012

1858 6594

Last Topic: Categories and Basename Publishing Issues by e21media on Oct 25, 2012

88 307

Last Topic: absolute publish date in Manage Entries screen by .mau. on Apr 18, 2012

1488 5347

Last Topic: Anti-cloning by .mau. on Oct 29, 2012

732 3093

Last Topic: Blog moved server - now users cannot access blog? by mowgs on Oct 30, 2012

89 317

Last Topic: How to "pretify" a url in htaccess with a few wildcards by Caio on May 30, 2012

183 771

Last Topic: Commenting with TypePad by Rob Ferrara on Oct 17, 2012

212 680

Last Topic: Does MT-Approval work in MT5? by DLpres on Sep 25, 2012

27 100

Last Topic: Upgrading MT by Caio on Oct 15, 2012

49 224

Last Topic: Movable Type 6 Ideas by Caio on May 28, 2012

65 248

Last Topic: Expanding new rich text editor and implementing table function by Takeshi Nick Osanai on Jul 30, 2012