FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

Tutorial: A very simple script sample
Goto page Previous  1, 2, 3, 4, 5  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
Agrippa
Newbie


Joined: 26 Oct 2005
Posts: 5

PostPosted: Wed Nov 02, 2005 7:28 pm    Post subject: Help CTRL+ Reply with quote

The CTRL+ thing is not working.

[code:1]SendKeystroke( 0x41 | 0x200, false );
[/code:1]
Should I try...

[code:1]SendKeystroke( 0x241, false );[/code:1]

and what does the false do?
Back to top
View user's profile Send private message MSN Messenger
salling
Site Admin


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

PostPosted: Wed Nov 02, 2005 8:08 pm    Post subject: Reply with quote

Hi,

You don't want to use the "false thing" for this purpose. Please hold out for a beta of Clicker 3.0.1, that will have better commands for simulating keyboard actions.

I do not know why the existing stuff isn't working for you.

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


Joined: 16 Nov 2005
Posts: 9

PostPosted: Wed Nov 16, 2005 8:22 pm    Post subject: Reply with quote

what are all of the values that the cellphones can enter?

for instance I want to set up something in BSplayer so that when I hit the key "7" on my phone, it returns the keyvalue "S" (done by SendKeystroke( 0x73, true );)

but I cannot seem to get the code to work.
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
salling
Site Admin


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

PostPosted: Thu Feb 16, 2006 8:01 pm    Post subject: NOTE 3.0.1 CHANGE IN KEYBOARD SCRIPTING Reply with quote

The SendKeystroke() API is retired as of 3.0.1. Instead, please use these:


To send a "character", use:

SendUnicodeKeystroke( unicode value );


To simulate the pressing of a specific key:

SendVirtualKeystroke(
virtual keycode value,
shiftState,
ctrlState,
altState,
winState);

(the "state" parameters are booleans)

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


Joined: 25 Feb 2006
Posts: 27
Location: Vancouver, BC, Canada

PostPosted: Wed Mar 29, 2006 11:45 pm    Post subject: Reply with quote

Jonas, can I add this tutorial to aximsite's ebook section (ebooks.aximsite.com)? Of course your name will be there as the author of this tutorial. Let me know.
Back to top
View user's profile Send private message
salling
Site Admin


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

PostPosted: Thu Mar 30, 2006 12:45 pm    Post subject: Reply with quote

That'd be okay, but I would prefer to clean up the tutorial to use the new keystroke APIs first, however.

Best.
--
Jonas

[quote="akheron"]Jonas, can I add this tutorial to aximsite's ebook section (ebooks.aximsite.com)? Of course your name will be there as the author of this tutorial. Let me know.[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
akheron
Junior Member


Joined: 25 Feb 2006
Posts: 27
Location: Vancouver, BC, Canada

PostPosted: Thu Mar 30, 2006 12:48 pm    Post subject: Reply with quote

Cool! just lemme know when you have updated the tutorial, I'll update it on ebooks.aximsite.com as well.
Back to top
View user's profile Send private message
akheron
Junior Member


Joined: 25 Feb 2006
Posts: 27
Location: Vancouver, BC, Canada

PostPosted: Fri Mar 31, 2006 12:08 am    Post subject: Reply with quote

I've added the current version of the tutorial on Aximsite.

http://ebooks.aximsite.com/ebooks/?d=Tutorials&s=&r=
Back to top
View user's profile Send private message
SolusCado
Newbie


Joined: 02 Oct 2006
Posts: 9

PostPosted: Wed Feb 28, 2007 4:50 am    Post subject: Reply with quote

%&'(

Those are the characters that my phone spits out when pressing left, up, right, down on my phone (when using this sample). Does anyone have any idea why? I SUSPECT the problem is related to the fact that I am running Windows Vista, but could I just be missing something simple?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
salling
Site Admin


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

PostPosted: Wed Feb 28, 2007 11:02 am    Post subject: Reply with quote

That is not be the cause of the problem.

