What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Scripting API Wishlist

Pages: (15): « First « 9 10 11 12 [ 13 ] 14 15 » Last »
Scripting API Wishlist
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: Scripting API Wishlist
A method of halting script execution by X milliseconds.  For example:
Javascript code:
function Two()
{
    PartOne();
    MsgPlus.Pause(500);    PartTwo();
}

...could be used instead of...
Javascript code:
function Two()
{
    PartOne();
    MsgPlus.AddTimer("Two", 500);
}
 
function OnEvent_Timer(TimerId)
{
    if (TimerId === "Two")
    {
        PartTwo();
    }
}


This post was edited on 03-06-2010 at 12:49 PM by whiz.
03-06-2010 12:46 PM
Profile E-Mail PM Find Quote Report
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
RE: Scripting API Wishlist
quote:
Originally posted by whiz
JScript code:
    MsgPlus.Pause(500);


Maybe you can use Interop.Call to call the function Sleep :)

This post was edited on 03-06-2010 at 01:02 PM by Choli.
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
03-06-2010 01:01 PM
Profile PM Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Scripting API Wishlist
quote:
Originally posted by Choli
quote:
Originally posted by whiz
JScript code:
    MsgPlus.Pause(500);


Maybe you can use Interop.Call to call the function Sleep :)
Yeah, but that would freeze the msnmsgr process as well.
03-06-2010 01:15 PM
Profile E-Mail PM Web Find Quote Report
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
RE: Scripting API Wishlist
quote:
Originally posted by Felu
Yeah, but that would freeze the msnmsgr process as well
Aren't scripts executed in other thread than messenger's?
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
03-06-2010 02:29 PM
Profile PM Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Scripting API Wishlist
quote:
Originally posted by Choli
quote:
Originally posted by Felu
Yeah, but that would freeze the msnmsgr process as well
Aren't scripts executed in other thread than messenger's?
Actually no. In fact, it is stated in the scripting documents that:
quote:
From the scripting documentation
Note: every function and properties of every object listed here is intended to be called from the main thread of the application. Functions and properties will fail or may create unexpected bugs if called from a different thread.

This post was edited on 03-06-2010 at 02:44 PM by Mnjul.
03-06-2010 02:44 PM
Profile PM Web Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Scripting API Wishlist
quote:
Originally posted by Choli
quote:
Originally posted by Felu
Yeah, but that would freeze the msnmsgr process as well
Aren't scripts executed in other thread than messenger's?
No. They're executed in the same thread as Messenger Plus! which hooks itself up to the messenger process.

Edit: Damn you Mnjul. Beaten to it :(.

This post was edited on 03-06-2010 at 02:49 PM by Felu.
03-06-2010 02:48 PM
Profile E-Mail PM Web Find Quote Report
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
42 / Male / Flag
Joined: Jan 2003
RE: Scripting API Wishlist
Then I see quite complex to pause the execution of a script without freezing or interfering with the messenger process.
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
03-06-2010 04:04 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Scripting API Wishlist
Having a sleep() function seems like a very bad idea because it will be misused quite a lot. In fact, I can't see any good use for it. You should always use a timer instead.

A sleep function is sycroneous, and as long as each script doesn't have its own thread, it should realy not be used at all. Even when scripts are running in their own thread, Plus! would then not be able anymore to call other events at the appropiate time and custom interface windows will stop working; go blank, etc.

A function like sleep is only 'good' (mind the quotes; as it is actually never good) in a one-process-one-thread-no-gui environment.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-06-2010 04:08 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
RE: Scripting API Wishlist
Alright, how about this: dynamically add/edit/remove menu items in a MenuButtonControl (maybe in a similar way to OnGetScriptMenu() with the script menu).
03-06-2010 08:12 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Scripting API Wishlist
quote:
Originally posted by whiz
Alright, how about this: dynamically add/edit/remove menu items in a MenuButtonControl (maybe in a similar way to OnGetScriptMenu() with the script menu).
I made that same request before, but I still think this should get more attention. There are many controls which you can define in the interface XML but which can't easily be accessed from the script afterwards.

Take MenuButtonControls for instance: in Countdown Live, I wanted the menu entry labels to be changed while the window was opened. Nothing fancy, I just needed translations to be reloaded without re-opening windows. To get around the missing support, I had to completely recreate the menu button functionality: using a standard button control instead, creating a menu through the Windows API and then positioning the menu beneath the button. This works perfectly (it even gives additional features such as check marks and icons) but it's not something an average script developer would want to go through.

Talking about the Windows API: perhaps Plus! should provide easier access to some standard controls which can now only be accessed through the Windows API. I can imagine a beginning developer writing his first script getting headaches from working with the API when he wants to add a DateTimeControl, TreeViewControl or ProgressControl to his first window. Of course, the Windows API handles everything and it might be a bit silly if we were to wrap each and every API function or message in a Plus! script method, but still I think this should be considered. Should we expect scripters to learn working with Interop and the Windows API or should we make commonly used methods easier to access?
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
03-06-2010 09:31 PM
Profile E-Mail PM Web Find Quote Report
Pages: (15): « First « 9 10 11 12 [ 13 ] 14 15 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On