Jump to content

Meal Planner v1.1


james3mg
 Share

Recommended Posts

Well, here's my latest effort at a 'worthy' script!

This script lets you create recipies, tying ingredients, sides and veggies to a Main course, with enough information about the ingredients to make an excellent shopping list. You can also print out recipies, your plan for (for instance) this week's meals, and the shopping list you need for your plan.

It relies completely on the _SQLite functions, and requires that Menus.db exists in the same directory as the script. However, if it doesn't, it will make it for you. This script is completely self-contained - even the data for the help file is contained in the script and written when called at run-time.

The first time you run the script, it will ask you if you want to stick bogus information in the database. This was included just for these forums - you can test the script and see how it works without having to actually create meals, sides, veggies and ingredients. If you want to actually use the script later, just delete Menus.db and run it again, this time choosing not to import bogus information. In this case, a (granted, very annoying) balloon will point out the button you should start with when you have a blank database...creating a new Main Course.

I hope you like it, and even more, I hope someone can actually use it besides myself. As usual with my scripts, I suck at commenting what I'm doing, but other than the innumerable StringLeft(StringInStr(StringTrimRight))-type tags, it's fairly easy to follow (I think). At least I use enough functions you can tell WHERE the script is, even if not WHAT it's doing... oh well :)

(I love the SQLite functions...I don't know the last time I used .ini files anymore!) ;)Edit: OK, I'm now using them for the save files, but that's it ;)

Edit: Here is the new version 1.0.0.1, with some bug fixes, one major. There's also a few functionality changes (default buttons so enter closes a dialog box, etc). Check the header for this information.

Edit: Here is the new version 1.0.0.2 with one bug fix: the side and veggie combos wouldn't populate with the recommended dishes in the main GUI. I hate to do this because I'm planning on releaseing 1.1.0.0 within a few days with a new database structure (and auto-upgrade feature for 1.0 to 1.1 transferral of data) and several big new features, but I wanted to at least have a 1.0 that was stable. Sorry for overlooking this one!

Update: fixed functionality for non- MM/DD/YYYY locales - new version is 1.0.0.3

VERSION 1.1 has been released!

This script is now too big for me to actually test every possible scenario, but it seems to be stable and includes all the promised new features. It would not surprise me if you found some bugs however...if you do, please post them here and I'll get right on them. Hopefully I won't need more than the 3 interim sub-versions I had last time ;) The Save and Open functions make me particularly nervous - I just know there are situations I haven't tried out.

