AHK scheduled inventory report & email report

I wrote and article AHK Barcode and freezer Inventory to monitor my Freezer inventory. The idea was to test out an inventory structure and play with a handheld barcode reader. I did a video on it here:

After creating the AHK script for that and testing it out, I then wanted to progress the idea further by creating a reporting script that would then process the inventory and inform on its condition, whether there was sufficient stock or whether more was needed. There is a video on that here:

Issues with report

In the video on creating the report there were a couple of issues that arose, these were:

  1. The Task Scheduler settings I used were based on a time each day, and if the computer was not on, then the script wasn’t run. You could only figure out when the report was created by the date/time on the file itself.
  2. In the video I mentioned that a nice addon would be to be able to email the script to yourself after it ran, so you had a copy straight away to access and react to.

I wanted to address the two items above. For the first, I can build another trigger to start on logon, so as soon as computer wakes, it will run the script. That is one way.

Another method is to make a copy of the file and move it onto my server which is running 24/7 so that it can be processed at a regular time. I haven’t explored that process yet. From playing with Power Automate I see there is a FTP link that that will automate, so I may look to explore that process using AHK instead.

Another thing I di was to add the time the file is generated and add that time/date at the top of the file, that way you know when it was created without having to look at the file date.

AHK emailing via gmail

The 2nd issue was email with AHK. I’d tried this with little success in the past, and I came across this video by TAB Nation:

I used the code and got a bug in it (I discuss the bug in the video comments, and resolved it and posted solution). Somewhere through the process odd digits were being added to a URL sting so it wouldn’t run. I fixed it with a patch by splitting the URL into 2 parts and then joining them later and it seems to work fine. The issue was unblocking the gmail account so it accepts the AHK script sending the email. The video above mentions that.

My AHK email script is here.

Email to SMS

In the Tab nation video he does an Email to SMS, and in the states Zoe says that you can do this for free. I tried doing this after searching through and finding the only 2 providers in NZ which is spark and vodaphone. I have a Warehouse Mobile(WM) account and was not sure which of the two were the carrier for WM so I tried them both. Each had a similar response:

Vodafone multiTXT – Unregistered email2sms address [email protected] My company has a Vodafone multiTXT account but I may not be a registered user Solution: Contact your account administrator and ask them to register your email address as an email2sms user.

From Spark I got Spark eTXT – Message Not Delivered. Hi,You recently sent an email to [email protected] that was not converted to SMS by eTXT as your email address ([email protected]) is not set-up.If you want your [email protected] email address added, your domain, or maybe your mail server (IP address: 209.85.210.182) enabled for sending SMS via email using eTXT, please call 0800 438 3898 with your login ID or account details.Thanks

So it seems that in NZ to send email to SMS you need to have a paid service. I may have to look into this at a later date to see what the costs are.

Better structured Report file in Email

I created a video of the process in this post and in it I was concerned with theformat of the report. I wanted the information to be in an ordered manner. By the end of the video I still had not achieved this but said when I had it working I’d post it in this article, you can download the script here. (Note, I’ve reordered output description by reordering info2 =Priority 2 ,Stock Now %varR% , %DescR%,”Match not found”, ‘Getting low, put on list between 3 and 5’ `r) in script since uploading code.

This is what it looks like. It has date at top, and then different priorities in order with space between them. On each line it shows curret quantity and also criteria as to why it is on that line, ie what set points were used to determine whether to orgder more or when quantity of stock is sufficient that it is OK.

Video of this article

Iwanted to get this video completed so that I could focus on another project, so a bit messy.

End comment

It is good to be able to refine the process so that you receive an email. I need to refine the automation process so that it all links together.

I think I’ll do a video on this as it’s a handy resource to o back to. I’ll link to the video when I do.

A couple of other refinements would be to order the information into 3 files, order immediately, order soon and stock OK. That way you can just send on info of first and 2nd files for action. Or look at listing them all in order of priority so you can say action items 1 to 11 and 15.

I think the exploration into FTP transfer maybe an interesting process to learn.