New version 0.5.0-rc3 is out

Keep up to date with EG related information here.
User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

New version 0.5.0-rc3 is out

Post by topix » Mon Jul 03, 2017 4:22 pm

0.5.0-rc3 (2017-07-03)

Enhancements:
  • Document all command line options 235 (per1234)
  • Add Named pipe support to solve the problem with elevations 240 (kdschlosser)
  • eg.WinApi: Functions to get information about logged in user 254 (kdschlosser)
Fixed bugs:
  • MainMessageReceiver: Fixes broken clipboard chain in windows 10 (reported by saue0) 227 (kdschlosser)
  • [SchedulGhost] update plugin to 0.1.18 238 (topic2k)
  • Fixes incorrect checking of powerbroadcast notification message 241 (kdschlosser)
  • [Broadcaster] Fixes depreciation warning from asyncore.dispatcher 242 (kdschlosser)
  • [USBUIRT] Fixes learn ir dialog not closing 243 (kdschlosser)
  • [MCERemoteVista] Upgrades MCERemoteVista to version 1.4 244 (kdschlosser)
  • [System] fix GetMasterVolume (move use of VistaVolEvents to eg.WinApi.SoundMixer) 246 (kdschlosser)
  • NamedPipe: Fixes possible endless loop if -restart is used at the CLI 247 (kdschlosser)
  • Typo - Text.py, Fixes typo in save dialog 250 (kdschlosser)
  • Moves initialization of python paths to the first thing that EG does 253 (kdschlosser)
Other changes:
  • Remove wiki content from documentation 234 (per1234)
Download now


Please report any of the included plugins here if there is a newer version in the forum as in the setup.

User avatar
kgschlosser
Site Admin
Posts: 5020
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: New version 0.5.0-rc3 is out

Post by kgschlosser » Mon Jul 03, 2017 9:20 pm

Alight everyone. Let me explain some of the changes.


The starting up of EG has been changed. This is going to be used by improvements/additions made to EG in the future. There was a bug in EG but it really wasn't a bug. go figure on that one. But the issue was there is a module that is included with EventGhost and it resides in the lib27/site-packages folder. and this module was loaded/used by many of modules in the eg/WinApi folder and that folder is what houses as you can probably guess most of the connection specific goodies to Windows. and what was taking place is if we wanted to use some of the code located in that folder we would have to have it set up so that whatever it is we wanted to do would have to be done more then 1/2 way through the loading of EventGhost because that is when the /lib27/site-packages folder was added into EG so the cFunctions module could be imported. If WinApi was imported before that time all kinds of errors would happen because it would try to load the cFunctions module and it wouldn't be able to locate it. and this is going to be a problem in the future. So through some work and shuffling things about we were able to make it so that the first thing EventGhost does is set into place the locations that are necessary to give us the ability to load the WinApi. and it also allowed us to move the rest of the EG locations like the plugins directory and the config directory to right before the meat and potatoes of EG starts to load.

We were able to solve a couple of smallish bugs which almost no one probably ever knew about because they were very specific use case problems. One of them being that EG was never really 100% portable. The definition of portability means that everything is contained to a specific location. and what was taking place before is that EG would always create a folder in ProgramData and not remove it. So now if you specify an alternate configuration file through the use of the -configFile command line switch EG will now set the user plugins folder to be the same as the core plugins folder and it will not create the /ProgramData/EventGhost folder anymore. this is a nice feature because if you wanted to put EG onto a USB drive and plug it into someone's computer you can run EG from the USB drive and it will not alter anything on the HDD of the computer. This make it truly portable.

There is one bump that we discovered after RC3 was released and we honestly do not know if this is a bad thing or potentially a good thing as of yet. But if you have a second instance of EventGhost as an example on your desktop and you have the folder it is in called TestEventGhost if you run it it will not use the ProgramData/EventGhost folder. instead it will create a new one called ProgramData/TestEventGhost. the folder name that is created in the ProgramData folder will always be the ame name as the folder where EG resides. so if you change the install location from c:\Program Files (x86)\EventGhost to c:\Program Files (x86)\JimmyCrackedCorn then the ProgramData folder will be \ProgramData\JimmyCrackedCorn. I let everyone know this because if you have plugins that you installed that had the .egplugin extension those in the past would have been put into the \ProgramData\EventGhost\plugins folder. so if you have a second installation of EG and the containing folder of the program is not named EventGhost it will not see these plugins. This can be a good thing if you want to have to sets of plugins one for each of the installations. so this is an up in the air thing. But please let us know which way you want to go on this. we can fix it. we simply do not know if it is a bad or a good thing because it can go either way.

but if you are looking for plugins that you installed make sure you check the ProgramData folder that has the same name as the containing folder for the instance of EventGhost you are running.



