X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: Tuicemen on April 07, 2008, 04:58:07 PM

Title: Problem with Batch files executing?
Post by: Tuicemen on April 07, 2008, 04:58:07 PM
On occasion I've noticed some of my batch files didn't fire! :(
Possibly a bug in AHP 3.2.0.6?  ???  ::)
Even trying to manually trigger the batch file from inside AHP fails! :( ???

A fix:
Edit the Macro, redo the path for the Batch file and save the macro
Of coarse I found this was only temporary! ::) :(

A better Solution:
Convert Batch files to EXE files
The freeware program I used : Bat-To Exe_Converter from F2KO (http://www.f2ko.de/English/b2e/download.php)
So far no issues with exe files not firing  ::) ;) (time will tell if this is truly the permanent solution!)

No guarantee that this will work for everyone or for all batch files but hopefully this will be found helpful for a few users! ;) ;D >:(
The Best solution:
X10 gets a new version out with all the bugs users have reported fixed!  ;) :D ;D
Don't hold your breath for this one to happen any time soon folks! :( ::)

Update: Read on for a workaround that works! ;)
Title: Re: Problem with Batch files executing?
Post by: Puck on April 07, 2008, 05:41:10 PM
On occasion I've noticed some of my batch files didn't fire! :(
Possibly a bug in AHP 3.2.0.6?  ???  ::)
Even trying to manually trigger the batch file from inside AHP fails! :( ???

A fix:
Edit the Macro, redo the path for the Batch file and save the macro
Of coarse I found this was only temporary! ::) :(

A better Solution:
Convert Batch files to EXE files
The freeware program I used : Bat-To Exe_Converter from F2KO (http://www.f2ko.de/English/b2e/download.php)
So far no issues with exe files not firing  ::) ;) (time will tell if this is truly the permanent solution!)

No guarantee that this will work for everyone or for all batch files but hopefully this will be found helpful for a few users! ;) ;D >:(
The Best solution:
X10 gets a new version out with all the bugs users have reported fixed!  ;) :D ;D
Don't hold your breath for this one to happen any time soon folks! :( ::)

Seen this too. Even occurs for me with "EXE" files unfortunately.  >:( :(

I find that anytime I close AHP and restart it, that I have to re-do the path in the macro. Weird thing is, I only have to do it for one macro and then all macros execute their files again.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on April 07, 2008, 05:54:53 PM

Seen this too. Even occurs for me with "EXE" files unfortunately.  >:( :(

I find that anytime I close AHP and restart it, that I have to re-do the path in the macro.
Hum I hadn't noticed this with my exe files  ::) But just did >:( >:( ::)! So much for that Work around!
Quote
Weird thing is, I only have to do it for one macro and then all macros execute their files again.
Ya noticed that too! ::) ???
I don't recall the issue with version 3.204 ::)
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on April 13, 2008, 09:00:09 AM
Out of curiosity I thought I'd try the EU version to see if the bug was present there as well!
Guess it isn't only the programmers on this side of the pond that missed that bug!
I also noticed only my EXE files I created stop working, simple ones that just open a program still worked! ::) :( ::) :(

I had originally thought this was the result of windows updates as AHP was running 24/7 and PC usually rebooted after an update which was when I first noticed this! :(
Thinking it was only batch file execution that was failing resulted in my original post which no doubt gained me some Unhelpful ratings ::) :( (another topic)!
To prove I'm not one to give up easily and that there is usually a workaround for any obstacle I pressed forward!
I now have a work around for this and am currently testing with great success so far 25 restarts and counting, with no  Batchfile or EXE file miss fires (no failed execution)!
I'll post a step by step how too once my tests are finished!
For those that can wait for my tests to complete you can also get this working using a program I wrote about  in Expand your macros functionality (http://www.x10community.com/forums/index.php?topic=12650.0) called AutoHotKey (http://www.autohotkey.com/).
For those that don't have it yet, Get it!
 Your going to need it!
;)
Title: Re: Problem with Batch files executing?
Post by: Puck on April 13, 2008, 02:44:51 PM
Thinking it was only batch file execution that was failing resulted in my original post which no doubt gained me some Unhelpful ratings ::) :(

If this is the case, then shame on those who did.

Bringing attention to this problem and trying to come up with a work around should be applauded, not insulted.

Keep up the good work on this problem.  :)
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on April 13, 2008, 06:18:46 PM
Thanks for the encouragement Puck!
I've finished testing the AutoHotKey workaround!
Here are my findings:

With a general AutoHotKey created exe icon press, AHP fires 100% of the time and reconfigured a troubled windows command macro successfully!
When adding the AutoHotKey created exe to the start up folder and rebooting the PC,AHP fires 100% of the time and reconfigured a troubled windows command macro 85% of the time successfully!
I'm thinking it is a time issues as some reboots connect to the internet faster then others.This time variance can be compensated by changing the pause value in the script from 100 to possibly 150 although in my tests setting to this value made it look like the script didn't complete when infact it had!
As promised here is a step by step to create a AutoHotKey AHP start exe that auto fixes the problem with the windows command options:


OK you've created the script 
Now to convert it to an exe file:

You've now a new AHP starting script which auto fixes all problem window command macros.
Use this to start AHP now instead of the way you use to start AHP replacing any AHP shortcuts with short cuts to this new file ;)
You can even use it in your start up!
Note: For the Custom icon I used Icon Sucker (http://www.download.com/Icon-Sucker/3000-2195_4-10053519.html) and pulled the icon from AHP so this new file even looks like AHPs short cut!
I only hope this works as well for every one else as it does for me! ;)

Edited to fix code issues from older forum software update
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on April 18, 2008, 03:42:26 PM
Update:
I rebuilt my initial AutoHotKey start file using AHP hotkeys where ever possible instead of mouse movements, Just after I posted the how too!
To date AHP has started very time and successfully redone the windows command macro causing issues!
I have since not, missed one sound file played from a batch file or exe file! ;)
This is even with reboots sometimes 2- 3 times a day for program, and virus updates!
So far It is working better then initially reported! ;)
I do how ever see one area where I may need to make some improvements as AHP remembers last folder opened!
If I load another AHX file and forget to set AHP so it sees my batch file folder my AutoHotkey start up will fail to relocate the file for my windows command macro! :( ::)
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on January 02, 2009, 04:28:17 PM
Update:  
After downloading 3.236 I had to test to see if this batch file ,EXE file executing problem was solved! ::) :'
I shouldn't have wasted my time! ::) :'  >*< The issue still exists thankfully my work around has worked flawless even with the newest update!
Probably over 1,000 restarts with no batchfile/exe issues! :)%
 >!
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on January 15, 2009, 05:59:07 PM
I've been working with Windows 7 for a couple of days now and thought it was about time I started adding AHP and some of the thirdparty software programs!
I wasn't looking forward to recreating my script file so I copied into my New test PC and the AHP folder!I was amazed that it worked first go !  :)%
So save that script file it will save you some time when/if you update your OS!
 >!
