Tuicemens

General Category => X10 Automation Zone! => Topic started by: soxfan1966 on March 19, 2018, 06:19:27 PM

Title: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 19, 2018, 06:19:27 PM
I have been setting up some macros to trigger taking video and snapshots based on motion sensors.  They work well.

It would be nice if I could find a way to:
1) copy the files (snapshots / videos) just taken to my Google Drive
2) send me an email that new info has just been uploaded

I've searched this board as well as the X10 forum and there is some info, but most of it is quite old and not really sure it would still work.  I tried messing around using the "Execute Windows Program" calling a script but I am not sure what the arguments would be to pass info on the files (hope that makes sense).

Figured it was worth a shot to ask the question here - this board seems to get more activity than the x10 Forum (at least the SmartMacro sub topic).

Thanks
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 19, 2018, 06:49:52 PM
since AHP was never updated past 3.318 the info you've found on windows commands should still work.
That being said AHP was never designed to work in a 64 bit OS and Windows 10 has some additional security issues that may come into play.
if you have a script that does the task you wish you can just add the path to the script (including the script name and extension) in the Windows command, no arguments needed.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 19, 2018, 07:32:44 PM
Only info I couldn't find was about passing arrguments for the pic files to the script via the smart macro windows command.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 19, 2018, 09:46:43 PM
How are you sending the email notification?
With AHP or the script?
Emails from AHP were never very reliable (for me) And I'm not sure they still work being tied to the my house plugin
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 20, 2018, 05:56:35 AM
Trying to pass to the windows command line.  Usually there are conventionslike $F for file or percent (no percent key on my phone, I know weird) F type stuff, but I don't see anything like that for the windows command line feature from smartmacro.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 20, 2018, 08:24:16 AM
So your macro starts a script and the script excepts arguments?
Some arguments need to be placed inside quotes("") for AHP so send correctly.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 20, 2018, 10:04:16 AM
Ok, so don't think I am explaining this right.

As part of a macro, I want to add a step to use the Windows Command Line which has two Fields - one for the program and one for the arguments.

I have a command line script to call, but I want to pass the name of the pic files triggered from the macro to the command line as arguments.

Is that possible?
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 20, 2018, 11:48:10 AM
Only if your script excepts command line arguments and your pic location and names are always the same.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 21, 2018, 04:26:05 PM
Hmm, that wont work then.  The file name is different all the time, was hoping there was some wild card ability that could be used.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 21, 2018, 07:40:33 PM
OK, I think I over complicated it from the start.

What I have now is AHP saving the Pics and Videos to a Google Drive folder.  Then all I gotta do is open Google Drive on my phone or computer and pull up the pic or video.  Only issue is I wont know specifically which one was added, but hey is pretty much what I was looking for.

Then I use the Execute Windows Command to just send me an email (and I can actually send myself a text, by emailing my cell phone).  That gives me the notification I was looking for (still setting this up, but in theory it will work).  It also gives the the pics and videos in a place I access them remotely.

Now the problem is tryu
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 21, 2018, 08:21:01 PM
Success.  Got it working.  Using an application called SwithMail that lets you send Gmail using the command line, and have that set up as the last step in the SmartMacros I have using the Execute Windows Command.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 22, 2018, 07:15:29 AM
glad to see you have it working the way you wish `:)
 (Chr)
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 23, 2018, 06:33:13 PM
So sort of related, I had to reboot my computer and when I started it up again the macros were not working.  I looked at them and the arguments portion of the execute windows command was missing most of the info - it only had a few chars.

So I updated them again.  Making sure I saved.

I exited AHP and started it up again and the same thing happened.

I fixed them again, but I don't want to have to do this every time I have to start AHP.

Anyone had a similar issue before?
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 23, 2018, 07:59:30 PM
if your running windows 10 64 bit be sure you run AHP as administrator even if logged on as one  else settings don't always get saved correctly
 (Chr)
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 24, 2018, 05:52:28 AM
Ugh, that seems to be a problem not sure if its the problem specifically.  If I right click and Run As Administrator the configuration (devices and marcos, etc) is very different than if I just click on the program to start it up.  It looks like an older version of my settings.  The weird part is it seems to be opening the same file, but different versions of it.
Any way you know of getting those in synch, I would hate to have to manually update the Administrator version with everything new I have.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 24, 2018, 06:20:50 AM
What I did was update the ActiveHome Pro folder to have Full Control of Users, then I went into the program without starting it as Administrator and saved the configuration into a new file.  Then I updated the Ahp exe so that it was checked as "Run As Administrator" in the Comparability tab, then clicked on the exe to run it (dont have to right click now) and it opened the new configuration file, and everything was there.

However, the arguments to the Execute Windows program still do not save correctly.  It only shows "/s /from" (there are no quotes in the field, just used them here to clarify) instead of the whole list of arguments.  Not sure why that is still happening.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 24, 2018, 06:38:22 AM
It appears the part of the argument string is where the first " character is.  In some places I know you can use a single quote within a string of text surrounded by ", so maybe that would work.

So rather than:
/s /from "blah blah blah" /sub "Subject"

This would work instead:
"/s /from 'blah blah blah' /sub 'Subject'"

Other option is to put the stuff into a batch file then have the smart macro call the batch file but that seems more kludgy.

I am going to try both approaches.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 24, 2018, 06:51:03 AM
I went with the batch file.  It works.

Strange thing is I was cutting and pasting the arguments string from somewhere I saved it off into the argument line - and there it had " chars in it.

If I just try and type a " into the argument line nothing happens - so it looks like its stripping those out or something weird.

Anyway, looks like the batch file will work and I wont have to update the command every time I have to re-start AHP.

One last issue I am trying to fix - there is a delay between the time the sensor triggers the macro, the camera gets selected, and the video recording starts.  Just a few seconds but in one case its enough so I miss the start of the action that triggered the sensor.    Think I have to play around with the sensor locations.
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 24, 2018, 08:15:00 AM
I went with the batch file.  It works.

Anyway, looks like the batch file will work and I wont have to update the command every time I have to re-start AHP.

One last issue I am trying to fix - there is a delay between the time the sensor triggers the macro, the camera gets selected, and the video recording starts.  Just a few seconds but in one case its enough so I miss the start of the action that triggered the sensor.    Think I have to play around with the sensor locations.
a batch file will slow things up some what as well usually in the windows command arguments
if it was long you  needed to enclose it in quotes "" if not it never got sent correctly.
I also found sensor location also was key to get the first part of the motion you wished to capture.
I moved to IP cameras once my va12a failed and they were no longer available.
Also IP cameras are better at this as the sensor is build in as is the software to capture.
 (Chr)
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: soxfan1966 on March 24, 2018, 08:20:13 AM
Do you use x10 ip cameras?  Are there any you would recommend?
Title: Re: Way to get a SmartMacro to send Gmail with attachment ?
Post by: Tuicemen on March 24, 2018, 10:32:31 AM
I do have some X10 IP cameras in use.
I particularly like thex10 HD cameras but I wouldn't recommend them as all of mine have one or more issues which I have yet to work out.
Authinx still uses the same manufacture x10WTI did and they have the mentality better is cheaper.
I do like the old Foss cameras but not played with anything new.
Your best to look at one of the camera forums for recommendations.