Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Eventghost, toggling and Bluetooth

If you have a question or need help, this is the place to be.
Post Reply
User avatar
Slippy
Posts: 5
Joined: Sun Mar 25, 2007 10:21 pm
Location: Luton, Beds, UK
Contact:

Eventghost, toggling and Bluetooth

Post by Slippy »

Hi all...just discovered Eventghost, and am enjoying exploring it. There's a couple of things I'd like to do that I can't quite figure out. Total n00b to Python and quite a lot of stuff.

Anyway, first thing:
I have a virgin (formerly ntl:) set top box which uses an odd standard. The only way I can control it from my USB-UIRT is by storing two transmit codes for each button, and toggling between them. So, first press uses the first definition, second press uses the second definition.
Now, I think it should be possible to do this in EG, but I can't see how...the jumps seem quite limited. Is it possible to put something like this bit of pseudocode somewhere...

Code: Select all

   If button1.definition1.enabled = true then
      button1.definition1.triggerevent
      button1.definition1.enabled = false
      button1.definition2.enabled = true
   else
      button1.definition2.enabled = true (just in case it's not enabled)
      button1.definition2.triggerevent
      button1.definition2.enabled = false
      button1.definition1.enabled = true
   end if
Is something like that possible? Could someone hold my hand? :-D

-------------------------------------------------------------

And the second thing. I use a program called FMA (Float's mobile accessory) to provide a menu over bluetooth on my cellphone. FMA itself uses vbscript based scripting. Is there anyway I can trigger events in EG on the same computer from vbscripts in another prog? Or would I be better asking someone at the FMA forums?

At the moment I'm using the vbscript to load a web page (hosted by EG's webserver) which triggers an event in EG....but it loads a new page every time (using Shell.Run "http://127.0.0.1?event=something") I want to trigger an event.....very messy! :-)

Any help or advice would be hugely appreciated....this looks like just the program I've been looking for to use with my UIRT......

-------------------------------------------------------------

Edit: Actually, there's three things I need help with.....lol......does EventGhost run on Win98 PC's? I've got an old Win98 laptop that I want to use to centralise all my remote devices....but I can't seem to make EG run on it... :-(
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

1. There are many ways to accomplish this. I expect, that this toggeling is only needed, when the same code has to be sent again, so a global "toggle bit" for all codes is enough. Here is one way:

Put a PythonCommand in your autostart macro to define a variable. In Python all variables need to be written to, before you can read them:
PythonCommand: myToggleBit = False

Make a macro for the first USB-Send action and nothing more in it.

Make another macro (your actual entry point), where you evaluate the toggle bit, swap it and jump to the first macro on "True" or step forward if "False":

1. PythonCommand: myToggleBit = not myToggleBit
2. Jump: If successful to "Macro1", don't return
3. USB-UIRT: Send: [my second code]

Now you can trigger or jump-to this second macro and it will do the job.

2. Again there are more then one way to trigger an event from an external application:

a) Call EventGhost.exe with the "-e" parameter, through a "Shell" command or CreateProcess:
EventGhost.exe -e MyEventName

b) Use ActiveX/COM to do the same:

Code: Select all

Set EventGhost = CreateObject("EventGhost")
EventGhost.TriggerEvent("Hello from VB")
3. EventGhost runs on MS Windows 2000/XP/Vista or above (older OS versions are not supported).
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Slippy
Posts: 5
Joined: Sun Mar 25, 2007 10:21 pm
Location: Luton, Beds, UK
Contact:

Post by Slippy »

Thanks very much for the prompt response.

The info on calling via ActiveX was just what I needed....that bit works seamlessly now, so I can control EG over bluetooth from my Mobile phone. Perfect!

Toggling the Transmit commands is a different animal though.

I've tried it, and can't figure why it doesn't work....

The myToggleIR variable is set OK in autostart
Here's the contents of the folder containing my remote macros

Code: Select all

  Macro: "CHup1"
    USB-UIRT: "CH+ (1)"
  Macro: "CHup"
    PythonCmd: myToggleIR = not myToggleIR
    PythonCmd: print "Toggle set to", myToggleIR
    Jump: If successful "CHup1", no return
    USB-UIRT: "CH+ 2"
Here's the output from two executions of the macro...

Code: Select all

myToggleIR = not myToggleIR
print "Toggle set to", myToggleIR
Toggle set to False
If successful jump to "CHup1"
CHup2
myToggleIR = not myToggleIR
print "Toggle set to", myToggleIR
Toggle set to True
If successful jump to "CHup1"
CHup2
I'm stumped!
Last edited by Slippy on Mon Mar 26, 2007 5:00 pm, edited 1 time in total.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

"Jump" evaluates the result of the last command. Since you inserted a "print" statement, the Jump action looks for the result of the print statement. And "print" always returns "None" (that Jump considers as "False").
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Slippy
Posts: 5
Joined: Sun Mar 25, 2007 10:21 pm
Location: Luton, Beds, UK
Contact:

Post by Slippy »

My bad, I pasted the wrong clips in....I'd added the print statement after it didn't work the first time! Here's the output I meant to paste....

myToggleIR = not myToggleIR
If successful jump to "CHup1"
CHup2
myToggleIR = not myToggleIR
If successful jump to "CHup1"
CHup2
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Uhps, actually "myBit = not myBit" is not an evaluation (that would return something) but an expression (that never returns anything). Hence you have to insert another PythonCommand that simply states "myBit" before the Jump to get the result.

1. PythonCommand: myToggleBit = not myToggleBit
1. PythonCommand: myToggleBit
2. Jump: If successful to "Macro1", don't return
3. USB-UIRT: Send: [my second code]
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
User avatar
Slippy
Posts: 5
Joined: Sun Mar 25, 2007 10:21 pm
Location: Luton, Beds, UK
Contact:

Post by Slippy »

Beautiful....that works!

Calling a variable as a statement....no wonder I didn't spot it myself! LOL

Thanks very much for the help....in a couple of days I'll have a complete set of macros to control my set top box. Hurrah!
Post Reply