We also exposed the EventGhost API through a named pipe. this has helped us to correct COM errors that could arise when using any of the command line switches while EventGhost was running and also solved permissions problems. An example of a permissions problem would be if you have EventGhost running as administrator and you double clicked on an egplugin file to install it but you were logged in as a user. there would be an error because you are not able to run EG as an Administrator and as a User at the same time. But through the use of named pipes we are able to simply tell the EG that is running to install the plugin.

This to has created a side effect. and that side effect is if you are running EG as an administrator and then you use the -restart switch as a user the new EG that start running will be as a user and not an Administrator. This is simply solved either by using runas if you are there to key in the admin password or by starting the cmd window as an administrator. but if you are restarting EG programmatically you will need to have whatever software start a command line and pass the following to it.

Code: Select all

powershell.exe -Command '$username = "YOUR_COMPUTER_NAME\YOUR_USER_NAME";$password = "YOUR_PASSWORD";$args = "-restart";$credentials = New-Object System.Management.Automation.PSCredential '-ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force));Start-Process "YOUR_PATH_TO_EVENTGHOST\eventghost.exe" -ArgumentList $args -Credential ($credentials);'
be sure to change the following and if there are additional command line parameters you wish to use then add them after -restart
YOUR_COMPUTER_NAME
YOUR_USER_NAME
YOUR_PATH_TO_EVENTGHOST

because of this we are going to add a -username and -password to the command line switches. this way you will be able to start EG as any user you want. This is currently under development I am trying to find a way to achieve this without the use of powershell.

But the addition of the named pipe is a large addition to eventghost the name of the pipe is

Code: Select all

\\.\pipe\eventghost
and anything that is in EG is accessible through this pipe. You are not able to set variables directly but if you create a function and that function accepts parameters then you can set the variables through the use of the function.

here is the layout of the information that you need to use. the pipe connection has to be set as a message pipe. and the information that is going to be sent needs to be a string. the message format is as follows

function/method/class, data to be passed

the message is split into 2 parts the first part is what you are trying to call. and the second part is any information you are wanting to pass. if the command does not need any data to be sent to it you can either simply pass the command or you can send the command followed by a ", ()" without the quotes

as an example if you wanted to send a command down the named pipe to show eventghost it would be
eg.document.ShowFrame, ()

because there are in parameters that need to be filled with this command you simply put ()

or if you wanted to open the add plugin dialog
eg.document.CmdAddPlugin, ()

maybe you want to check to see if EG needs to be saved. The pipe will return data if there is data to be returned so be sure you set the pipe up to receive information after sending a command even if you do not use the data sent back.
eg.document.IsDirty, ()

or if you wanted to tell a specific plugin to do something
eg.plugins.System.ChangeMasterVolumeBy, (-2.0,)


the pipe also accepts keyword arguments as well
eg.plugins.System.ChangeMasterVolumeBy, dict(value=-2.0)

or
eg.plugins.System.ChangeMasterVolumeBy, {'value': -2.0}


and to use it to set variables you would need to set up a python script that gets triggered by Main.OnInit that contains something like the following.

Code: Select all

def Some_Function(param1, param2):
    eg.globals.param1 = param1
    eg.globals.param2 = param2

eg.globals.some_function = Some_Function
and the pipe command
eg.globals.some_function, ('this is', 'a test')

and this will make eg.globals.param1 to be 'this is' and eg.globals.param2 to be 'a test'

through the use of the named pipe we are able to now use the -hide command line switch when eg is already running and it will minimize it. as well as the trigger event works as expected. I think there is a change to the trigger event specifically the payload data. it used to always make a list with a string in it. now it will function like it is supposed to and correctly set the payload data. so if you pass {'key': 'value'} the payload will no longer be ["{'key': 'value'}"] it will now be a python dict.



There was also an issue with the Clipboard getting broken when you exit EventGhost. We have solved this issue as well. I am unsure if this problem through the Windows Versions. but i do know it was an issue in Windows 10.

The depreciation warning when using the Broadcaster plugin is now gone.

USBUIRT plugin not being able to learn IR has been solved.

OK this is another major change. way back when in the days of Windows XP, eg.WinApi.SoundMixer was used to control anything relating to the sound on your computer. when newer OS's came about a module called VistaVolEvents was added to eventghost. but this module was added directly to the System plugin. and if Windows was newer then XP then it would use the VistaVolEvents. the issue with this is the eg.WinApi.SoundMixer basically became a dead stick. and you lost the use of the convenience functions built into it. So we have moved the use of VistaVolEvents into the eg.WinApi.SoundMixer and it has become active once again. It automatically determines the Windows version and if it should use the VistaVolEvents or not. it will do all of the nitty gritty calculations for you for setting things like the volume


