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
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 9:53 am    Post subject: Reply with quote

I'm not sure how to use the diagnostic method you mentioned. And what is this raw mode you mentioned?

Where do I place the code you gave me before? Do I create a new script or is that somehow implimented within the code of the keypad script? I'm so lost lol!

Thanks for all your help!


Last edited by Apollo on Thu Oct 20, 2005 10:35 am; edited 1 time in total
Back to top
View user's profile Send private message
Apollo
Junior Member


Joined: 18 Oct 2005
Posts: 43

PostPosted: Thu Oct 20, 2005 9:54 am    Post subject: Reply with quote

I wait...I missed a post of yours, sorry lol! It said to stick a snippet of code in the key handler...let me try that and I'll get back ;)
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:40 am    Post subject: Reply with quote

Oh my god I'm a moron...

I had presentation mode selected from the tray icon...apparently that turns off screen prompts...grr!!! It works now...thanks!
Back to top
View user's profile Send private message
roychang
Newbie


Joined: 15 Oct 2005
Posts: 16

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

[quote="salling"]Longer-term, I really think you should also look into using COM/ActiveScripting. Search google for "scripting" and "WMP8".

Best.
--
Jonas[/quote]

Is there any particular site to recommend for COM/ActiveScripting? I would like to 'talk' to an application such as BSplayer in a similar way you did for the WMP script. I notice you used a custom DLL to interact with WMP instead of using ActiveXobjects like the iTunes and Powerpoint scripts. Where should I start?
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 4:15 pm    Post subject: Reply with quote

Unfortunately, this is not quite as easy as it is on the Mac side, where one can simply drag the application icon to "Script Editor", to see if it's scriptable and what the object model looks like.

So, you're going to have to determine on a case-by-case basis whether an application is scriptable. Google is usually of help here.

If it is scriptable, great. If not, there are alternatives for getting things done. Two such alternatives come to mind:

- Keyboard events (drawback: only input)

- HTTP requests driven by your script, in case the application has a small HTTP server for such purposes.

I ran some google searches on BSPlayer, and nothing interesting came up with respect to scripting. The final test would be to try and open the executable for BSPlayer, or one of its DLLs in "oleview" to see if there's a "typelibrary" in there (typelibraries define scriptability in applications).

Probably not what you wanted to hear. Some applications are simply better suited for integration than others. In some cases it may be possible to write up a scripable "helper" to control an unscriptable application.

The reason for WMP being instantiated through such a helper is due to the er, lacking support for hooking up to a running instance of WMP through the normal ActiveXObject creation methods.

I hope was useful at least as some sort of explanation. :-)

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


Joined: 15 Oct 2005
Posts: 16

PostPosted: Thu Oct 20, 2005 4:33 pm    Post subject: Reply with quote

Thanks for the thorough explaination. :)

One big question: What exactly would you need in order to create a Helper DLL to control an application?

I have tried throwing BSplayer into oleview without success so I assume it does not support scripting. There is however an SDK API with C and delphi codes to control it so I thought writing a Helper like the one for WMP would suffice. This is a sample of the code

[code:1]////////////////////////////////////////////////////////////////////
// BSPlayer API v 1.1
//
// To get BSPlayer window handle use:
// bsp_hand=FindWindow("BSPlayer",NULL);
//
// then you can send messages, for ex. to get current version:
// bsp_ver = SendMessage(bsp_hand,WM_BSP_CMD,BSP_GETVERSION,0);
////////////////////////////////////////////////////////////////////
#ifndef _BSP_H
#define _BSP_H


#define WM_BSP_CMD WM_USER+2


// bsp_ver = SendMessage(bsp_hand,WM_BSP_CMD,BSP_GETVERSION,0);
// available in BSPlayer version 0.84.484+
//
// Return player version
// format will be XX.YY.ZZZZ -> 0xXXYYZZZZ
// for 0.84.484 -> 0x00840484
#define BSP_GETVERSION 0x10000[/code:1]

I am not very familiar with making a Helper or plugin but some tips on it would be helpful.
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 4:42 pm    Post subject: Reply with quote

I see. An easier option might be for me to add a scripting command to send window messages from scripts, like their SDK suggest you can do.

Would this be cool?

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


Joined: 15 Oct 2005
Posts: 16

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

[quote="salling"]I see. An easier option might be for me to add a scripting command to send window messages from scripts, like their SDK suggest you can do.

Would this be cool?

Best.
--
Jonas[/quote]

Cool! :D Opens up a lot more possibilities.
Back to top
View user's profile Send private message
teetow
Senior Member


Joined: 11 Oct 2005
Posts: 72
Location: Uppsala, Sweden

PostPosted: Thu Oct 20, 2005 10:13 pm    Post subject: Reply with quote

[quote="salling"]I see. An easier option might be for me to add a scripting command to send window messages from scripts, like their SDK suggest you can do.

Would this be cool?

Best.
--
Jonas[/quote]Damn, I wish I was smarter =) As you might have gathered, I'm right on roychang's path here - except that my target application is Media Player Classic. While discussing my options with my C++ and Win32 gurus, they did mention this approach (window messages). I think I might benefit from this functionality aswell - even though the web interface approach might work better for MPC specifically.