Please keep in mind that if the script is not correct (and you've typed it yourself), the results may differ from what you intended.

Best.
--
Jonas

[quote="SolusCado"]%&'(

Those are the characters that my phone spits out when pressing left, up, right, down on my phone (when using this sample). Does anyone have any idea why? I SUSPECT the problem is related to the fact that I am running Windows Vista, but could I just be missing something simple?[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
SolusCado
Newbie


Joined: 02 Oct 2006
Posts: 9

PostPosted: Wed Feb 28, 2007 12:08 pm    Post subject: Reply with quote

I made no changes to the script... This is what I am using:

var widget = CreateKeypadScreen( "mykeypad_" );
widget.title = "Keypad Sample";
widget.CreateRow( "Demo", scCenter, scClip, scLarge );
widget.CreateRow( "Use the d-pad", scCenter, scWrap, scMedium );
theTerminal.Push( widget );

function mykeypad_KeyDown(theScreen, theKey)
{
if( theKey == "s" ) {
// VK_MEDIA_PLAY_PAUSE
SendKeystroke( 0xB3, false );
} else if( theKey == "v" ) {
// VK_DOWN
SendKeystroke( 0x28, false );
} else if( theKey == "^" ) {
// VK_UP
SendKeystroke( 0x26, false );
} else if( theKey == "<" ) {
// VK_LEFT
SendKeystroke( 0x25, false );
} else if( theKey == ">" ) {
// VK_RIGHT
SendKeystroke( 0x27, false );
} else if( theKey == "u" ) {
// VK_VOLUME_UP
SendKeystroke( 0xAF, false );
} else if( theKey == "d" ) {
// VK_VOLUME_DOWN
SendKeystroke( 0xAE, false );
} else if( theKey == "c" ) {
// VK_VOLUME_MUTE
SendKeystroke( 0xAD, false );
}

// Keep the keypad active
return true;
}
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
salling
Site Admin


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

PostPosted: Wed Feb 28, 2007 12:33 pm    Post subject: Reply with quote

Okay. Please see the red and bold text in the first post of this thread. Perhaps that'll fix the problem for you?

EDIT: It will. Change your calls to:

SendVirtualKeystroke( 0xB3 ); (change the codes appropriately)

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


Joined: 02 Oct 2006
Posts: 9

PostPosted: Mon Mar 05, 2007 8:49 pm    Post subject: Reply with quote

THanks you (sorry I missed that earlier). Anyway, I'm really starting to get some progress here... I have modified it so that it launches Media Center on startup, and of course I can use the DPad to navigate within the app and to select items. It's all quite cool really. I'm going to keep working on smoothing it out - but thanks for such a great tool!
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
SolusCado
Newbie


Joined: 02 Oct 2006
Posts: 9

PostPosted: Mon Mar 05, 2007 9:15 pm    Post subject: Reply with quote

OK; speaking of smoothing it out... I am working on adding the 'multi-press keyboard' functionality of Media Center, wherein pressing the 2 key the first times spits out an A, pressing it a second time spits out a B, and so forth. I am trying to do so by storing a 'lastKeyPressed' variable and referencing it in my function, sending a different virtualkeycode accordingly. However, the variable doesn't seem to be saved between key presses. Should it be? If so, can you take a look at my code below and let me know what I'm doing wrong? And if it SHOULDN'T be storing my variable, is there another way to do this? (All that ever gets sent is the '2'...)

[code:1]
var widget = CreateKeypadScreen( "mykeypad_" );
widget.title = "Media Center";
widget.CreateRow( "Remote Control", scCenter, scClip, scLarge );
widget.CreateRow( "Use the d-pad", scCenter, scWrap, scMedium );
SendVirtualKeystroke( 0x0D, false, false, true, true );
theTerminal.Push( widget );
var lastKeyPressed = "";

function mykeypad_KeyDown(theScreen, theKey)
{
if( theKey == "s" ) {
// VK_MEDIA_PLAY_PAUSE
SendVirtualKeystroke( 0x0D, false );
} else if( theKey == "1" ) {
// Mute volume
SendVirtualKeystroke( 0x31, false );
} else if( theKey == "2" ) {
if( lastKeyPressed == "2" ) {
SendVirtualKeystroke( 0x41, false );
lastKeyPressed == "A";
} else if( lastKeyPressed == "A" ) {
SendVirtualKeystroke( 0x42, false );
lastKeyPressed == "B"
} else if( lastKeyPressed == "B" ) {
SendVirtualKeystroke( 0x43, false );
lastKeyPressed == "C"
} else {
SendVirtualKeystroke( 0x32, false );
lastKeyPressed == "2"
}
} else {
ShowMessage(theKey + ' is not currently supported');
}

// Keep the keypad active
return true;
}
[/code:1]
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
salling
Site Admin


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

PostPosted: Tue Mar 06, 2007 8:42 pm    Post subject: Reply with quote

Script variables are kept intact for as long as the widget is on the "widget stack", so that shouldn't be the problem with your script.

Having glanced through it, I cannot see the exact problem (except maybe you'll want to clear the lastKeyPressed when any other key than "2" is pressed). Also, there are some semi-colons missing, but JScript is often pretty cool with such syntactical errors.

Best.
--
Jonas

[quote="SolusCado"]OK; speaking of smoothing it out... I am working on adding the 'multi-press keyboard' functionality of Media Center, wherein pressing the 2 key the first times spits out an A, pressing it a second time spits out a B, and so forth. I am trying to do so by storing a 'lastKeyPressed' variable and referencing it in my function, sending a different virtualkeycode accordingly. However, the variable doesn't seem to be saved between key presses. Should it be? If so, can you take a look at my code below and let me know what I'm doing wrong? And if it SHOULDN'T be storing my variable, is there another way to do this? (All that ever gets sent is the '2'...)

[code:1]
var widget = CreateKeypadScreen( "mykeypad_" );
widget.title = "Media Center";
widget.CreateRow( "Remote Control", scCenter, scClip, scLarge );
widget.CreateRow( "Use the d-pad", scCenter, scWrap, scMedium );
SendVirtualKeystroke( 0x0D, false, false, true, true );
theTerminal.Push( widget );
var lastKeyPressed = "";

function mykeypad_KeyDown(theScreen, theKey)
{
if( theKey == "s" ) {
// VK_MEDIA_PLAY_PAUSE
SendVirtualKeystroke( 0x0D, false );
} else if( theKey == "1" ) {
// Mute volume
SendVirtualKeystroke( 0x31, false );
} else if( theKey == "2" ) {
if( lastKeyPressed == "2" ) {
SendVirtualKeystroke( 0x41, false );
lastKeyPressed == "A";
} else if( lastKeyPressed == "A" ) {
SendVirtualKeystroke( 0x42, false );
lastKeyPressed == "B"
} else if( lastKeyPressed == "B" ) {
SendVirtualKeystroke( 0x43, false );
lastKeyPressed == "C"
} else {
SendVirtualKeystroke( 0x32, false );
lastKeyPressed == "2"
}
} else {
ShowMessage(theKey + ' is not currently supported');
}

// Keep the keypad active
return true;
}
[/code:1][/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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 Previous  1, 2, 3, 4, 5  Next
Page 4 of 5

 
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