There was also an issue with how EG read the information coming from windows about Power Settings this has now been fixed. this was a real bonehead mistake i made when I modified the System Plugin to produce more events based on what the power settings were and if you were on battery or not. I do apologize to the people that experienced any problems with this.
If you like the work I have been doing then feel free to Image

someguy1
Posts: 34
Joined: Sun Mar 02, 2014 2:09 pm

Re: New version 0.5.0-rc3 is out

Post by someguy1 » Tue Jul 04, 2017 8:17 pm

I keep getting errors in this latest version whenever I control my philips hue through the hue plugin...an example of the errors I get:

"Traceback (most recent call last):
File "EventGhost.pyw", line 53, in <module>
File "C:\Program Files (x86)\EventGhost\eg\__init__.py", line 31, in <module>
import Cli
File "C:\Program Files (x86)\EventGhost\eg\Cli.py", line 172, in <module>
'eg.TriggerEvent, %s' % str(args.startupEvent)
File "C:\Program Files (x86)\EventGhost\eg\NamedPipe.py", line 253, in send_message
return eval(data)
File "<string>", line 1
<eg.Classes.EventGhostEvent.EventGhostEvent object at 0x051D16F0>
^
SyntaxError: invalid syntax"

User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: New version 0.5.0-rc3 is out

Post by topix » Tue Jul 04, 2017 8:49 pm

Thanx for reporting. I found a quick fix though i don't know if it has sideeffects (didn't test much).

Replace the NamedPipe.py in <yourInstallFolder>/EventGhost/eg/ with the attached file (exit EG before) and try again.
Attachments
NamedPipe.py
(10.08 KiB) Downloaded 112 times

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: New version 0.5.0-rc3 is out

Post by Luca Brasi » Tue Jul 04, 2017 9:03 pm

Hey guys,
thank you very much for all the hard work. Looking at your long post @kgschlosser it must have been a shitload of work :-)

I got one hickup though:
Actions on the Primary Sound Driver result in

Code: Select all

23:00:41   Verändere Master-Lautstärke: -1.00 %
23:00:41      Fehler in Befehl: "Verändere Master-Lautstärke: -1.00 %"
23:00:41      Traceback (most recent call last) (0.5.0-rc3):
23:00:41        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
23:00:41          return self(*args)
23:00:41        File "C:\Program Files (x86)\EventGhost\plugins\System\__init__.py", line 1866, in __call__
23:00:41          SoundMixer.ChangeMasterVolumeBy(value, deviceId)
23:00:41        File "C:\Program Files (x86)\EventGhost\eg\WinApi\SoundMixer.py", line 181, in ChangeMasterVolumeBy
23:00:41          oldVolume = GetMasterVolume(deviceId)
23:00:41        File "C:\Program Files (x86)\EventGhost\eg\WinApi\SoundMixer.py", line 317, in GetMasterVolume
23:00:41          deviceId = GetDeviceId(deviceId, True)
23:00:41        File "C:\Program Files (x86)\EventGhost\plugins\System\__init__.py", line 100, in GetDeviceId_
23:00:41          id = oldGetDeviceId(*args, **kwargs)
23:00:41        File "C:\Program Files (x86)\EventGhost\eg\WinApi\SoundMixer.py", line 261, in GetDeviceId
23:00:41          raise SoundMixerException()
23:00:41      SoundMixerException
If I test the actions with the a specific device everything work fine.
Let me know if I can help with debugging...
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

User avatar
kgschlosser
Site Admin
Posts: 5020
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: New version 0.5.0-rc3 is out

Post by kgschlosser » Wed Jul 05, 2017 3:57 am

@Luca Brasi

replace the file eg\WinApi\SoundMixer.py with the one attached.
Attachments
SoundMixer.py
(16.93 KiB) Downloaded 95 times
If you like the work I have been doing then feel free to Image

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: New version 0.5.0-rc3 is out

Post by Luca Brasi » Wed Jul 05, 2017 6:27 am

Unfortunately I get the same error with the test soundmixer.py

Code: Select all

08:25:28   Verändere Master-Lautstärke: 1.00 %
08:25:28      Fehler in Befehl: "Verändere Master-Lautstärke: 1.00 %"
08:25:28      Traceback (most recent call last) (0.5.0-rc3):
08:25:28        File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 116, in CallWrapper
08:25:28          return self(*args)
08:25:28        File "C:\Program Files (x86)\EventGhost\plugins\System\__init__.py", line 1866, in __call__
08:25:28          SoundMixer.ChangeMasterVolumeBy(value, deviceId)
08:25:28        File "C:\Program Files (x86)\EventGhost\eg\WinApi\SoundMixer.py", line 181, in ChangeMasterVolumeBy
08:25:28          oldVolume = GetMasterVolume(deviceId)
08:25:28        File "C:\Program Files (x86)\EventGhost\eg\WinApi\SoundMixer.py", line 317, in GetMasterVolume
08:25:28          deviceId = GetDeviceId(deviceId, True)
08:25:28        File "C:\Program Files (x86)\EventGhost\plugins\System\__init__.py", line 100, in GetDeviceId_
08:25:28          id = oldGetDeviceId(*args, **kwargs)
08:25:28        File "C:\Program Files (x86)\EventGhost\eg\WinApi\SoundMixer.py", line 262, in GetDeviceId
08:25:28          raise SoundMixerException()
08:25:28      SoundMixerException
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

