Search and Replace Topic ID

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Richard Johnson
Posts: 6
Joined: Tue Feb 19, 2019 6:43 pm

Search and Replace Topic ID

Unread post by Richard Johnson »

I am working with a very large H&M file. We are saving the H&M project using single file storage. We would like to save the file as uncompressed XML so multiple people can work on the file at the same time, but when we try to save the file I get an error 'File "Topics/XYZ".xml" could not be opened. Reason: Cannot create file "C:\…\…\XYZ".xml". The filename, directory name or volume label syntax is incorrect.'

It is obvious that the file name has a quote character in it. I edit that Topic ID to remove the quote and save again, now it errors on the next instance of the Topic ID that has a quote in it. The problem is that there are hundreds of Topic ID's that need to be updated. Because of the size of the file it takes about a minute to edit one Topic ID and save it.

Is there a faster way to search and replace the Topic ID? The current Search and Replace dialog does not seem to give the the granularity that I need.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Search and Replace Topic ID

Unread post by Tim Green »

Hi Richard,

It was only recently discovered that quotes in topic IDs were not prevented and this has been changed in the latest maintenance update. I'm afraid there is no global search and replace option for changing topic IDs because (a) it was considered to be too dangerous and (b) all the references to the topic in the entire project must be updated automatically every time the ID is changed. This is done automatically when you edit the topic ID in Topic Options, and that is currently the only way to do this. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Richard Johnson
Posts: 6
Joined: Tue Feb 19, 2019 6:43 pm

Re: Search and Replace Topic ID

Unread post by Richard Johnson »

Thanks for that update, Tim.

This is a continuation of my issues, but may deserve it's own topic.

I updated my large file by searching manually and removing the quotes from the Topic ID's in hundreds of ID's. When I finished I saved the single file, then tried to save the file as uncompressed. It gave me several errors on the Topic ID's that I corrected, and I kept updating and saving for another 5 or 6 Topic ID's. The program crashed, so I restarted the program tried to reopen the file. The program said that it did not close correctly and asked if I wanted to recover the changes. I said YES. It failed to reload, so I had to restart the program again. This time it asked if I wanted to recover the file and I said NO.

Now when I open the file it says:
"Cannot load" C:\[path\file].hmxz! Please ensure that you have sufficient rights to open the project."
"Project Open: The project file project.hmxp can not be found in the archive! (C:\DelphiXE6\ECS\EC\HMDAL.pas, line 7104)"

I copied the file to a new folder and then renamed that file to .zip. I am able to unzip the file, although it is giving me errors about several xml file names that contain quote characters, it is not reporting that the zip is corrupt.

The zip file does contain a .hmxp file in the project root but it is not named "project.hmxp" as referenced in the error dialog, it is named "our project name".hmxp, where "our project name" is the name of the zip file.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Search and Replace Topic ID

Unread post by Tim Green »

Hi Richard,

The errors you are experiencing now indicate that the zip .hmxz file has been damaged. This is rare and when it does happen it is almost always because you are working on a network drive and experienced a network error during saving. However, in this case the problems are probably being exacerbated by having invalid file names for so many topics in the project, which may be causing file errors.

If possible, please mail me the last good backup of the project before you performed the edits that led to the problems at support AT ec-software.com (replace the AT with @). I have some tools here with which I may be able to perform the repairs, and we'd also like to analyze the situation with it for future reference.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Richard Johnson
Posts: 6
Joined: Tue Feb 19, 2019 6:43 pm

Re: Search and Replace Topic ID

Unread post by Richard Johnson »

I will see what files I can send to you. I've been working with this broken file for 3 days searching and renaming topics with quotes in them and did not save a backup.

I used WinZip to rename the file [project name].hmxp in the project zip file to "project.hmxp". Even though the file is renamed and present in the root of the zip it is still giving me the same error:

"Project Open: The project file project.hmxp can not be found in the archive! (C:\DelphiXE6\ECS\EC\HMDAL.pas, line 7104)"
Richard Johnson
Posts: 6
Joined: Tue Feb 19, 2019 6:43 pm

Re: Search and Replace Topic ID

Unread post by Richard Johnson »

Also, I sent a crash report when the program crashed at 5:32pm on 2/21.
Richard Johnson
Posts: 6
Joined: Tue Feb 19, 2019 6:43 pm

Re: Search and Replace Topic ID

Unread post by Richard Johnson »

Update: I was able to open the project file. When I renamed the file using the WinZip utility, H&M still could not find the project.hmxp file. I had to open the zip in WinZip, then copy the renamed project.hmxp file into the zip. Then it opened. Just renaming did not work. I have to test tomorrow to see if there are any parts missing.
Richard Johnson
Posts: 6
Joined: Tue Feb 19, 2019 6:43 pm

Re: Search and Replace Topic ID

Unread post by Richard Johnson »

Update: File seems intact. I do however have a lot of files that still include the quote character in the file name. They are in the history folder with this format:

24800818-9---WIRE-THING-1"-Q-5-7.xml.~C2652eed

How do I clear out these files? Is it as simple as deactivating "topic history" in Configuration > Common Properties > Miscellaneous?
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Search and Replace Topic ID

Unread post by Tim Green »

Hi Richard,

The history files are only backup copies of your topics. It is safe to delete them manually in Windows Explorer.
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Post Reply