Title: Re: Problem with Batch files executing?
Post by: gardavis on March 02, 2009, 04:09:48 PM
I am working on a Garage Door solution and my macro calls a batch script to execute an X10WavPlayer. Sometimes, I see this error on the server that is running AHP. I normally connect to the server via Remote Desktop which may or may not have audio redirected.

Anyhow, the error I see is "Unable to parse command line arguments". The stack trace shows System.Runtime.InteropServices.COMException at SpeechLib.SpVoiceClass.Speak() at X10WavPlayer.Form1.play() at ...initializecommandline().

So this may be different than what this thread is about since it looks like the batch file is started up and it is starting up the X10WavPlayer.

This is the batch file contents:

@start "" /B "C:\Program Files\X10WavPlayer\X10WavPlayer" "Please be advised that the garage door is opening. Repeat, the garage door is opening. Thank you." 0

Thanks,
Gary Davis


Title: Re: Problem with Batch files executing?
Post by: gardavis on March 02, 2009, 04:12:34 PM
Oh yeah. I am running this on Windows Server 2008.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on March 04, 2009, 04:13:29 PM
gardavis
The problem I is indeed the Batch file!
the quotations marks are confusing X10WavPlayer!
try:
Code: [Select]
@echo off
cd C:\Program Files\X10WavPlayer
X10WavPlayer "Please be advised that the garage door is opening. Repeat, the garage door is opening. Thank you." 0
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on November 16, 2010, 10:53:53 AM
Update:
As of now AHP is in version 3.296, I've just installed Windows 7 64bit and problem still exists.
Hoping my original Autothotkey script would work I just copied it from my old 32 bit OS.Since 64 bit puts AHP in a different route directory (Program Files (x86)) I had to rebuild from scratch or reinstall AHP to Program files  folder.
I decided to rebuild the Autohotkey file the good new it still works even with 64bit! :)% 
 >!
