FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

How to link scripts together?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Windows
View previous topic :: View next topic  
Author Message
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 10:53 am    Post subject: How to link scripts together? Reply with quote

How do you script one script so that when I press a hard key it will open another script? Then how do I link the new script back to the one that opened it previously? (This can be dynamic or scripted to a specific target...doesn't matter to me. Future scripts may need a feature like this to be dynamic...or perhaps you have a better method for this.)
Back to top
View user's profile Send private message
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 10:59 am    Post subject: Reply with quote

I want to add to my media center script so when I press a hard key another list of options will come up with mute, volume controls etc. but I also want to remap the d-pad so that up/down is volume and left will take you back to the previous script...is this possible?
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 20, 2005 11:10 am    Post subject: Reply with quote

You can see examples of this in the iTunes/WMP/PPT controllers. In each of these scripts, when the user selects an item from the "More" menu, a 2nd script is invoked to implement the functionality of, say, "Browse by Artist".

When the invoked script has dismissed all widgets it's pushed to the display, the original script resumes control (assuming it's got any widgets left on the "widget stack").

Please have a look at the existing scripts.

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 11:10 am    Post subject: Reply with quote

Hmm...another question.

Everything about the Media Player script works with Media Center except that there is no navigation features. Is it possible to to simply link my Navigation script into the Media Player script? The media player script is very complex but from what I can tell if I add the UUID keys to the right places in the script and add another menuitem to the more menu that it might work.

How do I add visual buttons to the palm screen so I might be able to make a big round circle that with a simple tap will switch between the navigation script and the media player script. Is that hard to do?
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 20, 2005 11:14 am    Post subject: Reply with quote

Tappable areas are not supported. Please remember that scripts are supposed to work on a wide range of devices, most of which do not have tappable screens.

If I had a clearer idea of what you're trying to accomplish, I can probably give you better advice. ;-)

Best.
--
Jonas

PS. Still working on getting my own MCE set up here so I know what you're talking about.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 11:24 am    Post subject: Reply with quote

Ok... here's what I want to do:

I want to bind a hard key (F on my T5) so it will take me directly to the MediaPlayer script that you wrote. I have already managed to make the MediaPlayer script have an extra menu item in the 'more menu' list so when I'm in media player I can go to the more list and open my Media Center Remote script, but I want to link it back now without adding a 'more' menu to my script. I just want to link a hard key to the media player script.
Back to top
View user's profile Send private message
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 11:33 am    Post subject: Reply with quote

hah I got it!! I'm so proud! Things are going very smoothly with my script now, especially now that I'm getting more comfortable with it. Tell me if this looks right:

[code:1]
else if( theKey == "f" ) {
//Back to Media Player
theTerminal.PopTo("Windows Media Player");
}
[/code:1]

this is under the line:

[code:1]
function MyRemote_KeyDown(theScreen, theKey)
[/code:1]
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 20, 2005 12:01 pm    Post subject: Reply with quote

This looks decent. As long as the "Windows Media Player" widget is below the current widget on the widget stack, it'll pop back to it. From what you've done, it sounds like this'll be the case.

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 12:45 pm    Post subject: Reply with quote

going great now...thanks!
Back to top
View user's profile Send private message
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 1:41 pm    Post subject: Reply with quote

Ok can I link directly to a script? It won't have been loaded before and won't really be a widget so I can't do it how I wanted to before. I need to directly link the button to the js file (both scripts are in the same directory with different file names and xml files)

Can I do this?
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 20, 2005 1:59 pm    Post subject: Reply with quote

You can only have one XML file per package. If you want to break out code in another js file for some reason, perhaps your scripting language has support for this. I don't think jscript does, though.

I'm not sure I'm following what you're trying to do with the breakups here...

Cheers.
Jonas

[quote="Apollo"]Ok can I link directly to a script? It won't have been loaded before and won't really be a widget so I can't do it how I wanted to before. I need to directly link the button to the js file (both scripts are in the same directory with different file names and xml files)

Can I do this?[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 2:14 pm    Post subject: Reply with quote

Ok here's the code I have:

function MyRemote_KeyDown(theScreen, theKey)
[code:1]
{
else if( theKey == "f" ) {
//Back to Media Player
theTerminal.PopTo("Windows Media Player");
}
[/code:1]

I want to change where it says 'Windows Media Player' so that it links to my 'Media Center Music Mode' script. How do I code a palm button to link to that file. The music mode file has not been run prior to this script either if that matters.

Basically I'm creating two identical scripts function-wise, and then using a palm button to intermitantly switch between the two of them. The purpose of this is both scripts have very similar functions but the layout of the hard keys gets swapped between media functions and navigation functions for media center. I am just stuck with getting the two scripts to swap on command.
Back to top
View user's profile Send private message
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 2:55 pm    Post subject: Reply with quote

Ok here's an idea of what I mean...

I don't want them to do this: (lines signify how deep the links are in levels)
[code:1]
Media Center------->Media Center Music Layout
^-------------<--------------------<--
[/code:1]

(It's a loop...I don't want that.)

Here's what I want:
[code:1]
Media Center
v ^
| |
| |
| |
| |
v ^
Media Center Music Layout
[/code:1]

I want both scripts to be able to open one another without just linking one to the other. I want to be able to swap between the two scripts at the press of a button.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Oct 20, 2005 2:59 pm    Post subject: Reply with quote

Hokay.

You do not need to make them into two different scripts. One script can drive any number of widgets, and I think in this case, that's the better solution.

If you really want to have two scripts, each implementing a keypad widget, here's what you can do:

1. Make sure they have different UUIDs
2. Don't use PopTo(). Use ExecuteScript(UUID).
3. Important: return false from the key handler method, after calling ExecuteScript().

#3 will dismiss the current widget before the new one is pushed, so you don't end up with an endlessly nested mess of widgets.

I think for what you're doing PopTo() is not the way. In fact, I'd skip ExecuteScript() too, and instead have a solution where one script controls two widgets.

Give that a shot, and ping back if you need help.

Cheers.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 3:12 pm    Post subject: Reply with quote

I can understand how doing both scripts as widgets would be smarter and I agree, but I have used alot of code from your Media Player script and I am being quite careful not to break anything as it is (Which is alot harder to prevent than I thought lol) and I wouldn't understand how to combine the two so the push of the new widget is stopped. Maybe when I'm done with them separately then I can give it a shot but you've been very helpful and I will work with what you have shared. Thank you!

~*Apollo*~

BTW I shot you an e-mail, dunno how often you check them though so I thought I've give you a heads up! ;)
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 Windows All times are GMT + 2 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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 can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group