Basically, the more options we have, the more applications become accessible to Clicker scripting. World dominance ensues.
Back to top
View user's profile Send private message
Agrippa
Newbie


Joined: 26 Oct 2005
Posts: 5

PostPosted: Wed Oct 26, 2005 6:41 am    Post subject: SendKeyStroke Reply with quote

I am SOOO close, but I can not get the KeyStroke thing to work. I have looked everywhere for reference on syntax on the KeyStroke command but no one has heard of it.

It works fine with single Virtual-Key codes, but how do I use it with CTRL+ modifiers? Also what does the second item represent (false).

SendKeyStroke( 0x41, false); What does false do?

I am making a remote for Microsoft Streets & Trips. It works fine for every key command (including F3), but CTRL+ commands have me stumped!

Also is it a jscript command, a vbscript command? Can I use VBscript on my T610 - don't think so.

There must be a CTRL+ key down command I am missing.

- Agrippa
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 Oct 26, 2005 8:21 am    Post subject: Reply with quote

Hi Agrippa,

Please try:

[code:1]
SendKeyStroke( 0x41 | 0x200, false );
[/code:1]

The 2nd parameter controls whether the 1st parameter should be interpreter as a unicode character or as a virtual keycode (with modifier mask; 0x100, 0x200, or 0x400).

I'm improving the keystroke APIs a bit, but you should be able to get by with the above.

These commands are exposed to the script by Salling Clicker. The scripts don't run on your phone.

Sorry for the somewhat short response; just woke up here. Need coffee. ;-)

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


Joined: 26 Oct 2005
Posts: 11
Location: Utrecht, the Netherlands

PostPosted: Thu Oct 27, 2005 9:55 pm    Post subject: Reply with quote

ok I'm, a bit puzzled by that last reply... for my flash presentation thing im making I need the CTR+KEY as well so if I get it right:

CTRL + ENTER would be:
[code:1]
SendKeyStroke( 0x11 | 0x0D, false );
//11 = control and 0D = enter
[/code:1]

???
Back to top
View user's profile Send private message
Agrippa
Newbie


Joined: 26 Oct 2005
Posts: 5

PostPosted: Sat Oct 29, 2005 9:07 am    Post subject: Reply with quote

Well... that didn't work...
[code:1] A CTRL
SendKeystroke( 0x41, 0x200, false );[/code:1]
I assume that 0x100=SHIFT, 0x200=CTRL, 0x400=ALT. Please check that. I am trying to get a CTRL+VK_A. I will also need a CTRL+VK_LBUTTON, and others.

In the mean time I will use multiple lines to activate items from the Menu Bar. This is slower, and means I'll see the menus briefly as they activate. Not too bad on a fast system.
[code:1]if( theKey == "7" ) {
// VK_MENU
SendKeystroke( 0x79, false ); // F10 Activate Menu Bar
SendKeystroke( 0x54, false ); // T for Tools Menu
SendKeystroke( 0x50, false ); // U for GPS Panel
ShowMessage("GPS Pane");[/code:1]
I am using the following code to test your CTRL+A code, without success.
[code:1]if( theKey == "5" ) {
// Phone Keys
SendKeystroke( 0x41 | 0x200, false );
ShowMessage(theKey);[/code:1]
I Would be content with activating the menus, but another program absolutely needs CTRL+VK_LBUTTON.

Perhaps there is a SendKeyboardEvent command that would work better.
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: Sat Oct 29, 2005 2:10 pm    Post subject: Reply with quote

Hi,

A misunderstanding. You need to OR the keycode with the modifier, like so:

SendKeystroke( 0x41 | 0x200, false );

The modifier values are as follows:

0x100 = shift
0x200 = ctrl
0x400 = alt

CTRL + VK_LBUTTON may work like so (not tested, though):

SendKeystroke( 0x01 | 0x200, false );

I'm adding easier to use scripting commands in 3.0.1.

I hope this helped.

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


Joined: 26 Oct 2005
Posts: 5

PostPosted: Sun Oct 30, 2005 11:58 am    Post subject: Reply with quote

Nope. My bad - a typo. I did use the | thingy. It still didn't work.
[code:1]SendKeystroke( 0x41 | 0x200, false ); [/code:1]
I tested it with the notepad. CTRL+O starts the Open File menu.
[code:1]var widget = CreateKeypadScreen( "myKeypad_" );
widget.title = "CTRL Testing";
widget.CreateRow("CTRL Testing", scCenter, scWrap, scSmall);
theTerminal.Push(widget);
function myKeypad_KeyDown(theScreen, theKey)
{
if( theKey == "5" ) {
// VK_O
SendKeystroke( 0x4F | 0x200, false );
ShowMessage(theKey);
} else {
// Key Message
ShowMessage(theKey);
}
return true;
}[/code:1]
By the way I am using a SonyEricsson T610.
Back to top
View user's profile Send private message MSN Messenger
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 3 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