Title: Re: Problem with Batch files executing?
Post by: Noam on November 16, 2010, 11:21:16 AM
I haven't played with macros running batch files, but what path are you running the batch files from, and what path does it keep resetting to?
Perhaps there is a permission issue with the file used to store the setting (I found a problem a few years ago with the "smart macros Wizard" preference (it kept reverting back from "advanced" to "wizard"), and it turned out it was a registry key.
You might be able to force the file location by fixing the underlying problem, or by scripting that change before opening AHP.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on November 16, 2010, 01:07:38 PM
Noam:
It doesn't matter what path you use I've even added the batch files and exe files to the AHP folder.
The info (paths) in the macros never change (revert).
The macro fires but the windows command part  appears to start but fails.
They always will work when you first set up the macro but always fail once you restart AHP

The work around here has never failed me once since I started using it.
Note: you only need to rebuild one windows command macro or create a new one and all other macros with windows commands start to work correctly.
You might be able to force the file location by fixing the underlying problem, or by scripting that change before opening AHP.
The file location isn't the issue AHP will open any file in any location the first time you set up the macro.
Scripting a macro edit works fine and actually speeds up the load of AHP as you can close any pop up screens that appear on loading with the script as well.
I actualy have several windows command macros which open files in many locations and they all work!
 >!
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 01, 2010, 04:54:49 PM
Well it had to happen my batch files stopped working.
I noticed win 7 wasn't opening the correct folder  when I clicked on the edit button in AHP.
Some place I'd never opened before even in explorer. Maybe a 3.296 bug ??? ::) :'
in any case I desided to redo my autostart again this time typing in the path to the edited batch file. So here is the revised step by step.
Install AutoHot Key and open it's root folder
Open the folder"AutoScriptWriter" and click on (open) AutoScriptWriter.exe
Browse to the ActiveHm.exe (usually in C:\Program Files\ActiveHome Pro) the path and file should appear in the "Initiate the following run line upon record" box
Ensure record & Shrink and record mouse buttons are depressed
Press record,AHP will now open and a stop botton will appear in the top left of the screen

Click on the room that a windows command macro is in 
Next click on edit for the macro
In the box that pops up type the complete path of the exe file or batch file for that macro
click ok
Next click on the floppy icon in the bottom Right to save (Note: AHP hotkeys will work here too and usualy work better)
Next click on the stop record button
The AutoScriptWriter screen will appear with all mouse movements and button presses recorded
Go to the bottom of the script and add the line "Exit," (minus the quotation marks)
Click save and give it a name you'll remember
Close the AutoScriptW
you can now convert it to a exe file if you wish and use that to open AHP
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 22, 2010, 05:18:15 PM
Finally thanks to the newest batch of programmers at X10 this is Fixed!
EXE files fire every time as do Batch files.
However you need to specify the full path to the program in the batch file even if it is in the same folder as the program your trying to start.
So if you use Batch files included in PcCompanion you need to edit the files and replace the CD.. with the full path to PcCompanion
Here is an example of my the "Time(0)".bat file before and after the edits
Before:
Code: [Select]
@ echo off
CD..
PcCompanion ">Time?<" 0
After the edit:
Code: [Select]
@ echo off
Cd C:\Program Files (x86)\PcCompanion
PcCompanion ">Time?<" 0
Hope this helps anyone that is still having issues!
 >!
Title: Re: Problem with Batch files executing?
Post by: Noam on December 22, 2010, 07:25:27 PM
To make sure I understand this:
The batch file you were using (and the batch file complied to EXE, also) had a relative path in it, that was based on the location of the batch file.
Since AHP was executing the batch file from a different "working directory," the batch file itself would run, but since the first command was to change to a relative path that didn't exist in relation to the working directory, the rest of it didn't work?

So it wasn't really an AHP problem then, right? moving the batch file a different folder and running it from there (from a command prompt) would have also failed, right?

Does putting in an absolute path work EVERY TIME?
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 22, 2010, 08:45:57 PM
To make sure I understand this:
The batch file you were using (and the batch file complied to EXE, also) had a relative path in it, that was based on the location of the batch file.
Yes.
Quote
Since AHP was executing the batch file from a different "working directory," the batch file itself would run, but since the first command was to change to a relative path that didn't exist in relation to the working directory, the rest of it didn't work?
But in AHP you specify where the batch file or program(exe) is, you could have it in the root folder or anywhere.
In the example I posted above the files were in a sub directory of the exe file. But I had also tried it with PCCompanion in AHPs root folder and using the full path.
AHP allways executed the file from the directory(folder) that the file was in place.

Quote
So it wasn't really an AHP problem then, right?
Yes it was a AHP issue.This issue  even applied to opening a program like internet explorer not using a batch file.
Even with a full path in the Batch file it failed
Quote
moving the batch file a different folder and running it from there (from a command prompt) would have also failed, right?
using the example of the batch file I posted Yes it would have fail placing it anywere else.
Quote
Does putting in an absolute path work EVERY TIME?
yep, it does now! ;)
Title: Re: Problem with Batch files executing?
Post by: Noam on December 23, 2010, 08:28:05 AM
Ok, now I'm even MORE confused.
When did they fix the issue in AHP?
I didn't see anything about that, and somebody (was it you?) said that even with 3.301, the bug wasn't fixed.
They haven't released anything since 3.301 (that I know of).

