FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

distantDVD remote needed Please help

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
mac_monkey
Newbie


Joined: 04 May 2006
Posts: 3

PostPosted: Thu May 04, 2006 1:49 pm    Post subject: distantDVD remote needed Please help Reply with quote

Ive come across this little Video_TS/AVI launcher app that works like Front Rows movie trailer section. Its great and I've been looking for something that can launch networked VIDEO_TS folders for ages.

[url=http://software.visualunderground.co.uk]distantDVD[/url]

The problem is it uses the keyboard and I dont have a wireless one. Is it possible to make a script to emulate keyboard keypresses? It's keys are very basic (arrowkeys, space and p)? I'm no scripter so any help would be most welcome. Also would it be possible to launch the app from clicker?

Thanks in advance

monkeh
Back to top
View user's profile Send private message
Mytzlscript
Newbie


Joined: 29 Mar 2006
Posts: 9
Location: St. Paul, MN

PostPosted: Thu May 04, 2006 4:25 pm    Post subject: Reply with quote

Add the following handler to your script.

[quote]
[color=blue][b]on[/b][/color] [color=green]kstroke[/color]([color=green]aKey[/color], [color=green]aMod[/color])
     [color=blue][b]tell[/b][/color] [color=blue]application[/color] "System Events"
          [color=blue][b]if[/b][/color] [color=green]aMod[/color] [color=blue][b]is not[/b][/color] [color=blue][b]equal to[/b][/color] {} [color=blue][b]then[/b][/color]
               [color=blue]keystroke[/color] [color=green]aKey[/color] [color=blue]using[/color] [color=green]aMod[/color]
          [color=blue][b]else[/b][/color]
               [color=blue]keystroke[/color] [color=green]aKey[/color]
          [color=blue][b]end[/b][/color] [color=blue][b]if[/b][/color]
     [color=blue][b]end[/b][/color] [color=blue][b]tell[/b][/color]
[color=blue][b]end[/b][/color] [color=green]kstroke[/color]
[/quote]


Then, any time you want to simulate a keystroke, you need only add a command like one of these:

[quote]--[color=olive] right arrow ( ASCII character 29 )[/color]
--[color=olive] left arrow ( ASCII character 28 )[/color]
--[color=olive] down arrow ( ASCII character 31 )[/color]
--[color=olive] up arrow ( ASCII character 30 )[/color]

--[color=olive]simulate down arrow keystroke[/color]
[color=blue][b]my[/b][/color] [color=green]kstroke[/color]([color=blue]ASCII character[/color] 31, {})

--[color=olive]simulate keystroke without modifier[/color]
[color=blue][b]my[/b][/color] [color=green]kstroke[/color]("a", {})

--[color=olive]simulate keystroke with modifier (typical "select all" cmd)[/color]
[color=blue][b]my[/b][/color] [color=green]kstroke[/color]("a", [color=blue]command down[/color])

--[color=olive]simulate space bar[/color]
[color=blue][b]my[/b][/color] [color=green]kstroke[/color]([color=blue]space[/color], {})
[/quote]

Hope this helps.

------------------------
[This script was automatically tagged for color coded syntax by [url=http://homepage.mac.com/jonn8/as/]Convert Script to Markup Code[/url]]
Back to top
View user's profile Send private message Visit poster's website AIM Address
mac_monkey
Newbie


Joined: 04 May 2006
Posts: 3

PostPosted: Thu May 04, 2006 5:51 pm    Post subject: Reply with quote

Thanks for your quick reply, but I am afraid I dont really understand :(

Are you suposed to put some "doing script" in the curley braces? Or will it just work?

Does;

aKey = the pressed key in ascii &
aMod = a command type key?

All i want is a distantDVD menu on clicker, with
"start distantDVD", "Left", "right", "up", "down" and "play" options using arrows and space bar?

I know that this would be really easy for someone in the know :idea:
Back to top
View user's profile Send private message
Mytzlscript
Newbie


Joined: 29 Mar 2006
Posts: 9
Location: St. Paul, MN

PostPosted: Thu May 04, 2006 6:45 pm    Post subject: Reply with quote

Oops, sorry monkey. I figured you had the bulk of the script written and just needed the keystroke logic. You need just a bit more than what I supplied.

Yes, you are correct about the aKey and aMod parameters. The {} is a place to stick your keystroke modifiers when you call the handler. Modifiers (command down) or (command down & shift down).

Here's another script. I didn't have distantDVD so I used TextEdit to verify this works. You'll need to edit the script and change TextEdit to distantDvd - or whatever that app's actual name is.

Open Salling's prefs and create a new script - doesn't matter what type - you are going to replace the contents with what is below.

Let me know how it works.

[quote]

--[color=olive]this list matches the options list we'll present to the device[/color]
--[color=olive]if you want to add options later - be sure to also add the option in the process invoke handler[/color]
[color=blue][b]property[/b][/color] [color=green]lisChoices[/color] : {"on", ( [color=blue]ASCII character[/color] 28 ), ([color=blue]ASCII character[/color] 29), ([color=blue]ASCII character[/color] 30), ([color=blue]ASCII character[/color] 31), [color=blue]space[/color]}

[color=blue][b]using terms from[/b][/color] [color=blue]application[/color] "SEC Helper"
     
     [color=blue][b]on[/b][/color] [color=blue]process invoke[/color] [color=green]a_terminal[/color]
          [color=blue][b]tell[/b][/color] [color=green]a_terminal[/color]
               [color=blue][b]set[/b][/color] [color=green]w[/color] [color=blue][b]to[/b][/color] [color=blue]make[/color] [color=blue]new[/color] [color=blue]option list dialog[/color] [color=blue]with properties[/color] {[color=blue]title[/color]:"distantDVD Control"}
               [color=blue][b]set[/b][/color] [color=blue]item labels[/color] [color=blue][b]of[/b][/color] [color=green]w[/color] [color=blue][b]to[/b][/color] {"distantDVD On", "Left", "Right", "Up", "Down", "Space"}
               [color=blue][b]set[/b][/color] [color=blue]value[/color] [color=blue][b]of[/b][/color] [color=green]w[/color] [color=blue][b]to[/b][/color] 1
               [color=blue]push[/color] [color=green]w[/color]
          [color=blue][b]end[/b][/color] [color=blue][b]tell[/b][/color]
     [color=blue][b]end[/b][/color] [color=blue]process invoke[/color]
     
     [color=blue][b]on[/b][/color] [color=blue]process dialog ok[/color] [color=green]the_dialog[/color]
          [color=blue][b]set[/b][/color] [color=green]intChoice[/color] [color=blue][b]to[/b][/color] [color=blue][b]the[/b][/color] [color=blue]value[/color] [color=blue][b]of[/b][/color] [color=green]the_dialog[/color] [color=blue][b]as[/b][/color] [color=blue]string[/color]
          [color=blue][b]if[/b][/color] [color=green]intChoice[/color] > 1 [color=blue][b]then[/b][/color]
               (*
[color=olive]          I left the modifier option in here just in case you find[/color]
[color=olive]          some keyboard commands with modifiers you want to add later[/color]
[color=olive]          [/color]*)
               [color=blue][b]my[/b][/color] [color=green]bossDVD[/color]([color=green]intChoice[/color], {})
          [color=blue][b]else[/b][/color]
               --[color=olive]check to see if distantDVD is running, if not - make it so[/color]
               [color=blue][b]my[/b][/color] [color=green]initDVD[/color]()
          [color=blue][b]end[/b][/color] [color=blue][b]if[/b][/color]
     [color=blue][b]end[/b][/color] [color=blue]process dialog ok[/color]
     
     [color=blue][b]on[/b][/color] [color=blue]process dialog cancel[/color] [color=green]the_dialog[/color]
          [color=blue]show screen[/color] [color=blue]message[/color] "cancelled"
     [color=blue][b]end[/b][/color] [color=blue]process dialog cancel[/color]
     
[color=blue][b]end[/b][/color] [color=blue][b]using terms from[/b][/color]


--[color=olive]run when distantDVD is not in the current process list[/color]
[color=blue][b]on[/b][/color] [color=green]initDVD[/color]()
     [color=blue][b]tell[/b][/color] [color=blue]application[/color] "Finder" [color=blue][b]to[/b][/color] [color=blue][b]set[/b][/color] [color=green]lisProc[/color] [color=blue][b]to[/b][/color] [color=blue][b]get[/b][/color] [color=blue][b]the[/b][/color] [color=blue]name[/color] [color=blue][b]of[/b][/color] [color=blue][b]every[/b][/color] [color=blue]process[/color]
     [color=blue][b]if[/b][/color] [color=green]lisProc[/color] [color=blue][b]does not[/b][/color] [color=blue][b]contain[/b][/color] "TextEdit" [color=blue][b]then[/b][/color]
          [color=blue][b]tell[/b][/color] [color=blue]application[/color] "TextEdit" [color=blue][b]to[/b][/color] [color=blue]activate[/color]
     [color=blue][b]end[/b][/color] [color=blue][b]if[/b][/color]
[color=blue][b]end[/b][/color] [color=green]initDVD[/color]

--[color=olive]run every time an option (other than launch app) is chosen[/color]
[color=blue][b]on[/b][/color] [color=green]bossDVD[/color]([color=green]aKey[/color], [color=green]aMod[/color])
     [color=blue][b]tell[/b][/color] [color=blue]application[/color] "TextEdit"
          [color=blue]activate[/color]
          [color=blue][b]tell[/b][/color] [color=blue]application[/color] "System Events"
               [color=blue][b]if[/b][/color] [color=green]aMod[/color] [color=blue][b]is not[/b][/color] [color=blue][b]equal to[/b][/color] {} [color=blue][b]then[/b][/color]
                    [color=blue]keystroke[/color] [color=green]aKey[/color] [color=blue]using[/color] [color=green]aMod[/color]
               [color=blue][b]else[/b][/color]
                    [color=blue]keystroke[/color] ([color=blue]item[/color] [color=green]aKey[/color] [color=blue][b]of[/b][/color] [color=green]lisChoices[/color])
               [color=blue][b]end[/b][/color] [color=blue][b]if[/b][/color]
          [color=blue][b]end[/b][/color] [color=blue][b]tell[/b][/color]
     [color=blue][b]end[/b][/color] [color=blue][b]tell[/b][/color]
[color=blue][b]end[/b][/color] [color=green]bossDVD[/color][/quote]

-------------------------
[This script was automatically tagged for color coded syntax by [url=http://homepage.mac.com/jonn8/as/]Convert Script to Markup Code[/url]]
Back to top
View user's profile Send private message Visit poster's website AIM Address
mac_monkey
Newbie


Joined: 04 May 2006
Posts: 3

PostPosted: Fri May 05, 2006 9:53 am    Post subject: Reply with quote

You rock :D

Hopefully I'll get a chance to try it out this weekend, I'll let you know how it goes.
Back to top
View user's profile Send private message
dbeacock
Newbie


Joined: 03 Aug 2006
Posts: 1
Location: London

PostPosted: Thu Aug 03, 2006 1:50 pm    Post subject: Reply with quote

Does anyone know if this script was successful? I've got distantDVD as well, which is great, but would love to control it using Clicker.

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group