View unanswered posts | View active topics It is currently Wed May 22, 2013 5:06 am



Reply to topic  [ 8 posts ] 
 iRed script samples 
Author Message

Joined: Aug 13, 2006
Posts: 390
Location: Northern Idaho
Post iRed script samples
Can someone please cut and paste some applescript samples for iRed to the forum?

I can't understand how to use the commands in iRed to fire the various remotes I created. I looked around the net and ca't find use of the commands in an scripts. I looked at the iRed applescript dictionary and created a script that would run but it di not send any IR commands via the IRTrans I am using.

I'd post this on the iRed forums, but I haven't been accepted as a user since I applied a few weeks ago, and I figure, other people here could probably use the same tutelage.

Thanks in advance,

Matt


Sat May 10, 2008 10:28 am
Profile

Joined: Dec 26, 2007
Posts: 486
Location: British Columbia
Post 
Here are a couple of embedded scripts used in trigger actions:
Code: Select all
try
    tell application "iRed" to send ir Code "Power" of RC "Sony TV"
end try

Code: Select all
try
    tell application "iRed" to send ir Code "VolumeDN" of RC "Sony TV"
end try


iRed runs on the same computer as Indigo with remote loaded that has "Sony TV" defined.
The iTrans is in my office, where the Sony TV is.

I also run iRed on my desktop and work the TV via the Virtual Remote directly.

Volume up/down I tied to a keyfob, just as a test.
The Power off is used in a Time/Date action.

HTH - Heinz


Sat May 10, 2008 9:37 pm
Profile WWW

Joined: Aug 13, 2006
Posts: 390
Location: Northern Idaho
Post 
Thanks a lot Heinz.

I figured it out.

I was writing scripts that referenced the virtual remotes I had created and not the remotes listed in the inspector window.

Now all I have to do is make some hot keys to set up the various components of my entertainment center for the different configurations and I am all set. :)


Sun May 11, 2008 6:45 am
Profile

Joined: Sep 24, 2005
Posts: 502
Post 
here's my handler (run as an attachment):


Code: Select all
using terms from application "IndigoServer"
   
   on RemoteControl(Remote, irCode)
      with timeout of 3 seconds
         try
            
            tell application "iRed" to send ir Code irCode of RC Remote
         on error
            tell application "IndigoServer"
               log "error" using type "iRed:"
            end tell
            
         end try
      end timeout
   end RemoteControl
   
end using terms from



and i call it in triggers or actions scripts or whatever, with something like this:

Code: Select all
RemoteControl("lexicon/mc8", "mute/zone 2")


fwiw.


Mon May 12, 2008 2:16 pm
Profile
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
I'm having a similar solution as dtich is using. So much easier to use in all your other code and it reduces the chance of errors.

_________________
"I tawt I taw a puddy tat!" Tweety


Mon May 12, 2008 10:12 pm
Profile WWW

Joined: Oct 28, 2006
Posts: 20
Post 
Has anyone modified this attachment script for iRed2?


Tue Jul 29, 2008 7:42 am
Profile WWW
User avatar

Joined: Dec 29, 2005
Posts: 585
Location: Third byte on the right
Post 
I've tested a bit with the latest beta.
On the iRed site are hints for changes in the AppleScript portion of iRed2.

My old iRed attachment script looks like this:
Code: Select all
using terms from application "IndigoServer"
   
   on iRedCommand(command, remote)
      tell application "iRed"
         send ir Code command of RC remote
      end tell
   end iRedCommand
   
end using terms from


The new script uses the perform path syntax which needs the make of the remote as part of the path. Luckily for me, all remotes have the same make, so I entered a constant value in my script.
If that doesn't apply for you, you'll have to add a third parameter to the script and included it's value in the path.
And you'll have to change all your AppleScript code in Indigo that uses the iRedCommand function.
Code: Select all
using terms from application "IndigoServer"
   
   on iRedCommand(command, remote)
      tell application "iRed2"
         perform path "IR Code/<constant>/" & remote & "/" & command
      end tell
   end iRedCommand
   
end using terms from

_________________
"I tawt I taw a puddy tat!" Tweety


Tue Jul 29, 2008 10:11 am
Profile WWW

Joined: Mar 31, 2008
Posts: 738
Post Re: iRed script samples
Are you all still following this basic structure for iRed2 with Snow Leopard? I just purchased an IRTrans and the iRed s/w and would like to get started. For instance, I'd like to send the Sony XDR-F1HD tuner "power" and "preset 2" and "enter", while updating the Indigo variable "radio_preset" to "2".

What would be the proper way to do that? Is it better to load a standard attachment script and then do calls through embedded scripts?

Also, dtich, I have an MC8 as well, and may wish to control it with IRTrans down the road. Could you share your scripts?


Fri Aug 27, 2010 8:13 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.