Also, I think you had mentioned that if you go into AHP and edit the macro, that fixes it (until you close AHP and re-open it). THAT sounds like a bug to me. It should execute it the same way every time, no matter what.
Perhaps they should add in a "working directory" option for the program, so things that require relative paths can still work.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 23, 2010, 08:41:38 AM
Yes. it was me that stated the windows command option was still broken with this version. I did jump the gun on that! However once I re did my macros pointing to exe files they worked.
And when Eric stated He couldn't reproduce my issues with Batch files I started to play a little more.
I'm Not saying it is working the way I'd like it to but it now works at least, and no extra work is required for it to fire (Open)Programs exe.
Command line paramiter batch files or EXEs made from these need a little work.
 >!
Title: Re: Problem with Batch files executing?
Post by: hpdrifter on December 28, 2010, 10:34:10 PM
Finally thanks to the newest batch of programmers at X10 this is Fixed!
EXE files fire every time as do Batch files.
However you need to specify the full path to the program in the batch file even if it is in the same folder as the program your trying to start.
So if you use Batch files included in PcCompanion you need to edit the files and replace the CD.. with the full path to PcCompanion
Here is an example of my the "Time(0)".bat file before and after the edits
Before:
Code: [Select]
@ echo off
CD..
PcCompanion ">Time?<" 0

After the edit:
Code: [Select]
@ echo off
Cd C:\Program Files (x86)\PcCompanion
PcCompanion ">Time?<" 0
Hope this helps anyone that is still having issues!
 >!
What did the programmers do?  Just recently?  I have 3.236.  Will it take an upgrade?  My window's command line usage is hit or miss.

Edited by Tuicemen to fix quote(readability)
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 28, 2010, 11:04:45 PM
What the programmers did and if it was done with this latest release or prior only they know! ::) :'
Your version of AHP is Upgradeable you can find the files here: http://www.x10.com/support/support_soft1.htm
Since fixing the line in my batch file and updating to 3.301 my batch files have fired 100% .
The work around had worked for me until I switched to windows 7 64 bit. Then I had to rebuild the script file and by the time I had it tweaked X10 had this release out.
 >!
Title: Re: Problem with Batch files executing?
Post by: hpdrifter on December 28, 2010, 11:39:28 PM
I tried the "fix" you posted.  I guess it's over my head.  I never saw the "record" in the lower left corner.

I did click on a record right beside the "initiate run line upon record" box. and the "stop".

I recorded...."somethng" and used an AHP icon for that exe file to start AHP.

All I got in the script box was a bunch of Window(activate) and mouse moves.

When finished the macros seemed to work, but because of what????????????????
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 29, 2010, 07:34:31 AM
It couldn't have been too over your head you got it to work! ;)

Basicaly you made AHP think you made a new windows command macro.
Doing this for some reason made all the other windows command macros work as well.

If you open AHP (prior v 3.301) without your script file windows command macros failed 100%
Recreate one or create a new one and they would all start working until you restarted AHP again. ::) :'
The reason? ???
Without being able to dig into the old code I have no idea!
 >!
Title: Re: Problem with Batch files executing?
Post by: Noam on December 29, 2010, 09:11:42 AM
Has anyone tried testing an older version of AHP (like 3.236), but using batch files that have an absolute (instead of a relative) path in them?
That would be the test to know for sure if they made any changes to that part of AHP in any of the 2010 updates.

I didn't think they had made changes to the code, since you reported the problem still existed it AFTER they released 3.301, and Erik didn't seem to know about the issue. I would think he would have mentioned something had they worked on that part of the code.

As to why your "workaround" of creating a new macro worked, I'm baffled. THAT sounds like a bug to me.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on December 29, 2010, 10:30:23 AM
Actualy I had mentioned to Eric about this issue a week before the SDK crash issue and He said he would look into it for the next release which was this one.
That may be why he sounded confused when I stated it was still an issue.
hpdrifter stated he was using 3.236 and had the issue.
 >!