I think this is becoming a truly useful tool (if you're the type of person who shops like this, that is :(, and though it's getting to the point I know some of the things I'm doing aren't the most efficient methods (too much copy-and-paste), it still seems to be running great, and I know I'm going to get a lot of mileage out of it, at least! v1.1 really gets this to the point I feel pretty good about it - I'm not in a real hurry to incorporate the functions I've listed for v1.2.

Primary new features:

-Save meal plan (.menu files by default)

-Open (this program DOES NOT register .menu files with this script, though you can do it yourself with Windows' "Open With..." option or drag-n-drop the .menu file onto the .exe)

-New table to store household items like toothpaste and toilet paper so they don't show up in the "available ingredients" parts of the recipe dialogs

-Easy one-click adding of commonly-shopped-for items like Milk and Bread (you specify which items and how many), that may or may not be in a recipe. (both ingredients and household items are available to be added to this list)

-Cost field for each item so you can see (and print) a cost estimate of your shopping trip, and cost-per-store.

-Excellent support for non-MM/DD/YYYY-format locales - even supports locales using formats like 9.Sept.2007 and displayes dates and currency in locale's specified format.

-Smaller text in the ListViews so that if you have longer ingredient names, you can still identify what you're clicking on

Let me know what you think!

Oh, I've also attached the icon I'm using for this script :(

MealPlannerIcon.ico

MealPlanner.au3

Previous versions' stats:

(downloads of 1.0.0.3: 43)

(downloads of 1.0.0.2: 8)

(downloads of 1.0.0.1: 49)

(downloads of 1.0.0.0: 38)

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Wow, that's really cool. Great work with the DB!

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Link to comment
Share on other sites

I like it, its very useful to some people.

I think its funny how there is

0 error(s), 51 warning(s)
. O errors and yet it seems to not like it lol.

Thanks mate,

~Nikolai

Yeah...it's because I was too lazy to reset every GUI after it was closed, so I just created and deleted it within the same function, meaning that I was defining tons of Globals (the controls on the GUIs) within functions that SciTE's worried might not be called before the var is referenced. Of course, good design ( :) ) ensures that the functions are called first (in fact, usually I only reference the vars from within those functions and they don't actually have to be Globals, but I like doing that with controls...I've had too many stupid errors otherwise).

You/I could get rid of the warnings by sticking a Globals definition line at the top of the script with all 51 controls I later actually define...I just don't see why, when the end user doesn't actually see the warning output, being a SciTE feature.

Thanks to you both for the kind words!

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

(Moved back in from the 'split' thread that's now in Chat).

Just a heads-up as to where I'm going next:

I know that this thread will probably now die until I post another update - I intend to add a save/open function and add a seperate 'household shopping' table for items that might be added to a shopping list and should be indexed, but shouldn't show up as a possible 'ingredient' for a meal...toilet paper and light bulbs, for instance. That'll be v1.1, and I'll probably go as far as a v1.2, with recipe and ingredient import/export functions, but I don't see much of anything beyond that.

Thanks to everyone again for checking it out. :)

Mike: I took a look at your script. It's funny that we were developing such similar scripts! I like some of the features you've included - the ability to use coupons intrigues me, but I think it's out of scope for mine. I hope you'll forgive me, but I'm going to use my script - I'm more familiar with how it works :)

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Check the first post for a new version (1.0.0.2) with a very annoying (and stupid) bug fix. I'll be releasing 1.1 within a few days hopefully too! It'll have all the features I promised in the previous post, as well as the ability to one-click-add items you shop for every time you go to the store (milk, bread, etc).

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Tried to run it but not much luck.

I was told some bogus information would be created so I could see how it worked. ok.

Then presented with a fairly blank window apart from two dates. Start date set to 11/09/297, end date set to 29/09/2007. Clicked 'Set Dates' since I didn't see what else could be done and I was told that the end date could not be before the start date. It wasn't but I tried some other dates but nothing happened and I could close it either.

Tried again but still told ending date could not be before starting date. Tried setting ending date to a week before and a week after but makes no difference. It closed this time though.

I think the problem is that you are expecting the date to be in the form mm/dd/yyyy, but it isn't. For me it's dd/mm/yyyy.

You need to check

HKEY_CURRENT_USER\Control Panel\International, sShortDate

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I think the problem is that you are expecting the date to be in the form mm/dd/yyyy, but it isn't. For me it's dd/mm/yyyy.

You need to check

HKEY_CURRENT_USER\Control Panel\International, sShortDate

hmmm...I'll check this out. :) Thanks. Maybe there's a UDF out there I can use...

Edit: OK, it wasn't as hard as I was afraid it would be...if I got it right, that is! Please give it a shot again, Martin, and if it lets you into the main GUI, check the labels on the colored buttons for the really short date format...if I did it right, they should show up in your dd/mm format as well. Thanks for your help! :)

BTW, if you can, please confirm that the GUI wouldn't close. Unless the message box is displayed (saying the dates were bad), it should close even this early in the program. If you can recreate it not closing, please tell me how you're getting it to not close and I'll try to fix this as well.

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

hmmm...I'll check this out. :) Thanks. Maybe there's a UDF out there I can use...

Edit: OK, it wasn't as hard as I was afraid it would be...if I got it right, that is! Please give it a shot again, Martin, and if it lets you into the main GUI, check the labels on the colored buttons for the really short date format...if I did it right, they should show up in your dd/mm format as well. Thanks for your help! :)

BTW, if you can, please confirm that the GUI wouldn't close. Unless the message box is displayed (saying the dates were bad), it should close even this early in the program. If you can recreate it not closing, please tell me how you're getting it to not close and I'll try to fix this as well.

Yep, that's fixed it.

Looks good.

I haven't had a problem with closing again, and I can't see from your code why there should be a problem, so probably best to ignore that one.

I was intrigued by your print function - that's very good, very neat. Can you say where you found the info on mshtml.dll? What happens if the recipe you're printing is too long to fit on one page?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Yep, that's fixed it.

Looks good.

I haven't had a problem with closing again, and I can't see from your code why there should be a problem, so probably best to ignore that one.

I was intrigued by your print function - that's very good, very neat. Can you say where you found the info on mshtml.dll? What happens if the recipe you're printing is too long to fit on one page?

Thanks for the feedback! :( Glad it's working better. I did a little more work and the upcoming v1.1 will have even better regional support - using the locale's date divider symbol ( / vs - vs . ) and making sure it doesn't crash in some of the odder locale settings (as it would do now if your region is set to some specific regions, because stringsplit didn't work right in these regions' formats).

I'm proud for finding the stuff on the print function - I'm suprised that it hasn't gotten more attention, as I've posted it several times in applicable topics.

All the information I've ever found on this was easy - my breakthrough came one afternoon when I right-clicked a HTML file on my desktop and noticed that "Print" was an option - meaning it could be called from the commandline and contain anything printable on a webpage. I went into the registry and grabbed the commandline to do this, and stuck it in a function. Cheating, huh? I know, not nearly as informative as you thought I might be :):)

I haven't found any more information about it anywhere else, but I haven't looked hard either, as it serves my needs fine as-is for most of my apps. However, I'd love to find a way to call it that would enable the "Print Selection" option to be available with the 'selection' I send it, rather than the whole page... (edit: also, I'd love to find out how to get a 'print preview', since it should be handled within the same .dll as long as they have IE7+ installed)

If whatever you're printing is too long for one page, it will continue onto the next page, just like printing any webpage. There are tags that I've tried in some <table> tags that're supposed to keep it from breaking pages within the table or even a div, if possible, and other tags to force a page break at a certain point, (say, between recipies...) but they're VERY unreliable, and I usually just figure the chips will fall where they may! The problem with not using the tags is that if you print multiple recipies, you'll probably end up with half of the second recipe under the first, then a page break and the second half of the recipe on the next page. Less than ideal, but short of having a print dialog prompt for every recipe as I loop through them creating an html file for each individually, I don't know what else to do. :P

Look for v1.1 by the end of the week! I only have 2 areas of new functions I'm trying to get working, and only one is likely to prove to be much of a challenge, so I should be able to stick to the schedule. :P

Edited by james3mg
"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

All the information I've ever found on this was easy - my breakthrough came one afternoon when I right-clicked a HTML file on my desktop and noticed that "Print" was an option - meaning it could be called from the commandline and contain anything printable on a webpage. I went into the registry and grabbed the commandline to do this, and stuck it in a function. Cheating, huh? I know, not nearly as informative as you thought I might be :):)

Umm, very clever. I had a look at the registry and Hey! you've just copied it like you said. I wouldn't have thought of doing that.

.. I'd love to find out how to get a 'print preview'

ShellExecut($p_file) does that so you could do it with ie.au3 and get rid of all the Internet Explorer surrounding stuff.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Check the first post - v1.1 has been released! (though I'll upload any updates made necessary by bugs you may find :) )

"There are 10 types of people in this world - those who can read binary, and those who can't.""We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." ~Robert Wilensky0101101 1001010 1100001 1101101 1100101 1110011 0110011 1001101 10001110000101 0000111 0001000 0001110 0001101 0010010 1010110 0100001 1101110
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...