Don't think we will be spending money on anything except what resembles food this year (Spent enough on property repairs!!)Marc56us wrote:Hi Fangbeast,
The tool is still available, but unfortunately they have put their forum in read-only mode. The program is commercial, but not very expensive ($59), well documented and shareware 30 days (test it before).
Free macro program to help automate recipe import
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
Amateur Radio, D-STAR/VK3HAF
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
What private message??? My notifications say 0 messages when I logged in just now.NicTheQuick wrote:Qhat about my recipe merge program? Does it work? You did not anser my latest private message.
I also just physically checked and there were no private messages from you in there.
Amateur Radio, D-STAR/VK3HAF
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Free macro program to help automate recipe import
I sent a message to you with a source code that is capable of merging several recipes. There is a bug in purebasic which prevents a valid XML but it should be possible to make the XML valid again by hand. In your answer you did not say anything about that code. Did you try it?
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
I haven't received any message about any source code. I'm not that old that I'd forget!! (Even my wife says so)NicTheQuick wrote:I sent a message to you with a source code that is capable of merging several recipes. There is a bug in purebasic which prevents a valid XML but it should be possible to make the XML valid again by hand. In your answer you did not say anything about that code. Did you try it?
When did you send it? Last message I had from anyone was on Tuesday, January 8'th from someone (Not you)
Amateur Radio, D-STAR/VK3HAF
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Free macro program to help automate recipe import
It was December 18th and you answered to it but without reacting to the source code. Here it is:
And this is the related bug report: viewtopic.php?f=23&t=71938Morning,
I've created the tool to merge the recipe files with Purebasic. But there is a bug in the XML library I try to show to Fred but I was not able to construct an example without using your recipe files. Can I bundle them in a small package and send to Fred so he can take a look why the XMLExport function does its job wrong?
This is my code so far, but the Data.xml file inside the merged recipe file is not valid because there are some characters missing in the end of the file.Code: Select all
EnableExplicit UseZipPacker() Structure Recipe file.s handle.i Map *files() content.i EndStructure Procedure openRecipe(file.s) Protected *recipe.Recipe = AllocateStructure(Recipe) Protected filename.s, *buffer, size.i If Not *recipe Debug "Could not allocate memory" ProcedureReturn #False EndIf With *recipe \handle = OpenPack(#PB_Any, file, #PB_PackerPlugin_Zip) \file = file If Not \handle Debug "Could not open zip" Goto error EndIf If Not ExaminePack(\handle) Debug "Could not examine zip" Goto error EndIf While NextPackEntry(\handle) filename = PackEntryName(\handle) size = PackEntrySize(\handle, #PB_Packer_UncompressedSize) If PackEntryType(\handle) = #PB_Packer_File *buffer = 0 If size > 0 *buffer = AllocateMemory(size) If Not *buffer Debug "Could not allocate memory for " + filename Goto error EndIf If size <> UncompressPackMemory(\handle, *buffer, size) Debug "Could not unpack file: " + filename Goto error EndIf EndIf Else *buffer = -1 EndIf \files(filename) = *buffer If filename = "Data.xml" If size = 0 Or Not *buffer Debug filename + " is empty" Goto error EndIf \content = CatchXML(#PB_Any, *buffer, size) EndIf Wend EndWith ProcedureReturn *recipe error: FreeStructure(*recipe) If *buffer FreeMemory(*buffer) EndIf ProcedureReturn #False EndProcedure Procedure getNodeByTag(xmlNode.i) EndProcedure Procedure mergeRecipes(file.s, List *recipes.Recipe()) Protected i.i, j.i, *hixz, *node, name.s, *recipesNode, *recipeNode, *sourceImageNode, *recipeImagesNode, *recipeImageNode Protected imageCounter.i = 0, oldImage.s, newImage.s ; Neuen ZIP-Container erstellen Protected *mZip = CreatePack(#PB_Any, file, #PB_PackerPlugin_Zip) ; Create new Data.xml Protected *mData = CreateXML(#PB_Any, #PB_UTF8) Protected *mHixz = CreateXMLNode(RootXMLNode(*mData), "hixz") SetXMLAttribute(*mHixz, "Source", "Merged Cookbook") SetXMLAttribute(*mHixz, "FileVersion", "1.0") SetXMLAttribute(*mHixz, "date", FormatDate("%yyyy-%mm-%ss", Date())) Protected *mCookbooks = CreateXMLNode(*mHixz, "Cookbooks") Protected *mCookbookChapters = CreateXMLNode(*mHixz, "CookbookChapters") Protected *mRecipes = CreateXMLNode(*mHixz, "Recipes") ; Create new Manifest.xml Protected *mManifest = CreateXML(#PB_Any, #PB_UTF8) Protected *mFdxm = CreateXMLNode(RootXMLNode(*mManifest), "fdxm") SetXMLAttribute(*mFdxm, "Source", "Merged Cookbook") SetXMLAttribute(*mFdxm, "FileVersion", "1.0") SetXMLAttribute(*mFdxm, "date", FormatDate("%yyyy-%mm-%ss", Date())) Protected *mFiles = CreateXMLNode(*mFdxm, "Files") Protected *mFile ForEach *recipes() With *recipes() *recipesNode = XMLNodeFromPath(RootXMLNode(\content), "/hixz/Recipes") If Not *recipesNode Debug \file + ": <recipes> not found." Continue EndIf For i = 1 To XMLChildCount(*recipesNode) *recipeNode = ChildXMLNode(*recipesNode, i) *sourceImageNode = XMLNodeFromPath(*recipeNode, "SourceImage") If *sourceImageNode oldImage = GetXMLAttribute(*sourceImageNode, "FileName") newImage = "image" + imageCounter + "." + GetExtensionPart(oldImage) imageCounter + 1 If FindMapElement(\files(), "Images/" + oldImage) \files("Images/" + newImage) = \files("Images/" + oldImage) DeleteMapElement(\files(), "Images/" + oldImage) EndIf SetXMLAttribute(*sourceImageNode, "FileName", newImage) *mFile = CreateXMLNode(*mFiles, "File") SetXMLAttribute(*mFile, "FileName", newImage) SetXMLAttribute(*mFile, "OriginalFileName", GetXMLAttribute(*sourceImageNode, "OriginalFileName")) AddPackMemory(*mZip, \files("Images/" + newImage), MemorySize(\files("Images/" + newImage)), "Images/" + newImage) EndIf *recipeImagesNode = XMLNodeFromPath(*recipeNode, "RecipeImages") If *recipeImagesNode For j = 1 To XMLChildCount(*recipeImagesNode) *recipeImageNode = ChildXMLNode(*recipeImagesNode, j) oldImage = GetXMLAttribute(*recipeImageNode, "FileName") newImage = "image" + imageCounter + "." + GetExtensionPart(oldImage) imageCounter + 1 If FindMapElement(\files(), "Images/" + oldImage) \files("Images/" + newImage) = \files("Images/" + oldImage) DeleteMapElement(\files(), "Images/" + oldImage) EndIf SetXMLAttribute(*recipeImageNode, "FileName", newImage) *mFile = CreateXMLNode(*mFiles, "File") SetXMLAttribute(*mFile, "FileName", newImage) SetXMLAttribute(*mFile, "OriginalFileName", GetXMLAttribute(*recipeImageNode, "OriginalFileName")) AddPackMemory(*mZip, \files("Images/" + newImage), MemorySize(\files("Images/" + newImage)), "Images/" + newImage) Next EndIf CopyXMLNode(*recipeNode, *mRecipes) Next EndWith Next Protected size.i, *buffer ;FormatXML(*mData, #PB_XML_ReduceSpace | #PB_XML_CutSpace | #PB_XML_ReduceNewline | #PB_XML_CutNewline | #PB_XML_LinuxNewline) size = ExportXMLSize(*mData, #PB_XML_NoDeclaration) Debug size *buffer = AllocateMemory(size) If ExportXML(*mData, *buffer, size, #PB_XML_NoDeclaration) Debug PeekS(*buffer, size, #PB_UTF8) AddPackMemory(*mZip, *buffer, size, "Data.xml") FreeMemory(*buffer) EndIf size = ExportXMLSize(*mManifest) *buffer = AllocateMemory(size) If ExportXML(*mManifest, *buffer, size) AddPackMemory(*mZip, *buffer, size, "Manifest.xml") FreeMemory(*buffer) EndIf ClosePack(*mZip) EndProcedure NewList *recipes.Recipe() ; This directory should only contain the fdxz files Define dir.s = "/home/nicolas/tmp/purebasic/Recipes/" ; This is the new merged recipes file Define target.s = "/home/nicolas/tmp/purebasic/Recipes/merged.zip" ; First read all recipes into Memory If ExamineDirectory(0, dir, "*.fdxz") While NextDirectoryEntry(0) If DirectoryEntryType(0) = #PB_DirectoryEntry_File If AddElement(*recipes()) *recipes() = openRecipe(dir + DirectoryEntryName(0)) EndIf EndIf Wend EndIf mergeRecipes(target, *recipes())
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
NicTheQuick, oh dear, I honestly don't remember seeing that in a private message. Wonder how that got past me???
Would have tried it immediately if I had seen it.
Must be ghosts in the PB form (Or as srod would say, goats ate my brain)
But if the characters are invalid, what good is it testing the code? (Honest question). I wouldn't even know how to fix that.
Would have tried it immediately if I had seen it.
Must be ghosts in the PB form (Or as srod would say, goats ate my brain)
But if the characters are invalid, what good is it testing the code? (Honest question). I wouldn't even know how to fix that.
Amateur Radio, D-STAR/VK3HAF
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Free macro program to help automate recipe import
Maybe I can fix the code with a workaround mentioned in the bug report I linked in my previous post. Unfortunality the bug got not fixed with the latest PB version.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
Wait a short while. It hit 41 degrees yesterday and we could barely function. We just got back from shopping and it's already 28 and the weather bureau cannot seem to get it right. I need to say away from this hot room.NicTheQuick wrote:Maybe I can fix the code with a workaround mentioned in the bug report I linked in my previous post. Unfortunality the bug got not fixed with the latest PB version.
Amateur Radio, D-STAR/VK3HAF
Re: Free macro program to help automate recipe import
Wow, 10,000 recipes!....I probably may use two or three a week and often one I've used before.
It would take me 600 years to try them all...........are any of them life extending?
It would take me 600 years to try them all...........are any of them life extending?
If it's falling over......just remember the computer is never wrong!
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
I actually have over 600,000 but 10,000 of those happen to be Living Cookbook fdxz:)C87 wrote: Wow, 10,000 recipes!....I probably may use two or three a week and often one I've used before.
It would take me 600 years to try them all...........are any of them life extending?
As far as life extending, I have it on good authority that if you cook every one of my 600,000 recipes, you will have gotten your exercise and thus extended your life:):)
Amateur Radio, D-STAR/VK3HAF
- Fangbeast
- PureBasic Protozoa
- Posts: 4749
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Re: Free macro program to help automate recipe import
More and more recipes every day bit it hit 36 today and it is supposed to hit over 40 by Friday. I really can't think in this heat.
Amateur Radio, D-STAR/VK3HAF