Title: Re: Problem with Batch files executing?
Post by: Noam on December 29, 2010, 11:20:19 AM
Sorry, I wasn't aware of that.
I think the 3.301 release was more of an "emergency" release, since the new SDK didn't like something in the prior releases. I don't think it was a planned update. I'll bet the developers are probably taking some vacation for the holidays, but I wouldn't be surprised if we hear something about this in January.
Title: Re: Problem with Batch files executing?
Post by: hpdrifter on January 04, 2011, 12:02:06 AM
Well, I've noticed a few things after working "the fix".

1  my batch files work.
2 upon start up the "video device not installed" box doesn't come up.
3 "Show conditions" doesn't work.  It never gives me the option to show conditions.

I went back and opened AHP with the regular exe and "Show conditions" in macros worked.???????????
Title: Re: Problem with Batch files executing?
Post by: hpdrifter on January 04, 2011, 08:57:58 PM
Plus one more item:

On the task bar, where AHP resides, I get a "Featured Option loaded" notification.

Guess I'll have to use AHP shortcut and not Hotkeys.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on January 04, 2011, 09:00:01 PM
Plus one more item:

On the task bar, where AHP resides, I get a "Featured Option loaded" notification.

Guess I'll have to use AHP shortcut and not Hotkeys.
Or update AHP! ;)
Title: Re: Problem with Batch files executing?
Post by: hpdrifter on January 06, 2011, 07:21:21 PM
Plus one more item:

On the task bar, where AHP resides, I get a "Featured Option loaded" notification.

Guess I'll have to use AHP shortcut and not Hotkeys.
Or update AHP! ;)
I don't know the exact operation,i.e. download whole program or just update, but when I loaded AHP before it took over 4 hours to download.  I'm not particularly looking forward to that again.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on January 06, 2011, 07:26:18 PM
Are you On Dial up?
Get a program like Getright!
A download manager will help alot!
 >!
Title: Re: Problem with Batch files executing?
Post by: hpdrifter on January 06, 2011, 08:21:38 PM
Are you On Dial up?
Get a program like Getright!
A download manager will help alot!
 >!

Actually, am right at this very moment connected with a Datajack, a 3g usb modem.  Kinda looks like it may work out here in the sticks.  If so, SOME of my problems are gonna be smoothed. Not DSL, but mega lightyears faster than 56K. Previous life was dialup.
Title: Re: Problem with Batch files executing?
Post by: Knightrider on January 07, 2011, 09:09:49 AM
Since AHP installers are bootstrap files, GetRight does not work.  I've had getright since Tuicemen referred it to me in 2007.  The sticks are a fine place to live, but the internet is rough out here. sigh

Yes, it does take quite a while for AHP to download, and the connection keeps breaking and you have to hit "re try" many many times.
Title: Re: Problem with Batch files executing?
Post by: Tuicemen on January 07, 2011, 09:14:45 AM
Thanks for the input Knightrider,  I've been off dialup for so long now I forget these things!
Title: Re: Problem with Batch files executing?
Post by: erlwebmail on January 13, 2011, 02:25:07 PM
Just to continue this thread...  I have fought the "...Batch Files executing" problem most of the day, and can report that
(1) Deleting the problem macro and starting over makes 'em all better. (Consistent with Noam's Reply #19 on: December 23, 2010, 05:28:05 AM)
(2) No problem running batch files under version 3.302, at least so far. See earlier warnings about quote marks in paths and filenames. I run my batch files out of    C:\X-10-Tools   which is nice and short and includes no spaces. Sorry- -  don't waste your time trying to run in  "C:\Documents and Settings\YourAcct\My Documents"  or the like.
(3) Before doing anything in AHP which involves your security system, install and "shake out" the security system thoroughly. It needs to be running without problems before you begin anything with AHP. I had a problem with a DS10A door sensor which had to be licked before continuing.
(4) Before writing an AHP macro which involves Security System sensors, be sure that you run Tools | Hardware Configuration and set the House Code to where you want it to be. You will be registering security system door sensors and such a second time with AHP, and if you don't do this they'll likely pop up in house code A and you can't access them while running under another house code. [Oh, it'll look like you can, but... nope!]
(5) Install sensors in AHP one-at-a-time, cancel the install, edit the sensor's name, then click the Install button. (Otherwise, if you install before editing, you'll have to install again. Note to you AHP programmers: This needs to be changed.) Hold down the Test button on the sensor until the security system ding-dong sounds, let go, then return to your AHP console where (hopefully) it will have registered the sensor. Then check the dang thing by clicking Tools | Find other computers, to make sure you have a recognized sensor. Then build your macro.

I'm fighting duplicate sensor signals at the moment. Hopefully there's help in another thread. But thanks for the batch file discussion.  ...greatly appreciated. :)%