someguy1
Posts: 34
Joined: Sun Mar 02, 2014 2:09 pm

Re: New version 0.5.0-rc3 is out

Post by someguy1 » Wed Jul 05, 2017 8:15 am

topix wrote:Thanx for reporting. I found a quick fix though i don't know if it has sideeffects (didn't test much).

Replace the NamedPipe.py in <yourInstallFolder>/EventGhost/eg/ with the attached file (exit EG before) and try again.
Thanks it worked, only side effect I can see is a slight CPU spike when I use the keyboard to control the hue, no cpu spike when i use the remote for the same thing.

User avatar
kgschlosser
Site Admin
Posts: 5020
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: New version 0.5.0-rc3 is out

Post by kgschlosser » Wed Jul 05, 2017 11:55 am

@Luca Brasi

give this a try. it is going to print out 2 lines of information just before the traceback happens. if you could copy and paste the 2 lines here for me it will give me a better idea of what is going on.
Attachments
SoundMixer.py
(17 KiB) Downloaded 97 times
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 5020
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: New version 0.5.0-rc3 is out

Post by kgschlosser » Wed Jul 05, 2017 12:15 pm

@someguy1 and this is a plugin you are using that caused the Traceback? I ask this because I am trying to figure out why a plugin is using a command line trigger event. Or are you using something that is sending an event into Eve this way? I do not own a hue device so it would be difficult to test. And when you say a spike how much of an increase is there?
If you like the work I have been doing then feel free to Image

someguy1
Posts: 34
Joined: Sun Mar 02, 2014 2:09 pm

Re: New version 0.5.0-rc3 is out

Post by someguy1 » Wed Jul 05, 2017 1:45 pm

kgschlosser wrote:@someguy1 and this is a plugin you are using that caused the Traceback? I ask this because I am trying to figure out why a plugin is using a command line trigger event. Or are you using something that is sending an event into Eve this way? I do not own a hue device so it would be difficult to test. And when you say a spike how much of an increase is there?
I am using this plugin in EG: viewtopic.php?f=9&t=6770
I use Autohotkey to send keyboard key events to EG, this because the EG keyboard plugin is terrible and does not work properly. I also use the same plugin for my MCE remote, which works just fine.
The CPU spikes only happen when i use the keyboard, not the remote. They are minuscule, max 10%.

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: New version 0.5.0-rc3 is out

Post by Luca Brasi » Wed Jul 05, 2017 2:38 pm

kgschlosser wrote:@Luca Brasi

give this a try. it is going to print out 2 lines of information just before the traceback happens. if you could copy and paste the 2 lines here for me it will give me a better idea of what is going on.
This is what I get

Code: Select all

   {0: u'Lautsprecher (Realtek High Defi', 1: u'Realtek HD Audio 2nd output (Re', 2: u'Realtek Digital Output (Realtek', 3: u'FrontMic (Realtek High Definiti', -1: 'Primary Sound Driver'}
   -1
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

User avatar
kgschlosser
Site Admin
Posts: 5020
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: New version 0.5.0-rc3 is out

Post by kgschlosser » Wed Jul 05, 2017 2:49 pm

ok now I want you to replace your plugins\system\__init__.py file with this one.
Attachments
__init__.py
(73.69 KiB) Downloaded 114 times
If you like the work I have been doing then feel free to Image

User avatar
Luca Brasi
Experienced User
Posts: 262
Joined: Sat Oct 11, 2008 12:39 pm

Re: New version 0.5.0-rc3 is out

Post by Luca Brasi » Wed Jul 05, 2017 3:17 pm

kgschlosser wrote:ok now I want you to replace your plugins\system\__init__.py file with this one.
Cool! Looks like it is working!
No error and volume is set correctly. Still have have the 2 debug lines in there but I guess I can just revert back the SoundMixer.py
Win10 x64 Prof. / Eventghost latest / MCE Plugin / MCE RC6 Receiver / Logitech Harmony Hub / MediaPortal / kodi

User avatar
kgschlosser
Site Admin
Posts: 5020
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: New version 0.5.0-rc3 is out

Post by kgschlosser » Wed Jul 05, 2017 5:06 pm

Yeah revert back to the one I posted first. The second one was simply for debugging. But you still need to have the modified SoundMixer in place. It requires both to function properly.
If you like the work I have been doing then feel free to Image

Post Reply