Hydrogenaudio Forums

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: marc2003 on 2015-11-09 11:41:31

Title: JScript Panel
Post by: marc2003 on 2015-11-09 11:41:31
Since I can no longer make new posts, let's see if editing works??
Title: JScript Panel
Post by: Falstaff on 2015-11-09 16:27:47
welcome to the new baby

I think you take the right decision, WSH Panel Mod will stay in v1.5.6 for those who want to run WSH panel mod scripts designed for, and new scripts will have to be for your new component.

my 3 jscripts in progress are now ported to JScript Panel:

- JS Smooth Playlist
- JS Smooth Browser
- JS Smooth Playlist Manager

I will share them as JScript Panel scripts only in next updates

The king is dead, long live the king!
Title: JScript Panel
Post by: marc2003 on 2015-11-09 18:24:14
It's good to have you onboard. 
Title: JScript Panel
Post by: Falstaff on 2015-11-10 10:51:05
my first "JScript Panel" scripts, now available from my DA account, so i share links here

JS Smooth Playlist Manager: http://fav.me/d9g6kss (http://fav.me/d9g6kss)
JS Smooth Playlist: http://fav.me/d9g6kgk (http://fav.me/d9g6kgk)
JS Smooth Browser: http://fav.me/d9g6ko0 (http://fav.me/d9g6ko0)

Title: JScript Panel
Post by: marc2003 on 2015-11-10 12:36:31
Nice. You may want to update the requirements though. You list foobar2000 v1.1 but the component requires v1.3 or above. Also, you mention clearing WSH panel properties when updating. 
Title: JScript Panel
Post by: Falstaff on 2015-11-10 13:11:37
fixed, thanks ...
Title: JScript Panel
Post by: marc2003 on 2015-11-10 18:55:27
Code: [Select]
v1.0.1
- CHG: Update default script so you know a blank panel
       is JScript Panel as opposed to WSH Panel Mod.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

(http://i.imgur.com/CE8tRsZ.png)

Hopefully, I removed all remaining references to WSH panel in the docs as well.
Title: JScript Panel
Post by: zeremy on 2015-11-10 21:06:32
This is certainly going in the right direction.
Great decision.

You should update https://github.com/19379/foo_uie_wsh_panel_mod (https://github.com/19379/foo_uie_wsh_panel_mod) README.md to notify/redirect users to the JScript Panel component as I assume all updates will be made to it only.
Title: JScript Panel
Post by: marc2003 on 2015-11-11 03:30:01
I'll probably nuke the WSH repo in a few days. I'll put the last version and source in the uploads forum for anyone who wants it.

Rather stupidly, I didn't even put a description of this component in the first post so I've updated the wiki page here:

https://github.com/19379/foo-jscript-panel/wiki (https://github.com/19379/foo-jscript-panel/wiki)
Title: JScript Panel
Post by: MachineHead on 2015-11-11 04:09:54
New JScript sample lastfm bio.txt used in chooser panel crashes. The other text samples I used (properties & thumbs) work fine. Error message below.

Code: [Select]
JScript Panel (Panel Receiver by marc2003): Microsoft JScript runtime error:
'this.content.length' is null or not an object
Line: 1, Col: 1
<source text only available at compile time>
Title: JScript Panel
Post by: marc2003 on 2015-11-11 05:43:12
Answered in the new JScript Panel script discussion/help (https://www.hydrogenaud.io/forums/index.php?showtopic=110516) thread. 

I'd like to keep this thread for component updates/issues only.
Title: JScript Panel
Post by: foosion on 2015-11-11 20:43:57
I think it was a good idea to create a fork of WSH panel mod. Throwing away the git history prior to your fork? Not so much.

Git has some powerful tools to transplant changes from one branch to another. Re-starting history makes this process harder than needs to be because most of these tools require that the branches have a common ancestor. It does not affect me in this case so take this as a friendly suggestion instead of a complaint: Please preserve the continuity of your git history! Otherwise some day some people might form a lynch mob (http://justinhileman.info/article/git-pretty/).
Title: JScript Panel
Post by: marc2003 on 2015-11-12 06:26:54
One person has forked the WSH repo on github so I'm not too concerned. If they know what they're doing, they can clone the JScript Panel repo, checkout the first commit and copy those files into the WSH panel mod source folder and commit the changes.

EDIT: I just remembered github lets you download from any point in history so no need to clone/checkout the first commit. Here's the source of my very first commit to the new repo.

https://github.com/19379/foo-jscript-panel/...81db9e209a5.zip (https://github.com/19379/foo-jscript-panel/archive/f584e9ca8f3cc48b6a22e02ddb11d81db9e209a5.zip)

EDIT2: Because of renamed folders, they shouldn't copy the whole zip but rather the contents of foobar2000/foo_jscript_panel/foo_jscript_panel in to foobar2000/foo_uie_wsh_panel_mod/foo_uie_wsh_panel_mod
Title: JScript Panel
Post by: marc2003 on 2015-11-12 09:48:32
Code: [Select]
v1.0.2

- CHG: Update to latest Columns UI SDK.
- CHG: Hopefully removed all traces of WSH Panel Mod
       from sources and documentation!


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)
Title: JScript Panel
Post by: marc2003 on 2015-11-12 12:48:25
@foosion, because I have far too much time on my hands, I've uploaded a new repo with full history.

https://github.com/19379/foo-jscript-panel/commits/master (https://github.com/19379/foo-jscript-panel/commits/master)
Title: JScript Panel
Post by: always.beta on 2015-11-13 00:49:49
Can you add a special interface for me, that interface is used to transform metadata Traditional Chinese into Simplified Chinese?  utils.LCMapString(str,lcid,flag)
Title: JScript Panel
Post by: marc2003 on 2015-11-13 01:54:51
If it exists in that "plus" component, I may be able to copy it. Can you give me an example of the input/output you expect so I can check it.
Title: JScript Panel
Post by: always.beta on 2015-11-13 02:50:09
If it exists in that "plus" component, I may be able to copy it. Can you give me an example of the input/output you expect so I can check it.

JSSmoothPlaylist main script.txt?Line 2743-2747?2771-2773?2821-2842
A demonstration of the operation?a.pomf.cat/rtthdj.gif   
Modified files?a.pomf.cat/ptlzst.7z  ?  a.pomf.cat/sztrpu.m4a
Title: JScript Panel
Post by: marc2003 on 2015-11-13 12:46:13
Code: [Select]
v1.0.3
- CHG: Revert previous Columns UI SDK update as I've just had foobar2000 crash.
       It did actually point at Panel Stack Splitter as the problematic
       component but I've never had an issue with it before. Given PSS acts
       as a container for other panels, I think it might be related. I don't
       have the skills to troubleshoot such an issue so the easiest thing to do
       is roll back.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)
Title: JScript Panel
Post by: bdport67 on 2015-11-13 15:00:11
ok switching over to JScript.
Seems there isnt an "use display preferences" selection mode on the art viewer anymore?

so I end up with same art in both Library and Now playing sides

you assisted me before with my setup with WSH panel.

https://www.hydrogenaud.io/forums/index.php...=104363&hl= (https://www.hydrogenaud.io/forums/index.php?showtopic=104363&hl=)

thoughts?

Title: JScript Panel
Post by: marc2003 on 2015-11-13 15:21:27
As much as I don't like that option, I've decided to restore it. Save this inside js_marc2003\js

https://raw.githubusercontent.com/19379/js-...ter/js/panel.js (https://raw.githubusercontent.com/19379/js-marc2003/master/js/panel.js)

Further questions about scripts should go in this thread: https://www.hydrogenaud.io/forums/index.php?showtopic=110516 (https://www.hydrogenaud.io/forums/index.php?showtopic=110516)

Title: JScript Panel
Post by: bdport67 on 2015-11-13 15:38:14
As much as I don't like that option, I've decided to restore it. Save this inside js_marc2003\js

https://raw.githubusercontent.com/19379/js-...ter/js/panel.js (https://raw.githubusercontent.com/19379/js-marc2003/master/js/panel.js)

Further questions about scripts should go in this thread: https://www.hydrogenaud.io/forums/index.php?showtopic=110516 (https://www.hydrogenaud.io/forums/index.php?showtopic=110516)

perfect thanks
like a charm

addl q posted in other post
Title: JScript Panel
Post by: Falstaff on 2015-11-14 11:20:05
bug report / WSH Panel Mod, method GetPlaylistFocusItemHandle no more available in plman :'(

bug in JSPlaylist that use this method...

JScript panel 1.0.3, earlier version not checked.
Title: JScript Panel
Post by: marc2003 on 2015-11-14 12:11:59
It's my fault for not including my removal of it in the changelog. I've just updated it.

It was removed because it's identical to fb.GetFocusItem which is used much more often.

Also, I think your usage was incorrect.

Code: [Select]
var save_focus_handle = plman.GetPlaylistFocusItemHandle(p.list.playlist);


The optional argument is force which defaults to true when omitted.

Original docs:

Code: [Select]
IFbMetadbHandle GetPlaylistFocusItemHandle(force);


Original docs for GetFocusItem
Code: [Select]
    // force: if this parameter is set to false, GetFocusItem() will only look for the focus item, otherwise, 
    //   if the focus item not found, find the first item of the active playlist.
    IFbMetadbHandle GetFocusItem(force = true);


You can see here where I removed it from my own mod of JSplaylist...

https://github.com/19379/jsplaylist-mod/com...08dbcede7a16f47 (https://github.com/19379/jsplaylist-mod/commit/f7227edb175c2b7708c844a7508dbcede7a16f47)
Title: JScript Panel
Post by: zeremy on 2015-11-14 13:54:14
If it exists in that "plus" component, I may be able to copy it. Can you give me an example of the input/output you expect so I can check it.

JSSmoothPlaylist main script.txt?Line 2743-2747?2771-2773?2821-2842
A demonstration of the operation?a.pomf.cat/rtthdj.gif   
Modified files?a.pomf.cat/ptlzst.7z  ?  a.pomf.cat/sztrpu.m4a


@marc2003
It was in the "plus" component.
Forked and commit at https://github.com/smoralis/foo-jscript-pan...a96cf9ee05f626b (https://github.com/smoralis/foo-jscript-panel/commit/df067ecf5ac0242aafbc3ba39a96cf9ee05f626b)

I hope you don't mind me contributing, this component was dead until you picked it up , so lets all contribute to make it what we all want...

@always.beta
Tested with your samples.
You need to update though your modified JSSmoothPlaylist to a JScript component compatible version.
Title: JScript Panel
Post by: always.beta on 2015-11-14 16:31:17
@always.beta
Tested with your samples.
You need to update though your modified JSSmoothPlaylist to a JScript component compatible version.
[/quote]

I'm currently using the js_smooth_playlist and foo_jscript_panel,I just take the old modified version as an example. Because of the time, I did not modify the new version.Thank you!!
Title: JScript Panel
Post by: marc2003 on 2015-11-15 03:51:28
Code: [Select]
v.1.0.4
- ADD: utils.MapString(text, lcid, flags)


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)
Title: JScript Panel
Post by: always.beta on 2015-11-15 05:11:20
Code: [Select]
v.1.0.4
- ADD: utils.MapString(text, lcid, flags)


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

I've added in the script, it works well, thank you??
Title: JScript Panel
Post by: WilB on 2015-11-17 16:24:28
I just had a crash using a script with JScript panel. The same piece of code has been working with wsh panel mod 1.5.6 for ages, so it seems something has changed in JScript panel. I isolated the problematical code and a snippet that shows the issue is below. It will occur if the user sets the border to <1 but any other value seems OK.

Code: [Select]
var border = 0; // if border set to < 1 crashes in JScript panel; wsh panel mod 1.5.6 doesn't crash
var ny = border * 0.5; // it's this multiplication that results in the bad handling
// weird as 0 * 0.5 should equal 0 & so the multiplication shouldn't actually do anything when border = 0

var n_y = ny - 1;

fb.trace("isNAN", isNaN(n_y)) // returns false so is a number

function on_paint(gr) {
gr.FillSolidRect(0, n_y, 50, 50, RGB(255,0,0))
}

fb.trace("n_y", n_y) // n_y traces to -1

window.RepaintRect(0, -1, 50, 50); // DOESN'T CRASH IF DIRECTLY ENTER -1

window.RepaintRect(0, n_y, 50, 50); // weirdly crashes here when y is calculated as above to -1;

//crashes in JScript panel; wsh panel mod 1.5.6 doesn't crash

function RGB(r, g, b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}

Seeing as I spotted the issue I have reported it, although I do know how to work around it easily enough. There seems to be something strange going on with the maths handling in JScript panel.

 Edit: I just discovered that it's due to use of the jscript9 engine I was using with JScript panel. Switching wsh panel mod 1.5.6 to jscript 9 also gives the script crash. Both JScript panel and wsh panel mod 1.5.6 run the snippet OK with the jscript engine.
Title: JScript Panel
Post by: marc2003 on 2015-11-17 16:43:03
Can you check your JScript engine setting? For me, it crashes in both components with JScript9. Using just JScript, it works fine in both components.

edit: I see you figured this out. It would have been very troubling if my changes had caused this kind of breakage so I'm glad we can rule that out.
Title: JScript Panel
Post by: WilB on 2015-11-17 16:45:35
Yes I realised that after I originally posted and my edit of post #29 crossed with your post.
Title: JScript Panel
Post by: foosion on 2015-11-17 17:53:19
Try passing -1.0 to the window.RepaintRect. Yes, that is different from -1 because it is a floating point number instead of an integer.
Title: JScript Panel
Post by: marc2003 on 2015-11-18 07:06:26
This is the source for RepaintRect...

Code: [Select]
STDMETHODIMP FbWindow::RepaintRect(UINT x, UINT y, UINT w, UINT h, VARIANT_BOOL force)
{
    TRACK_FUNCTION();

    m_host->RepaintRect(x, y, w, h, force != FALSE);
    return S_OK;
}


According to a quick google, UINT should be a positive integer so I don't know why using -1 doesn't throw errors all the time??

EDIT: I just added this inside the function...

Code: [Select]
console::formatter() << y;


and it spits out this when you feed it -1.

Code: [Select]
4294967295


That just happens to the maximum possible value for UINT. So even though it's not crashing, it's not repainting the area you want it to either!!

With JScript9 engine, the console code doesn't even get to run. I get an overflow error before it happens. Presumably there is some difference with how the scripting engine handles these numbers??

EDIT2
: I've updated the docs...

Code: [Select]
window.RepaintRect(x, y, w, h[, force]);
// x, y, w, h must be an integer, 0 or above. if you cannot be sure of values when
// calculating, do something like this...
// window.RepaintRect(Math.max(0, x), Math.max(0, y), w, h);
// force: boolean, default false
// use this instead of Repaint on frequently updated areas
// such as time, bitrate, seekbar, etc. this should reduce CPU usage.
// you can use Windows Task Manager to double check.
Title: JScript Panel
Post by: marc2003 on 2015-11-20 16:15:16
@Falstaff, I've restored all the return value types to interfaces.txt. I've also shuffled a few other bits around.

https://raw.githubusercontent.com/19379/foo.../Interfaces.txt (https://raw.githubusercontent.com/19379/foo-jscript-panel/master/foobar2000/foo_jscript_panel/docs/Interfaces.txt)
Title: JScript Panel
Post by: marc2003 on 2015-12-07 04:39:35
Just a little maintenance update...

Code: [Select]
- CHG: Update Columns UI SDK to 6.4
- CHG: Update WTL to 9.1
- CHG: Update scintilla to 3.6.2
- CHG: Tidy up docs/samples.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

And before anyone grumbles, I'm well aware of the increased file size. This is caused by the scintilla update.
Title: JScript Panel
Post by: colagen on 2015-12-07 16:36:34
You probably remember: in the WSH thread i posted a updated WSH component with a fix to on_mouse_wheel (because my laptop trackpad wasn't working with the previous function).
But it look like you didn't merge my changes to your new component.
In my component i also added two functions similar to UpdateFileInfoSimple, in order to update a group of songs with a nice progress bar while the update is going on, instead of updating the songs one by one.

IFbMetadbHandleList.UpdateFileInfoSimple(field1, value1 [, filed2, value2 [,...] ] [, multivalue_fields]);
This one update the metadb tags for a IFbMetadbHandleList, in order to update a group of songs with a nice progress bar while the update is going on, instead of updating the songs one by one.

IFbMetadbHandleList.UpdateFileInfoArray([field1, value1,field2, value2....]);
This one update the metadb tags based on the array given as a parameter. I needed that because sometimes in my code, the number of tags to update vary depending of the file, so i would have to call UpdateFileInfoSimple for each tag (because you can't have a dynamic number of arguments) and then i wouldn't have a real progress bar if the action take time. With UpdateFileInfoArray, you can build your array of tags to update first, and then you can call the function at the end, and you have a progress bar. This function may need an update, it doesn't care about multivalue fiedl i think, i don't remember exactly how i did it ..

The sources are here http://www.mediafire.com/download/1vl0x0zd....10_sources.zip (http://www.mediafire.com/download/1vl0x0zd0ald5zv/foo_uie_wsh_panel_mod-1.5.10_sources.zip), if you browse those sources and search for the names of my functions, you will be able to add them to your component. I can eventually help you
Title: JScript Panel
Post by: marc2003 on 2015-12-08 23:56:12
I'll take a look. Thanks.
Title: JScript Panel
Post by: Scrummble on 2015-12-10 11:36:52
I think utils.MapString(text, lcid, flags) need to be explained in the docs...
At least a link to the documentation its API relate to.
The discussions in this page make me confused. BTW I'm a simplified Chinese user myself.
Title: JScript Panel
Post by: Scrummble on 2015-12-10 11:53:40
As in WSH Panel Mod Plus, I found the window controlling functions much useful in certain situations. Maybe that's worth considering to be added in JS Panel?
Title: JScript Panel
Post by: marc2003 on 2015-12-10 15:00:31
@colagen, your sources only contain the mouse wheel changes.

@Scrummble, I copied the MapString function from that other component which also has no documentation. I'm English and only speak English so it's no good asking me. And the window stuff is illegal. I'd rather not the flout the SDK terms given I'm posting on the official forums.
Title: JScript Panel
Post by: colagen on 2015-12-10 17:54:15
@marx2003 oups, sorry, here it is, containing only the relevant files with the UpdateFileInfoXXX functions http://www.mediafire.com/download/qtav66aj...t_interface.zip (http://www.mediafire.com/download/qtav66ajwqi2jrb/script_interface.zip)
Title: JScript Panel
Post by: Scrummble on 2015-12-10 23:10:07
Actually, the mapstring function has documentation:
Code: [Select]
// see https://msdn.microsoft.com/en-us/library/windows/desktop/dd318700(v=vs.85).aspx

Yep, just a link, but still useful to other users.

BTW I'd like to know, did the SDK terms forbid components influencing one another?
The "window controlling functions" which I mentioned, are just functions that controls the panels in Panel Stack Splitters, I think, rather than the main window. The author of wshpm+ do not speak English, and I'd like to check if there's any misunderstanding.
Apologise for any of my ignorance.
Title: JScript Panel
Post by: marc2003 on 2015-12-14 07:19:07
Code: [Select]
v1.0.6
- ADD: FbMetadbHandleList UpdateFileInfoSimple method.


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

@colagen, I've added your trackpad fix but I haven't documented it because no one else has ever had this issue. Also, thanks for the UpdateFileInfoSimple code.
@Scrummble, I'm not adding any of the window stuff. You can always use that other component side by side with this or compile your own component.
Title: JScript Panel
Post by: colagen on 2015-12-14 11:32:47
Thanks a lot.
Will you add the updateFileInfoArray later to your component ? I can't find any way to do my code with one unique call to the standard UpdateFileInfoSimple.
Actually what i made is a function which remove all the tags from the selected tracks, except the ones i want to keep. I use it for all the new tracks added to my library, it's a fast way to organize the new files. And obviously i can't list all the weird tags directly in my code, so i have to check the file tags, and when there is a tag which i don't want, i add it to my array of tag to erase, and i call updateFileInfoArray at the end.

Maybe you didn't add it because my code is dirty ? Which is probably true, i'm not a developer myself, i did it without a clear understanding of what i was doing, so it may be buggy.
Title: JScript Panel
Post by: marc2003 on 2015-12-14 13:04:00
If you had provided an example of how to use the function within a script, I might have considered it. I'm totally confused by your post and the fact you've added it as a handle method as well!!
Title: JScript Panel
Post by: Rhand on 2015-12-14 16:39:16
General question:

Is it possible to make a button in JScript with (switch to playlist) as menu?

Thx
Title: JScript Panel
Post by: marc2003 on 2015-12-14 17:12:59
edit: Answered in the script thread: https://www.hydrogenaud.io/forums/index.php...st&p=912900 (https://www.hydrogenaud.io/forums/index.php?s=&showtopic=110516&view=findpost&p=912900)
Title: JScript Panel
Post by: colagen on 2015-12-14 17:55:59
If you had provided an example of how to use the function within a script, I might have considered it. I'm totally confused by your post and the fact you've added it as a handle method as well!!


Nope, it's just a FbMetadbHandleList method.
I can provide you an example of use yes, but i don't know if it will be easier to understand
The function is quite easy, it's basically the same function than UpdateFileInfoSimple, but it accept only an array as argument, and this array must contain the tags to update, and their values.
FbMetadbHandleList.UpdateFileInfoArray ( ["tagName1","TagValue1","tagName2","TagValue2"...] )

Below is a example, it's a little script i just wrote, which loop over the tags of the first item of a FbMetadbHandleList ( plist_items.Item(0) ), and build an array containing all the tags which aren't in the array named toKeepArray (it use a function named arrayContains(array, string), which is defined below), and after the tag name, an empty string.
Then, with the resulting array, i can call UpdateFileInfoArray and it will remove all those tags from all the items of this FbMetadbHandleList.
This is something you can't do with UpdateFileInfoSimple(). But you course this is a very specific usage, and it's not a big deal if it can't be added to the component.

Code: [Select]
var toRemoveArray=Array();
var toKeepArray=["album","artist","composer","date","genre","title","tracknumber"];
var track_FileInfo = plist_items.Item(0).GetFileInfo();
for (var i = 0; i <= track_FileInfo.MetaCount; i++) {
       if(!arrayContains(toKeepArray , track_FileInfo.MetaName(i))) {
           toRemoveArray[toRemoveArray.length]=track_FileInfo.MetaName(i);
           toRemoveArray[toRemoveArray.length]="";
       }
}
plist_items.UpdateFileInfoArray(toRemoveArray);


function arrayContains(array,string){
    for (var i = 0; i < array.length; i++) {
        if(array[i]==string) return true;
    }
    return false;
}
Title: JScript Panel
Post by: marc2003 on 2015-12-15 08:34:26
Nope, it's just a FbMetadbHandleList method.


You are quite right. I need my eyes testing.

I'll just need to do some testing before I include it.
Title: JScript Panel
Post by: blaxima on 2015-12-15 21:05:56
Hi marc,

I seem to be having problems with certain bands for the last.fm bio.

This was the error message
Quote
JScript Panel (Last.fm Bio by marc2003): Microsoft JScript runtime error:
Unable to get value of the property 'length': object is null or undefined
File: text.js
Line: 249, Col: 25
<source text only available at compile time>


With the latest release it says the cached file is corrupted but I've removed the file so there is nothing there to be corrupted. All other information is fetched, album review, similar artists and other releases.
Title: JScript Panel
Post by: marc2003 on 2015-12-16 06:20:32
I'm not really sure why you removed the file. The error tells you exactly what to do:

Quote
"It appears the cached file has been corrupted. Use the right click menu>Force Update to try again."


If it's happening randomly (fixed by a forced update) then there isn't much I can do. If you can't get the bio of specific artist with multiple retries then I can take a look if you tell me what the artist is.

edit: If you reply, please do it in the script thread: https://www.hydrogenaud.io/forums/index.php?showtopic=110516 (https://www.hydrogenaud.io/forums/index.php?showtopic=110516)
Title: JScript Panel
Post by: WilB on 2015-12-17 19:24:16
    I am in the process of finalising a Jscript "Library  Tree" and have come across a few points. Please can you consider the following  requests.

           
Title: JScript Panel
Post by: marc2003 on 2015-12-17 23:19:51
1) From what I can see, nothing like that is available. There is a library get_relative_path for metadb handles so I guess that could be added. You'd then have to loop through all library items and strip it from the full path to get the library folder.

2) I don't see that as a component issue. You can track the mouse yourself, use timers to prevent code running, mess around with SetDelayTime etc. FWIW, I never deactivate tooltips. If I want to clear them, I just set the tooltip text as an empty string and activate it.

3) I'll look in to it but given my zero knowledge/skills, I'm not sure I'll get very far.
Title: JScript Panel
Post by: marc2003 on 2015-12-18 10:19:10
I've added fb.GetLibraryRelativePath. I won't be uploading a new component just yet but you can view the docs/check an example here.

https://github.com/19379/foo-jscript-panel/...es.txt#L146L158 (https://github.com/19379/foo-jscript-panel/blob/9ac63437f74c4dc18b3ef72a3e9068a6097a5050/foobar2000/foo_jscript_panel/docs/Interfaces.txt#L146L158)

I don't think I'll be able to do anything about #3.
Title: JScript Panel
Post by: WilB on 2015-12-18 13:12:01
Thanks for adding fb.GetLibraryRelativePath. I look forward to trying it out when a new version is released. 

#2 The problem is when them mouse is over a tooltip with tooltip showing. Then when Alt + Tab to a different program, the tooltip will still show. I thought SetDelayTime() delays the appearance of the tooltip and so I don't see how that helps remove a tooltip when the window is left. I also don't see how mouse tracking (you mean through on_mouse_move?) can be used to report if the window is left, since it doesn't report a change in that scenario. I had already tried these before I originally posted & have unsuccessfullly tried them again. The solution which I was also using before I originally posted is to use a timer, but the tooltip will still show when Alt + Tab to a different window until the timer kicks in.

So it seems the proper way of doing it would be to use on_mouse_leave to kill the tooltip - but that doesn't work when the mouse is over the tooltip as that triggers the callback. I note that in your helpers button example you do use on_mouse_leave (this.leave -> tt("")) to kill the tooltip - here the mouse isn't over the tooltip.

Probably you aren't able to change the on_mouse_leave operation in JScript panel, & since there may be no other workaround, the timer will have to do. Else if I am overlooking something please advise.
Title: JScript Panel
Post by: marc2003 on 2015-12-18 13:45:12
For your alt-tab problem, you should be able to use the on_focus callback.

Code: [Select]
function on_focus(is_focused) {
    if (!is_focused) //clear tooltips
}
Title: JScript Panel
Post by: WilB on 2015-12-18 16:25:53
Thanks, it helps. It works if the JScript panel has focus (i.e. last mouse click is in the panel). Then Alt + Tab causes the JScript panel to lose focus. 

But tooltips show even when the panel hasn't focus (e.g. last click in playlist and mouse over JScript panel), and so then its not called on Alt + Tab, because the JScript panel focus doesn't change, and so doesn't work.
Title: JScript Panel
Post by: marc2003 on 2015-12-18 16:52:37
Code: [Select]
v1.0.7
- ADD: fb.GetLibraryRelativePath(handle)


https://github.com/19379/foo-jscript-panel/releases (https://github.com/19379/foo-jscript-panel/releases)

It should be noted that the SDK function used to get the relative path has a special warning. 

Quote
//! SPECIAL WARNING: to allow multi-CPU optimizations to parse relative track paths, this API works in threads other than the main app thread. Main thread MUST be blocked while working in such scenarios, it's NOT safe to call from worker threads while the Media Library content/configuration might be getting altered.


I had a quick poke around the columns UI album list code and that doesn't appear to be doing anything special except the loop through all library items is inside a try/catch statement so that would be my recommendation as well.

@colagen, I didn't add your UpdateFileInfoArray method because I want to try and get it working with multi-value tags.
Title: JScript Panel
Post by: Falstaff on 2015-12-18 19:50:40
<???> fb.GetLibraryRelativePath(handle)

what does it return ? a string ? an array (i hope so cause library can be set w/ many paths in foobar2000) ? ...
Title: JScript Panel
Post by: marc2003 on 2015-12-18 20:08:52
It's the relative path for a given track. Look at the example in the docs.

If you want to determine the folders set in the preferences, this bit of code should do it. It's crudely stripping out the relative path from the full path to give the base folder. I don't know how else you would do it.

Code: [Select]
var items = fb.GetLibraryItems();
items.OrderByPath();
var current = "";
var folders = [];
for (var i = 0; i < items.Count; i++) {    
    var temp = items.Item(i).Path.replace(fb.GetLibraryRelativePath(items.Item(i)), "");
    if (temp != current) {
        current = temp;
        folders.push(current);
    }
}
fb.ShowPopupMessage(folders.join("\n"));
Title: JScript Panel
Post by: WilB on 2015-12-19 09:44:30
  Just to confirm that fb.GetLibraryRelativePath is exactly what was required for my purposes and that it's working extremely well.

 
Title: JScript Panel
Post by: Falstaff on 2015-12-20 14:11:00
ok, thanx for pointing me to the right use
Title: JScript Panel
Post by: Scrummble on 2015-12-23 22:44:09
As I can see, the mouse scroll callback only supports the vertical wheel.
Is it possible to use horizontal scrolling in it?
Title: JScript Panel
Post by: marc2003 on 2015-12-24 04:27:19
A quick google suggests adding a new callback should be trivial. However, I've just got a new SSD with a fresh install of windows and I don't want to clutter it up with Visual Studio so you'll have to wait until I set up a dual boot or virtual machine.
Title: JScript Panel
Post by: marc2003 on 2015-12-26 13:48:50
@Scrummble, can you test this and see if it works (it's the dll only)

edit: link removed. JSplaylist is going mental with it.   

edit2: can you just confirm you're talking about a mouse wheel that tilts left/right? A bit more reading shows that some people are holding down shift while scrolling normally and this is something you can implement yourself.

Code: [Select]
//flags
var VK_SHIFT = 0x10;

function on_mouse_wheel(s) {
    if (utils.IsKeyPressed(VK_SHIFT)) {
        //scroll left/right
    } else {
        //scroll normally
    }
}
Title: Re: JScript Panel
Post by: WilB on 2016-01-10 18:14:14
While fb.GetLibraryItems() works extremely well on many queries and is an excellent addition, there are some queries it can’t handle resulting in a crash. So I was wondering if this was something that you were able to fix. Current workaround is to use catch error. Here’s hoping there’s a simple fix... Just putting the below in a panel causes the indicated crashes for me.

plman.GetQueryItems(fb.GetLibraryItems(), "%last_played% DURING LAST 2 WEEKS") // CRASH
plman.GetQueryItems(fb.GetLibraryItems(), "%last_modified% DURING LAST 2 WEEKS") // CRASH
plman.GetQueryItems(fb.GetLibraryItems(), "%artist% HAS beatles") // OK
plman.GetQueryItems(fb.GetLibraryItems(), "artist HAS beatles") // OK
plman.GetQueryItems(fb.GetLibraryItems(), "rating IS 5") // OK

Title: Re: JScript Panel
Post by: marc2003 on 2016-01-10 20:34:27
The C++ I copied from another component also uses a try/catch statement and when I compiled it with the try/catch removed, it crashed hard bringing down foobar with this error in the crash log:

Quote
System time operations not available in this context

I'm guessing it just needs updating to use something newer provided in the SDK.
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-10 21:50:52
Oh noes, I made a breaking change. GetQueryItems should never have been a plman method and I apologise for that. It is now a fb method. For that reason, we are now on v1.1.0

https://github.com/19379/foo-jscript-panel/releases

Code: [Select]
v1.1.0
- CHG: GetQueryItems should be a "fb" method, not "plman".
- FIX: Fix crash when using GetQueryItems with dates as part of the query.
- CHG: Update Columns UI SDK to 6.5

I've added a note to the docs as well.

Code: [Select]
		fb.GetQueryItems(handle_list, query); (IFbMetadbHandleList)
/*
example1: var fav_playlist_items = fb.GetQueryItems(plman.GetPlaylistItems(plman.ActivePlaylist), "rating IS 5");
example2: var fav_library_items = fb.GetQueryItems(fb.GetLibraryItems(), "rating IS 5");
results are unsorted

NOTE: use try/catch to handle invalid queries. An empty handle list will be returned if the query is valid but there are no results.
*/
Title: Re: JScript Panel
Post by: Scrummble on 2016-01-12 01:36:32
In fact I did not get it when you mentioned "shift".
Have you ever seen a mouse with dual wheels? One wheel vertical and one horizontal, that's what I was talking about.
Personally I use a Macbook Air with Win10 on Parallel Desktop, and the touchpad supports horizontal scrolling, which works fine on Microsoft Edge, Chrome, Notepad2, Excel and Word (while ironically File Explorer and PowerPoint does not support this; ELPlaylist on fb2k even has a bug showing a blank area).
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-12 03:17:08
Code: [Select]
v1.1.1
- ADD: New "on_mouse_wheel_h" callback for left/right scrolling. See callbacks.txt.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: WilB on 2016-01-12 19:09:09
Thanks for the speedy fix. Just to confirm that fb.GetQueryItems() seems to be working correctly now.  :)
Title: Re: JScript Panel
Post by: Bauble on 2016-01-30 21:54:14
Hi
After I installed 1.1.1 plugin through foobar interface and restarted foobar, I get this error:

Failed to load DLL: foo_jscript_panel.dll
Reason: A dynamic link library (DLL) initialization routine failed. 

what could be the reason? I never used JScript Panel before, this is first time I install it

ye and it shows "(component not loaded)" in component list

foobar 1.3.9
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-31 09:03:51
If you're running Windows XP then that would be the problem. It requires Vista or later.

https://github.com/19379/foo-jscript-panel/wiki/Requirements-&-Installation
Title: Re: JScript Panel
Post by: Bauble on 2016-01-31 10:32:23
no, Windows 7 32 'N' version

and foobar without Column UI
Title: Re: JScript Panel
Post by: marc2003 on 2016-01-31 17:07:38
Well I cannot explain that. It should work on any version of windows 7.
Title: Status Bar sample script bug
Post by: Jailhouse on 2016-02-04 01:58:20
Hello,

I tried using the mouse scroll wheel to change the volume while playing with the Status Bar sample. The script lowers the volume when rolling the wheel both backward and forward. Using foobar's volume control in the notification area works as expected. I don't see an obvious error in the script, which is probably the only kind I can find right now given my current meager knowledge of JavaScript.

As an aside, I decided to install JScript Panel because of included Seekbar script sample; I hoped it might solve my problem with the foobar seekbar, which is that it's practically invisible from across the room. I'm happy to say that I successfully modified the script to create exactly what I needed. Many thanks, @marc2003, for making this possible.

Mark
Title: Re: Status Bar sample script bug
Post by: Jailhouse on 2016-02-06 06:16:32
I tried using the mouse scroll wheel to change the volume while playing with the Status Bar sample. The script lowers the volume when rolling the wheel both backward and forward.
I modified the Status Bar example to fill other needs. Setting the volume via the mouse wheel is still not working properly, but I'm keeping that functionality because I'll like it a lot when it works. (Or I might try adding another panel with the Volume sample script instead. You never know.)

The function involved is:
Code: [Select]
function on_mouse_wheel(s) {
if (!show_volume)
return;
if (s == 1)
fb.VolumeUp();
else
fb.VolumeDown();
I set the var s to 0, which reversed the effect, i.e., the volume only rises. I tried -1 and recreated the original behavior. I found Volume entries in interfaces.txt but haven't a clue at this time what to do with the information.

I'm running foobar on Windows 7 Home Premium and using the DUI.
Title: Recently played items list
Post by: Jailhouse on 2016-02-06 06:58:30
I've used two JScript panels to replace five Text Display panels, added panels using the playback buttons and seekbar sample scripts, and got the status bar panel I've been referring to above configured to my liking. (The Status Bar playlist track count has already become very useful.) I really like this thing!  ;D

I sometimes hear a song I like (or not), but don't know what it is and can't drop what I'm doing to check before the track ends. When I was using Zune (gack) I could simply go back to the previous track or two to find out what I was listening to. However, foobar doesn't work that way. That may be the only advantage Zune has over fb2k.

While hacking away at the sample scripts I'm using, I got to thinking it might well be possible to create a list of recently-played tracks in JScript Panel. Am I correct? Would it be difficult? (For me, probably yes, even if it's a relatively simple thing. I have much to learn.)
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-06 13:39:14
Can you try and see if this works...

Code: [Select]
function on_mouse_wheel(a, b) {
if (!show_volume)
return;
if (b > 0)
fb.VolumeUp();
else
fb.VolumeDown();
}

As for getting a list of recently played tracks, install foo_playcount. Then after playing some tracks, you can use the Library menu>Playback Statistics>Show recently played.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-02-06 22:11:34
Can you try and see if this works...
[snip]
As for getting a list of recently played tracks, install foo_playcount. Then after playing some tracks, you can use the Library menu>Playback Statistics>Show recently played.

That works a treat!

I'll check out foo_playcount. I'm still curious, though, if you think it's possible to display a dynamic recently-played list using JScript Panel.

Thank you.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-11 13:01:46
Code: [Select]
v1.1.2
- FIX: Fix on_mouse_wheel not being called with certain trackpads.

https://github.com/19379/foo-jscript-panel/releases

@Jailhouse, this should fix the volume problem you were having. Reverting back to the original script should work.

As for tracking plays with Jscript Panel, of course it's possible. I just don't think it's worth the effort when foo_playcount does it as well.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-02-11 15:57:57
Code: [Select]
v1.1.2
- FIX: Fix on_mouse_wheel not being called with certain trackpads.

https://github.com/19379/foo-jscript-panel/releases

@Jailhouse, this should fix the volume problem you were having. Reverting back to the original script should work.

The original script works fine now. Thanks.

Quote
As for tracking plays with Jscript Panel, of course it's possible. I just don't think it's worth the effort when foo_playcount does it as well.

I see your point, but there are other dynamics here: I would like to see the list at a glance; I don't want to install any more components than I have to, and I already have JScript Panel; most important, working toward a goal of my choosing will help me to learn and understand more quickly as I'll be more interested in the result.
Title: Odd behavior in DUI playlist apparently due to JScript Panel
Post by: Jailhouse on 2016-02-13 05:19:28
While working with some of the sample scripts for JScript Panel (JSP), I noticed that when playing tracks in random order the track being played was shown at either the top of the DUI playlist window or at the bottom, depending on its location in the list relative to the previous track. Normally, the current track is displayed in the middle of the window where it's easy to find; a nice touch.

I suspected JSP might have had something to do with this since it's the only third-party component I'm using. I have subsequently found that if I remove all the panels and restart foobar, the playlist window updates normally. If I then restore the panels, the window still updates as it should until I restart foobar, upon which the misbehavior returns. I do not have to interact with the panels in any way, including moving the cursor over them, for this to happen.

I am using the following scripts, in order of installation:

I first noticed the problem as I was working on the second script, but I can't say for certain that it wasn't happening from the time I was working on seekbar. I have modified the first three scripts to remove the bits I didn't need and change formatting. I've been careful, but I'm open to the possibility that I may have inadvertently become a troublemaker.

It just occurred to me that I did not test removing panels individually. I'll be happy to do so upon request.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-13 13:38:40
I have been able to reproduce that but not reliably. Re-arranging panels can make it work again and then it stops again - all without restarting foobar.

Also, the following playlist views are unaffected so I feel there is nothing I can do about this.

EsPlaylist (default UI and columns UI)
SimPlaylist (default UI)
NGplaylist (columns UI)
JSplaylist (WSH panel mod script by Falstaff modded by me for JScript panel)

Even if other playlist views were affected, I still don't think I could do anything about it because I wouldn't know where to begin trying to debug it.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-02-14 04:16:33
I had one instance where I booted my PC and when I started foobar the playlist functioned normally, but the problem returned upon the next foobar start. Other than that, starting foobar with any panels installed triggers the issue, and starting with no panels solves it.

Even if other playlist views were affected, I still don't think I could do anything about it because I wouldn't know where to begin trying to debug it.
I imagine this problem would be easier to debug if it would throw an error or cause foobar to crash. I'm hoping you're like me and you suddenly come up with a possible solution out of the blue. I seem to do my best thinking subconsciously.

I also imagine that with this being a cosmetic issue that doesn't affect the playlist's functionality and isn't a bug in foobar, Peter isn't likely to be very interested in looking into it and so calling attention to it in the Support forum probably wouldn't be useful.

Since you mentioned JSplaylist, I think I'll look into that. It seems that in time my entire foobar GUI will be composed of JScript panels.
Title: Re: JScript Panel
Post by: terrazac on 2016-02-14 18:33:15
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-14 21:05:50
Yes, it's possible. Next you'll be asking how...  :P
Title: Re: JScript Panel
Post by: colagen on 2016-02-14 23:38:07
Hi,

A user of this forum ask me if i was willing to use in one of my script a function available in a wsh panel mod made by a Russian guy, which allow to save a GdiImage to the disk, as jpg, bmp, png, gif, or tiff
It's great to make a cover cache, and the code source of his mod is available online, i tried and it seems to work quite well, he added a SaveAs method (like the Resize() method for example) to the IGdiBitmap object.
@Marc2003, are you willing to add it to your jscript component ? It should be just a copy/pastle game, by searching the SaveAs reference in the provided files.

The code source of his component is here : https://github.com/ttsping/foo_uie_wsh_panel_mod_plus
And if you want to browse only the files containing the SaveAs method, there is only 3 files, and they are here http://www.mediafire.com/download/9gzlozp4lt27pzg/script_interface_impl_with_SaveAs.zip

Maybe there is others good new functions in his component, but i didn't really browse the repository, and the component may be buggy (i don't know), so it's probably a bad idea to copy everything.

And the doc of this method is here :

      SaveAs(path, [format = "image/png"]); (Boolean)
      // format:
      // default - "image/png",
      // supported - "image/bmp"
      //     "image/jpeg"
      //     "image/gif"
      //        "image/tiff"
      //  e.g.: var img = gdi.CreateImage(1, 1);
      // img.SaveAs("D:\\img.png","image/png");   
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-15 16:16:07
I'm pretty sure he's Chinese, not Russian. Just look at the github commits he's made in the last 2 days. Anyway, I will consider adding this in the next day or so..
Title: Re: JScript Panel
Post by: colagen on 2016-02-15 18:33:25
Oh yes, possible, i don't even remember why i though he was russian, i'm pretty sure he is a human, and one who know how to write a c++ function, that's all i'm sure about : )
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-15 18:53:20
Remember that on_mouse_wheel issue you had and you provided me with some extra code so it returns 3 arguments. I've since updated the first argument so can you test and see if it works for you. If so, I can then tidy up by removing the other two.
Title: Re: JScript Panel
Post by: colagen on 2016-02-15 19:33:47
Nope, it doesn't fix it, if i remove the second and third argument, it scroll, but way too quickly.
My trackpad trigger on_mouse_wheel events repeatedly with small values, and step is an integer, 1 or -1, so one scroll with my trackpad make something like ten calls to on_mouse_wheel, with step equal to 1 or -1
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-15 19:38:02
Fairy nuff. I'll leave it in.
Title: Re: JScript Panel
Post by: elia_is_me on 2016-02-16 01:28:05
Hi,

A user of this forum ask me if i was willing to use in one of my script a function available in a wsh panel mod made by a Russian guy, which allow to save a GdiImage to the disk, as jpg, bmp, png, gif, or tiff
It's great to make a cover cache, and the code source of his mod is available online, i tried and it seems to work quite well, he added a SaveAs method (like the Resize() method for example) to the IGdiBitmap object.
@Marc2003, are you willing to add it to your jscript component ? It should be just a copy/pastle game, by searching the SaveAs reference in the provided files.

The code source of his component is here : https://github.com/ttsping/foo_uie_wsh_panel_mod_plus
And if you want to browse only the files containing the SaveAs method, there is only 3 files, and they are here http://www.mediafire.com/download/9gzlozp4lt27pzg/script_interface_impl_with_SaveAs.zip

Maybe there is others good new functions in his component, but i didn't really browse the repository, and the component may be buggy (i don't know), so it's probably a bad idea to copy everything.

And the doc of this method is here :

      SaveAs(path, [format = "image/png"]); (Boolean)
      // format:
      // default - "image/png",
      // supported - "image/bmp"
      //     "image/jpeg"
      //     "image/gif"
      //        "image/tiff"
      //  e.g.: var img = gdi.CreateImage(1, 1);
      // img.SaveAs("D:\\img.png","image/png");   

Maybe you mean ttsping's WSH Panel Mod Plus, but he is not a 'Russion' guy...

and his component is not buggy at all, because we've used&tested  it for a long time and it works well. ttsping decided to extend wsh_panel_mod 1.5.6 after wang t.p. did not appear in public for years.(It's a tradition in China that people like to do some interesting things in their school days and disappear after they find a job)

ttsping had released a public version of wsh_panel_mod_plus in github days ago which you may have already know.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-17 11:25:55
Code: [Select]
v1.1.3
- ADD: IGdiBitmap SaveAs method.

https://github.com/19379/foo-jscript-panel/releases

My version of the docs:

Code: [Select]
		SaveAs(path, [format]); (boolean)
/*
path: full path including file extension. the parent folder must already exist.
format:
"image/png" (default if omitted)
"image/bmp"
"image/jpeg"
"image/gif"
"image/tiff"

example:
var img = utils.GetAlbumArtEmbedded(fb.GetFocusItem().RawPath, 0);
if (img)
img.SaveAs("D:\\export.jpg", "image/jpeg");
*/
Title: Re: JScript Panel
Post by: colagen on 2016-02-19 13:18:57
Thanks a lot, i build a cache system for my layout using it, it work perfectly, and now foobar is a quite a lot faster, it's much faster to load an already resized image directly instead of using the GetAlbumArt functions
Title: Re: JScript Panel
Post by: terrazac on 2016-02-19 20:53:25
Reply #85 – 14 February, 2016, 01:33:15 PM
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?


Reply #86 – 14 February, 2016, 04:05:50 PM
Yes, it's possible. Next you'll be asking how...  :P


Not really I worked a litlle around and I doit in this way:

if ( this.metadb.path.indexOf(".mp3")){
  texto = this.metadb.path.replace(".mp3",".lrc");
}
  if (utils.ReadTextFile(texto) ) {
gr.GdiDrawText("LRC", gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
} else {
gr.GdiDrawText(this.title, gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}

I insert this in your code at your old wsh script and works but I want it in your new Jscrip.... but I can't get it work...  why?
because this:

El objeto no acepta esta propiedad o método (The object doesn't accept the method o argument)
File: <main>
Line: 520, Col: 9
<source text only available at compile time>

and the line 520 is a // commente but the 521 is:

 521        fb.CreateAutoPlaylist(total, "Media Library", "ALL", "%album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%", 0);

I try to skip that line but later become other problems. What I doing bad?
Title: Re: JScript Panel
Post by: terrazac on 2016-02-19 20:57:59
Reply #85 – 14 February, 2016, 01:33:15 PM
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?


Reply #86 – 14 February, 2016, 04:05:50 PM
Yes, it's possible. Next you'll be asking how...  :P


Not really I worked a litlle around and I doit in this way:

if ( this.metadb.path.indexOf(".mp3")){
  texto = this.metadb.path.replace(".mp3",".lrc");
}
  if (utils.ReadTextFile(texto) ) {
gr.GdiDrawText("LRC", gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
} else {
gr.GdiDrawText(this.title, gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}

I insert this in your code at your old wsh script and works but I want it in your new Jscrip.... but I can't get it work...  why?
because this:

El objeto no acepta esta propiedad o método (The object doesn't accept the method o argument)
File: <main>
Line: 520, Col: 9
<source text only available at compile time>

and the line 520 is a // commente but the 521 is:

 521        fb.CreateAutoPlaylist(total, "Media Library", "ALL", "%album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%", 0);

I try to skip that line but later become other problems. What I doing bad?

If there is a better way to do it, I would like to Know of course!!!!
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-21 10:27:02
fb.CreateAutoPlaylist doesn't exist in JScript panel - it has been replaced with plman.CreateAutoPlaylist. Details of other changes here...

https://github.com/19379/foo-jscript-panel/wiki/Updating-WSH-Panel-Mod-scripts-for-JScript-Panel

An updated version of Br3tt/Falstaff's JSplaylist for JScript Panel can be found here..

https://github.com/19379/jsplaylist-mod

Updated version of JSSmoothPlaylist can be found here..

http://www.deviantart.com/art/JS-Smooth-Playlist-571375892

If you're not using either of these scripts then you will have to update it yourself.
Title: Re: JScript Panel
Post by: garudaishaya on 2016-02-25 10:05:02
how can i change the color of the themed seek bar?
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-25 12:13:33
If you want to change colours, don't use a themed seekbar.
Title: Re: JScript Panel
Post by: garudaishaya on 2016-02-26 07:26:49
shame on me!
I just like to change the green color of the progress bar for grey
thanks anyway
Title: Re: JScript Panel
Post by: terrazac on 2016-02-27 15:33:33
Hi, I am capable to display the texts LRC, TXT or N/A if the lyrics file are next to the mp3 file but I want to write them inside a the tagg COMMENT to be able to sort all the track by LRC or TXT, etc.

I can have the tagg "COMMENT" with:

gr.DrawString(fb.TitleFormat("%comment%").EvalWithMetadb(this.metadb) , g_font, this.text_colour_default, columns.rating_x + 200, this.y + 3, cw + 1, cTrack.height + cTrack.parity, lc_stringformat);

but how can I write to the tagg "Comment" from jscript?, something like:

%comment% = "LRC"

Is it posible? and How?
Title: Re: JScript Panel
Post by: ohyeah on 2016-02-27 16:31:22
Hi, I am capable to display the texts LRC, TXT or N/A if the lyrics file are next to the mp3 file but I want to write them inside a the tagg COMMENT to be able to sort all the track by LRC or TXT, etc.

I can have the tagg "COMMENT" with:

gr.DrawString(fb.TitleFormat("%comment%").EvalWithMetadb(this.metadb) , g_font, this.text_colour_default, columns.rating_x + 200, this.y + 3, cw + 1, cTrack.height + cTrack.parity, lc_stringformat);

but how can I write to the tagg "Comment" from jscript?, something like:

%comment% = "LRC"

Is it posible? and How?
this.metadb.UpdateFileInfoSimple("COMMENT", "LRC");
you may have to edit the text  file "LargeFieldsConfig.txt" (installdir) , adding "comment" to basic field or comment it in the spam field,  im not sure.
Title: Re: JScript Panel
Post by: marc2003 on 2016-02-27 17:21:50
Writing tags from a script designed as a playlist viewer is a really bad idea - especially when called from inside on_paint.

Really, you want a bit of code that will loop through all playlist/library items just once. Also, rather than updating each file individually, you should build up a single handle list and use UpdateFileInfoSimple on that. Something like...

Code: [Select]
var items = plman.GetPlaylistItems(plman.ActivePlaylist); //get all active playlist items
var items_to_tag = plman.GetPlaylistItems(-1); //using -1 here gives us an empty handle list to start with
for (var i = 0; i < items.Count; i++) {
var m = items.Item(i);
if (some check for lrc file using m.Path)
items_to_tag.Add(m); //add current track to list of items to be tagged
}
if (items_to_tag.Count > 0)
items_to_tag.UpdateFileInfoSimple("COMMENT", "LRC");
Title: Re: JScript Panel
Post by: terrazac on 2016-02-28 17:46:16
yes you are right. Thank you a lot.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-03-16 00:18:59
Quote
[From Reply #82] I noticed that when playing tracks in random order the track being played was shown at either the top of the DUI playlist window or at the bottom, depending on its location in the list relative to the previous track. Normally, the current track is displayed in the middle of the window where it's easy to find [...]

I have discovered that doing the following restores the normal playlist behavior:


I'm using the JScript Panel controls for playback. I don't know if using the foobar2000 controls makes a difference, nor if clicking Play instead of Next does so. (Since the issue occurs sporadically, so does testing.)

@marc2003, I hope this might provide some clue as to why the problem happens in the first place. I'm not holding my breath.  :)

I'm hoping the problem stops occurring once I stop modifying the panel script(s).
Title: Re: JScript Panel
Post by: marc2003 on 2016-03-16 07:44:08
I hope this might provide some clue as to why the problem happens in the first place.

Nope!

Quote
I'm not holding my breath.  :)

Good. You'd suffocate if you did.

Quote
I'm hoping the problem stops occurring once I stop modifying the panel script(s).

I already reproduced the issue using my own scripts so it's not you. I tested blank panels and that was fine so it's not the presence of the component itself.

You have 3 choices:

1) Use an alternative playlist viewer.
2) Don't use JScript Panel/my scripts.
3) Live with the issue.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-03-16 16:28:51
It seemed to me that the problem didn't occur at any time except just after I'd modified a script. So of course when I started foobar2000 for the first time today, there it was. Another hypothesis blown to bits. Moomph.

Quote
2) Don't use JScript Panel/my scripts.

You can't get rid of me that easily.  ;)  I'm getting foobar2000 set up just the way I want it using your scripts. I'm also learning JavaScript, which is fairly new to me (old dog/new trick). I'm having too much fun to quit!

Quote
3) Live with the issue.

I was doing that anyway, but it's easier now that I have a simple method to shoo it away.
Title: Re: JScript Panel
Post by: marc2003 on 2016-04-30 09:00:49
Code: [Select]
v1.1.4
- FIX: main preferences keyboard shortcuts were never processed in columns UI
       when JScript Panel had focus. More details here:
       https://github.com/19379/foo-jscript-panel/wiki/Keyboard-Shortcuts

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: always.beta on 2016-04-30 12:23:17
Would you be interested in three callback combined into one?  "on_library_items_added() + on_library_items_removed() + on_library_items_changed() " >> on_library_changed()
Title: Re: JScript Panel
Post by: marc2003 on 2016-04-30 12:48:39
That is a few lines of code you can add yourself...

Code: [Select]
function on_library_items_added() {on_library_changed();}
function on_library_items_removed() {on_library_changed();}
function on_library_items_changed() {on_library_changed();}
function on_library_changed() {
    //your code here
}
Title: Re: JScript Panel
Post by: always.beta on 2016-04-30 14:55:36
Thank you very much for let me know it.
Title: Re: JScript Panel
Post by: widerock on 2016-05-02 00:27:26
I'm currently using "jsplaylist-mod".

I got sometimes this error mesage.

Quote
JScript Panel (JSPlaylist v1.3.2 by Br3tt aka Falstaff >> http://br3tt.deviantart.com): Microsoft JScript Runtime Error:
'this.groups[...].collapsed' is null or not an object.
%foobar_path%\js_marc2003\jsplaylist\js\WSHplaylist.js
Line: 1926, Col: 9
<source text only available at compile time>

This happens within the podcatcher playlist when I try to change the podcast source from "Podcatcher Feed Manager" several times.
There wasn't any problem before I installed 'podcatcher plugin'.

It would be great if this can be fixed without removing 'podcatcher plugin.

Title: Re: JScript Panel
Post by: marc2003 on 2016-05-02 03:33:14
Well I don't know what has happened to Falstaff and I'm not familiar with podcatcher either. Since my internet allowance is very small/expensive, I won't be trying it.

I've still had an attempt at fixing it but can't test. Save this inside js_marc2003\jsplaylist\js

edit: stale link removed. main zip will be updated soon
Title: Re: JScript Panel
Post by: widerock on 2016-05-02 03:52:40
Well I don't know what has happened to Falstaff and I'm not familiar with podcatcher either. Since my internet allowance is very small/expensive, I won't be trying it.

I've still had an attempt at fixing it but can't test. Save this inside js_marc2003\jsplaylist\js

https://raw.githubusercontent.com/19379/jsplaylist-mod/test/js_marc2003/jsplaylist/js/WSHplaylist.js

This solved the problem perfectly. Thank you for your work.
Title: Re: JScript Panel
Post by: marc2003 on 2016-05-02 04:07:09
Good stuff. The main zip has been updated.

https://github.com/19379/jsplaylist-mod/releases

edit: only just noticed this is the component thread. To widerock and anyone else, please keep any further issues like this in the script thread...

https://hydrogenaud.io/index.php/topic,110516.0.html
Title: Re: JScript Panel
Post by: Falstaff on 2016-05-03 18:28:02
Well I don't know what has happened to Falstaff ...

I'm fine, just too busy this year to code scripts for foobar2000 ... will be back one day, but i'm still following JScript component changes ;)
Title: Re: JScript Panel
Post by: TomPro on 2016-07-04 13:01:19
Hello and thanks for this plug in. I noticed it for some days in the German user forum for foobar and began strictly began to transform my wsh scripts and while i do so i find a bug.

If you use a script with tooltip and the tooltip is shown, and then the script crashed, the tooltip stay on the window until you exit and restart foobar. If you run the script directly after crashing, and a tooltip would be activated, the you have two tooltip, because the first stayed permanent. And when the script crashed while the 2nd tooltip is showing it stays until foobar would be exit. Same with a 3rd, 4th and so on.

All these "crashed" tooltips are in front of all windows, from every opened program.

My German is no good because i am a dyslexic. Hope my German English was good enough to explain the problem.

A Little Question at the End, can i use the reload function on right click in a script like:
window.showProperties()
window.showConfigure()

Title: Re: JScript Panel
Post by: marc2003 on 2016-07-05 02:04:08
Sorry but I don't think I can fix that. I know nothing about C++ and all the features I've added were easy based on the code that was already there. All I can suggest is not using tooltips until you've fixed your scripts.

window.Reload() is already documented...

https://github.com/19379/foo-jscript-panel/blob/712fe71f3d2d85727132ca8ba85ebea0912c09b7/foo_jscript_panel/docs/Interfaces.txt#L875L876
Title: Re: JScript Panel
Post by: TomPro on 2016-07-05 10:03:00
I know nothing about C++ .
Me too, but you know how to make from an ascii c++ text a foobar component ;-). You know more then I B-).

Sorry but I don't think I can fix that. ... andall the features I've added were easy based on the code that was already there.
Because I have the dyslexic think i can't remember the exact writing of words of any language and so for programming language. So my way to program things is allways:
try and error
read the error code
look in the help files
change the mistake
try and error again....
I like spell checks ;->

Sometimes i remember some basics sometimes not. It needs a long time to program something, but i know the structure or the idea in the back, and script languages are easy cause of the compiling by running. Doing the things so, maybe it could work this way:
There is an Error work around in the script shown the red window with the :-( and the pop up of an Window (think it is from you).
I think there is a function to Dispose() the tooltip. Could it help to run these Dispose() function before you do the other things.

All I can suggest is not using tooltips until you've fixed your scripts.
That's a good Tip, thank you.

window.Reload() is already documented...
Thanks, I don't have read anything so far, that's my mistake ;-)
Title: Re: JScript Panel
Post by: marc2003 on 2016-07-05 11:17:36
I think I've fixed this. I'll post an updated component later on today.
Title: Re: JScript Panel
Post by: marc2003 on 2016-07-05 16:09:44
Code: [Select]
v1.1.4.1
- FIX: Prevent old tooltips lingering after script error.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: TomPro on 2016-07-06 08:56:13
Thanks :-D
Title: Re: JScript Panel
Post by: orbtwin on 2016-07-24 20:09:18
hello everybody...

first of all i'm totally newbie with jscript and samples...
i'm replacing old biography panel...don't work anymore downloading or showing info from last.fm

how can i download the artists bio (bio.www.last.fm.json) and picture to a custom folder? this is empty...i want to download to it 
and rename into $lower(%artist%) ...because i'm using another panel that is using this image.

thanks!
Title: Re: JScript Panel
Post by: johnbecker on 2016-08-24 02:30:05
I'm on the same boat as orbtwin, I used the biography panel mainly to fetch album art and artist bio and picture, saving them to the same folder as the file.

I tried to understand the code to see if I would be able to brute force it in a way to get the images and save the data. After a few minutes trying to make some sense out of it I realized I would not be able to just change a few lines and get what I wanted.

Can anyone share some light on how to make a simple script to do that? Something like: on song change, get data from lastfm and save to the song folder (overwriting or checking if file exists). Pretty simple, it seems. Sadly, programming anything beyond "hello world" is too hard. :(

Thanks
Title: Lastfm biographtyJScript
Post by: YOGAM on 2016-09-08 10:48:27
I guess you're talking about the lastfm biography vscript Marc2003 created.

Yes. I noticed it doesn't work anymore.
It's especially annoying because, the script also seems to randomly erase biography datas already stored in the local folder (I guess it happens when the script tries to update biography datas, and fail to do so).

Has someone an idea what might have happened ?

If it's impossible to make the script work again, I'd like, at least, find a way to avoid losing biography datas already stored in local forder (I'm quite sure that was an issue Marc2003 fixed this issue in the last version of the script he made available. Unfortunately, it's not on Github anymore, but that means there is a way to solve the "erasing datas" problem).

Thanks !
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-08 15:48:08
All I can do is show evidence of it working for me...

http://i.imgur.com/Ho17Cx0.jpg

I don't care if it doesn't work for anyone else.
Title: Re: JScript Panel
Post by: crouch on 2016-09-09 01:18:27
All I can do is show evidence of it working for me...

http://i.imgur.com/Ho17Cx0.jpg


Do you have a backup for your scripts? new to foobar2k and found out about you but couldnt do anything cause you Github was down :(

I don't care if it doesn't work for anyone else.
Title: Re: JScript Panel
Post by: kode54 on 2016-09-09 01:45:42
I think he intentionally deleted his Gists and repositories for those scripts. I do know that Wikipedia does not arbitrarily delete content unless it violates their rules somehow, and if an account holder themselves violates any rules, they usually suspend the account but don't delete anything.
Title: Re: JScript Panel
Post by: crouch on 2016-09-09 01:58:31
I think he intentionally deleted his Gists and repositories for those scripts. I do know that Wikipedia does not arbitrarily delete content unless it violates their rules somehow, and if an account holder themselves violates any rules, they usually suspend the account but don't delete anything.

so theres no way to get those scripts then?
Title: Re: JScript Panel
Post by: MachineHead on 2016-09-09 02:14:50
so theres no way to get those scripts then?

July 6 version (v4.1) here. (https://drive.google.com/open?id=0B5eq8KbiKEdFME5DWmJOcFRHRVk)
Title: Re: JScript Panel
Post by: YOGAM on 2016-09-09 08:55:00

I don't care if it doesn't work for anyone else.
Fair enough.
I would probably have put it differently, but, hey... it has the merit of being clear.
Title: Re: JScript Panel
Post by: YOGAM on 2016-09-09 08:58:00
Thank you Machinehead !
Title: Re: JScript Panel
Post by: davideleo on 2016-09-12 13:22:31
JS Smooth Playlist Manager: http://fav.me/d9g6kss (http://fav.me/d9g6kss)

Is it possible to have a transparent background with this script? Checking the pseudo transparent option in the panel configuration window doesn't seem to affect the panel appearance.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-20 11:17:00
Quote
v1.1.5
- ADD: plman.IsPlaylistLocked(playlistIndex). See interfaces.txt.
- ADD: on_playlists_changed is now called when a playlist's lock
      status changes through the use of components such as foo_utils or
      foo_playlist_attributes. See callbacks.txt
- CHG: Existing samples moved in to new "basic" subfolder.
- ADD: Add new "complete" samples folder containing some more feature complete
      samples.
- ADD: Add "jsplaylist-mod". Since Br3tt's excellent JSplaylist doesn't work
      with JScript Panel, this updated "mod" version has been created.

https://github.com/19379/foo-jscript-panel/releases

Note the added samples are only offline scripts from my previous packages. Nothing accesses the internet.
Title: Re: JScript Panel
Post by: Air KEN on 2016-09-20 12:31:17
Hi :)
Is there a problem to distribute the Wingdings 2 (wingdng2.ttf) and Wingdings 3 (wingdng3.ttf) fonts?

Wingdings 2 - Version 1.10
https://www.microsoft.com/typography/fonts/font.aspx?FMID=665
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-20 13:18:41
I've removed the fonts.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-20 18:33:29
Code: [Select]
v1.1.5.1
- ADD: Add "Open component folder" to default right click menu.
       This provides quick access to the docs and samples.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: always.beta on 2016-09-21 16:00:44
WSH Mod Plus component  is added a new interface: IGdiBitmap.StackBlur() . The effect of StackBlur is better than BoxBlur.
Could you add this interface in jscript_panel ?
Example: IGdiBitmap.StackBlur([0, 255]radius, [1, 20]core = 1);  "core = 1" represents the number of threading.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-22 11:43:26
I don't know how to do that by myself and that code isn't in the source for WSH panel mod plus on github.
Title: Re: JScript Panel
Post by: zeremy on 2016-09-22 12:40:27
I don't know how to do that by myself and that code isn't in the source for WSH panel mod plus on github.

@marc2003
It is in the devel branch.

https://github.com/ttsping/foo_uie_wsh_panel_mod_plus/commit/fa30a878fa6187fe7ecdd087bb2c04dca4f94c6f
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-22 13:02:48
Ah, thanks for that.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-22 19:25:45
Code: [Select]
v1.1.6
- ADD: IGdiBitmap StackBlur method. See docs\interfaces.txt and
       samples\basic\StackBlur.txt.
- CHG: Update ApplyMask sample.

https://github.com/19379/foo-jscript-panel/releases

There is no threads option. It should determine that by itself.
Title: Re: JScript Panel
Post by: always.beta on 2016-09-23 09:33:28
Thank you marc2003.
So, if Falstaff has time to update his script, he will be able to use the new interface in the JSS script.
Title: Re: JScript Panel
Post by: marc2003 on 2016-09-23 17:48:20
Falstaff might not want to use it!!

I'll probably update jsplaylist-mod with it though.
Title: Re: JScript Panel
Post by: tr0ner on 2016-09-30 22:19:57
Hello all,

I installed JScript Panel as a replacement to biography view and set up a window for it in columns ui.
I want to get it to automatically show album covers from the web. So I tried to import GetAlbumArtV2.txt and also album art.txt. Album covers are displayed if they are embedded into the mp3 files but it does not seem to get / display covers from the web.

Can anyone let me know what I'm doing wrong?
Thank you very much in advance.

Title: Re: JScript Panel
Post by: marc2003 on 2016-10-21 16:58:27
Code: [Select]
v1.1.6.1
- CHG: Minor changes to Console logging on startup.
- ADD: The "complete" samples folder has 2 new scripts: "thumbs.txt" and "text reader.txt"
       Thumbs allows the display/cycling of multiple images in a given folder. Text reader
       displays the contents of any plain text file. Title formatting can be used to
       specify the folder/file paths.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: WilB on 2016-11-11 19:26:58
Is it possible for JScript panel to determine whether a visualization is actually being displayed? I am particularly interested in the YouTube Video player pop-up ("View\Visualizations\YouTube Video"). I can toggle it on/off with a button, but it seems the on/off state cannot be determined. Consequently it sometimes gets out of sync with other changes in the layout view, i.e. shows when not wanted & hides when wanted.

Perhaps this would require a new callback that would cover all visualizations, if within your skill set?

Thanks for your consideration.
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-11 20:38:04
No, I don't think so. All current callbacks are provided the SDK itself and I'm almost certain nothing like that would exist for any visualisation windows - especially 3rd party ones.

I've been able to add/modify what is already there because of the existing code/notes. Hacking something together outside of that would be way beyond what I'm capable of.
Title: Re: JScript Panel
Post by: zeremy on 2016-11-12 18:53:15
Is it possible for JScript panel to determine whether a visualization is actually being displayed? I am particularly interested in the YouTube Video player pop-up ("View\Visualizations\YouTube Video"). I can toggle it on/off with a button, but it seems the on/off state cannot be determined. Consequently it sometimes gets out of sync with other changes in the layout view, i.e. shows when not wanted & hides when wanted.

Perhaps this would require a new callback that would cover all visualizations, if within your skill set?

Thanks for your consideration.

I use utils.WriteIni to save the window state (on or off).
Of course if the video window state is changed not with the button but from the menu the state gets messed-up.

Code: [Select]
//settings ini
ini_file = fb.FoobarPath + "zeremy\\settings.ini";

read_ini_video = function (k) {
return utils.ReadINI(this.ini_file, "video_window", k);
}

function vid0mode() {
video_window_state = read_ini_video("state");
video_window_mode = read_ini_video("mode");
if (video_window_state == "ON") {
utils.WriteIni(this.ini_file, "video_window", "state", "OFF");
buttons.vid0.state = ButtonStates.normal;
fb.RunMainMenuCommand("View/Visualizations/Youtube Video");
} else {
utils.WriteIni(this.ini_file, "video_window", "state", "ON");
buttons.vid0.state = ButtonStates.down;
fb.RunMainMenuCommand("View/Visualizations/Youtube Video");
}
}

Title: Re: JScript Panel
Post by: zeremy on 2016-11-13 18:20:26
In WSH Panel Mod Plus interfaces there is
STDMETHODIMP GetWND(BSTR class_name , IWindow** pp); (https://github.com/ttsping/foo_uie_wsh_panel_mod_plus/blob/master/foo_uie_wsh_panel_mod_plus/script_interface_impl.h#L595)

You can call the window class visibility state STDMETHODIMP IsVisible(VARIANT_BOOL * p); (https://github.com/ttsping/foo_uie_wsh_panel_mod_plus/blob/master/foo_uie_wsh_panel_mod_plus/script_interface_impl.h#L765) 

For Youtube Video
fb.trace(utils.GetWND("{C462426D-132B-49AB-9B10-A7F77095A356}").IsVisible());



Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-14 12:19:33
Is it possible for JScript panel to determine whether a visualization is actually being displayed? I am particularly interested in the YouTube Video player pop-up ("View\Visualizations\YouTube Video"). I can toggle it on/off with a button, but it seems the on/off state cannot be determined. Consequently it sometimes gets out of sync with other changes in the layout view, i.e. shows when not wanted & hides when wanted.

Perhaps this would require a new callback that would cover all visualizations, if within your skill set?

Thanks for your consideration.

Yeah, I feel your pain, I've a similar problem myself (not only with YT)...

PS: I will try to make some sound arguments for my feature request for Library Tree soon :)

No, I don't think so. All current callbacks are provided the SDK itself and I'm almost certain nothing like that would exist for any visualisation windows - especially 3rd party ones.

I've been able to add/modify what is already there because of the existing code/notes. Hacking something together outside of that would be way beyond what I'm capable of.

Actually, I think it could be covered by a different not visualizations-related check: we need an ability to get the state of the main menu item (e.g. whether it's checked (like radio-button-checked)), this way we can check any item we want, including visualizations. It's like CheckMenuRadioItem, but with arguments from RunMainMenuCommand.

I've found some callbacks in SDK that might be related to this (it should be the same for context menu and main menu):
https://github.com/19379/foo-jscript-panel/blob/master/foobar2000/SDK/menu_helpers.h#L13

This one looks suspiciously close to what we need.
Title: Re: JScript Panel
Post by: WilB on 2016-11-14 13:14:30
Just a heads up: since marc2003 indicated he wasn't able to add the ability to get the "visible" vs "hidden" status of visualizations, I asked 3dyd if the property could be provided by foo_youtube.  I now have test version of foo_youtube that's working well. Of course it only applies to the foo_youtube popup visualization, but in this case it should work generally - not just with JScript panel. Hopefully, it will be in the next release of foo_youtube.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-14 15:36:55
It's like CheckMenuRadioItem, but with arguments from RunMainMenuCommand.
That is wrong, there is no similar function yet.
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-14 18:47:26
Code: [Select]
v1.1.6.2
- FIX: plman.AddLocations: Original order of files in array is now maintained.
- CHG: plman.AddLocations: Progress dialog stays hidden for short operations.

https://github.com/19379/foo-jscript-panel/releases

@WilB, if you still see a progress dialog, there is nothing else I can do. The SDK function doesn't accept any other parameters that will change the behaviour.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-15 09:45:43
@marc2003 : Actually it was much simpler than that - mainmenu_commands class has get_display method, which return flags:

Code: [Select]
class NOVTABLE mainmenu_commands : public service_base {
public:
enum {
flag_disabled = 1<<0,
flag_checked = 1<<1,
flag_radiochecked = 1<<2,
flag_defaulthidden = 1<<3,
sort_priority_base = 0x10000,
sort_priority_dontcare = 0x80000000,
sort_priority_last = ~0,
};
...
virtual bool get_display(t_uint32 p_index,pfc::string_base & p_text,t_uint32 & p_flags) {p_flags = 0;get_name(p_index,p_text);return true;}
...
};

I can make a pull request with the implementation, if you want.

PS: Component fails to build under VS2015 unless I change default values from float to integer in DrawImage and FillGradRect methods in script_interface.h:
before:
Code: [Select]
__interface IGdiGraphics: IGdiObj
{
...
STDMETHOD(DrawImage)(IGdiBitmap * image, float dstX, float dstY, float dstW, float dstH, float srcX, float srcY, float srcW, float srcH, [defaultvalue(0.0)]float angle, [defaultvalue(255)]BYTE alpha);
...
STDMETHOD(FillGradRect)(float x, float y, float w, float h, float angle, VARIANT color1, VARIANT color2, [defaultvalue(1.0)] float focus);
... 
};
after:
Code: [Select]
__interface IGdiGraphics: IGdiObj
{
...
STDMETHOD(DrawImage)(IGdiBitmap * image, float dstX, float dstY, float dstW, float dstH, float srcX, float srcY, float srcW, float srcH, [defaultvalue(0)]float angle, [defaultvalue(255)]BYTE alpha);
...
STDMETHOD(FillGradRect)(float x, float y, float w, float h, float angle, VARIANT color1, VARIANT color2, [defaultvalue(1)] float focus);
... 
};
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-15 13:58:58
First of all, no changes are required to make it compile with VS2015. I use it myself.

Secondly, I have no idea what you're trying do checking menu radio/check boxes. None of the visualisations have any that you can query.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-11-15 15:14:42
First of all, no changes are required to make it compile with VS2015. I use it myself.
I dunno, may be it is system specific bug, because there was only a single report a lot of time ago in WSH Panel Mod thread with the same problem as mine: https://hydrogenaud.io/index.php/topic,70363.msg722027.html#msg722027

For some reason midl treats float values as strings when generating .idl files (i.e. it changes 1.0 to "1.0"), which results in a compile error.

Secondly, I have no idea what you're trying do checking menu radio/check boxes. None of the visualisations have any that you can query.
I've made a >>pull request<< (https://github.com/19379/foo-jscript-panel/pull/1) that hopefully is easier to understand than my rambling here =)
Title: Re: JScript Panel
Post by: WilB on 2016-11-15 16:32:12
@marc2003: Thanks for the upgrade to plman.AddLocations.

Its a great improvement. I haven't seen the progress dialogue.

However, foobar2000 add locations seems to ensure that all the added items are visible and also automatically sets focus to the first added item. Is it possible that plman.AddLocations can have, or have options, for that behaviour? As it is items can be added at the end of a playlist where they can't be seen.

I couldn't resolve this in the normal way by putting plman.EnsurePlaylistItemVisible and/or plman.SetPlaylistFocusItem after plman.AddLocations. It seemed as though plman.EnsurePlaylistItemVisible / plman.SetPlaylistFocus actually ran before the tracks were added to the playlist (e.g. I could get them to work if I used them with a short timer delay, but that's not an ideal solution).
Title: Re: JScript Panel
Post by: marc2003 on 2016-11-15 17:46:41
Yes, the operation is asynchronous which means any code in your script will run immediately without knowing or caring when it's going to finish.

However, you can detect when tracks are added to a playlist using on_playlist_items_added. Obviously you don't want code inside this triggering every time tracks are added to a playlist so you can use a variable something like this...

Code: [Select]
var focus = -1;

function add_tracks() {
    //before adding tracks, count existing ones so we know the index to select.
    focus = plman.PlaylistItemCount(plman.ActivePlaylist);
    plman.AddLocations(plman.ActivePlaylist, files);
}

function on_playlist_items_added() {
    if (focus < 0) return; //don't do anything unless we know plman.AddLocations has just run
    plman.SetPlaylistFocusItem(plman.ActivePlaylist, focus);
    focus = -1; // reset the value so this code doesn't run next time tracks are added normally
}
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-10 09:43:28
Code: [Select]
v1.1.7 Beta 1
- FIX: Remove trailing space in "Console" when using fb.Trace.
- FIX: Thumbs sample. Fix issue where using %profile% in the "Custom folder"
       setting would fail if the profile path contained special title formatting
       characters like %()[]'
- CHG: Remove "Grab focus" and "Delay load" from "Configuration" window. Both
       options are forced on for all panels. Don't want to give a panel focus?
       Don't click it! Let me know if you think "Delay load" on all panels has
       noticeable side effects.
- CHG: Some internal refactoring which is why we have a beta. I need more users
       to test I didn't break anything!

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: tedgo on 2016-12-10 12:22:03
Sorry, but force "Grab focus" to all panels without an option to disable it is a bad idea...

For example: i have some pure button panels and why should they get focus at all?
Once i click a button i am forced to click in the playlist again to give it the "focus" back or the key buttons will no longer work...
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-10 13:25:32
Fair point. It has been reverted.
Code: [Select]
v1.1.7 Beta 2
- FIX: Remove trailing space in "Console" when using fb.Trace.
- FIX: Thumbs sample. Fix issue where using %profile% in the "Custom folder"
       setting would fail if the profile path contained special title formatting
       characters like %()[]'
- CHG: Remove "Delay load" from "Configuration" window.
- CHG: Remove "Grab focus" from "Configuration" window. Beta 1 only, reverted in Beta2.
- CHG: Some internal refactoring which is why we have a beta. I need more users
       to test I didn't break anything!

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-17 21:46:41
Code: [Select]
v1.1.7
- FIX: Remove trailing space in "Console" when using fb.Trace.
- FIX: Text Reader sample. Ensure "Open containing folder" works when specifiying
       a folder rather than a full path to a file.
- FIX: Thumbs sample. Fix issue where using %profile% in the "Custom folder"
       setting would fail if the profile path contained special title formatting
       characters like %()[]'
- CHG: Remove "Delay load" from "Configuration" window.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: vanhoivanbinh on 2016-12-22 03:35:12
Thank you, Marc2000 for saving my life
the Jscript panel is so cool
I have embedded your script to my foobar2000 and it works well
One thing is that when I try to do library import for my last.fm, it seems that the playcount does not update ( i have all last.fm username, password, API )
The library import (run in seperated windows) seems no problem, no error etc but.
Right now, my last.fm playcount is higher than ones in my foobar2000 library
Moreover, the love function is gone
Previously, I have removed the custom_db component as it's making never-ending-crash 

Could you advice what should I do for this situation

Thank you!!!!!!!
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-24 03:57:02
Well foo_customdb was never optional - it was absolutely essential to make it work. Anyway, it doesn't matter as I don't support that script any more. Use foo_softplaylists to love/unlove tracks.
Title: Re: JScript Panel
Post by: extratype on 2016-12-25 16:04:23
Found a bug where ALL windows freeze, so I have to force restart the system.
I did some experiments and concluded gr.gdiDrawText is a culprit... or maybe Windows.

Steps to reproduce:
1. Windows 10 version 1607 x64
2. Install this skin: http://alibalicou.deviantart.com/art/Eole-608641604
3. Play a music with title containing some non-ANSI characters.
(ex) Track title: ごめんね、いいコじゃいられない。 Album title: TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」
4. Repeatedly minimze and restore the foobar2000 window.
Tested on both real/virtual machine.

EDIT: I was unable to reproduce this bug in Windows 7 x64. So this bug is due to Windows 10... well how do I report it to Microsoft and let they fix it? sigh...
Title: Beginner Questions
Post by: vince_57 on 2016-12-26 04:34:54
Thank you for a fantastic foobar component.
Using your complete sample playback buttons, I added a mute button (don't laugh - took me about 2 days and a JavaScript reference book)
As someone who knows nothing about jscript, I would appreciate knowing if what I did makes "sense" or is there a much better/cleaner way to achieve this type of button (display a different image depending on the state & change the tooltip depending on the state). Here is what I did:
1) Defined new variables:
Code: [Select]
var WhichMute = "buttons\\mute.png"; //Initialize the mute button to Not Muted image
var IsMuted = false; //Initialize mute stae = Not muted
2)Added a new button to buttons.update function:
Code: [Select]
 
this.buttons.mute = new _.button(bs*5, 5, bs, bs,
{normal : WhichMute},
function () { MyVolumeMute(); },
IsMuted ? "Mute On" : "Mute Off");
3) Add a function to determine the current volume state & set the desired image
Code: [Select]
function MyVolumeMute()
{
if(fb.Volume == -100)
{
     WhichMute = "buttons\\mute.png";
fb.VolumeMute();
IsMuted = false;
}
else
{
WhichMute = "buttons\\muted.png";
fb.VolumeMute ();
IsMuted = true;
}
buttons.update();
window.Repaint (); //If I don't do this, icon does not change unless I move mouse off image
}

Thanks for your help.




Title: Re: JScript Panel
Post by: marc2003 on 2016-12-26 06:12:54
@extratype, Not that I can do anything because I don't have windows 10, are you able to reproduce with a single instance of JScript panel in your layout containing just this code?

Code: [Select]
var font = gdi.Font("Segoe UI", 16); // assuming Segoe UI is still default on 10??

function on_paint(gr) {
    gr.GdiDrawText("Track title: ごめんね、いいコじゃいられない。 Album title: TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」", font, 0, 0, 0, window.Width, window.Height, 0);
}

@vince_57, I really need to add some notes about customising buttons that would help people out.

First of all, those relative paths should only be used for images I bundle with the component. If you upgrade the component, any of your own custom images added to those folders would be lost. Instead, you should keep your images folder separate and specify the full path to it. My button code is already designed to handle full paths or my own relative paths.

Code: [Select]
{normal : fb.ProfilePath + "my_images\\mute.png"}

Always use fb.ProfilePath as that points towards your configuration folder (%appdata%\foobar2000) in normal installation mode or the program folder in portable mode. Obviously you'll need to create the folders/move images as necessary.

As for your own button, it does have issues.

1) You're assuming the volume is always going to be unmuted when the script initialises. I think this is a mistake.
2) There are so many different ways of changing the volume such as using keyboard shortcuts, sliders, media keys, other buttons, scrolling your mouse over the volume indicator on the status bar etc...

It seems you missed the clues already included with the script for how the play/pause button updates itself without special code inside the button click function. Note the on_playback_starting, on_playback_pause and on_playback_stop functions.

Code: [Select]
function on_playback_stop() {
buttons.update();
window.Repaint();
}

function on_playback_pause() {
buttons.update();
window.Repaint();
}

function on_playback_starting() {
buttons.update();
window.Repaint();
}

All these functions prefixed with on_ are special functions called callbacks and they are triggered by foobar itself no matter how the playback state changes. Again there are many more ways than just clicking your own custom button.

Luckily there is one for when the volume changes so we just need to copy the same code in to it...

Code: [Select]
function on_volume_change() {
buttons.update();
window.Repaint();
}

So now you can simplify your button back to something like...

Code: [Select]
    this.buttons.mute = new _.button(bs * 4, 0, bs, bs, {normal : fb.Volume == - 100 ? fb.ProfilePath + "my_buttons\\muted.png" : fb.ProfilePath + "my_buttons\\mute.png"}, function () { fb.VolumeMute(); }, fb.Volume == - 100 ? "Unmute" : "Mute");




Title: Getting Started With JScript (Customizing Buttons)
Post by: vince_57 on 2016-12-26 16:33:07
marc2003;
Thank you for your response - I just "felt" like my way to add a button was a bit funky.
It seems like your JScript Panel is designed for folks who are already knowledgeable and not for rank beginners like me (I did some programming in Fortran and C, in a non-GUI environment many, many years ago).
So, for someone like me who does not know JavaScript, or Windows "event driven" programming, or C++, or etc, would you say to them:
1)You are in way over your head & should stop asking questions
2)You need to 1st learn x,y,z  topics (here are some good references), then understand the JScript Panel and foobar specific implementation by studying a,b,c, and then come back to this forum
3) Something else?
Thanks
==================================================================
Just to show you how confused I am, here are my notes as I was installing/experimenting with JScript Panel
JScript Panel is a component for foobar2000 (aka fb2k)
After installing JScript Panel component, it is added to the fb2k window by right-click on an available (or create a new) fb2k panel, and in the Add New UI Element dialog, go to the section Utility, and select JScript Panel.
JScript panel allow you to create and run programs written in the Microsoft JScript language ?
JavaScript is a programming language available in web browsers  (Internet Explorer, Firefox, etc). The web browser contain a JavaScript interpreter to parse and run the JavaScript programs, which can be written in plain text with a simple text editor like notepad. JScript is a Microsoft implementation of JavaScript.
JScript Panel statements use the same syntax as the JavaScript language (?)
JScript Panel does not support all of the standard functions available with javascript, because javascript assumes it is running within a web browser(?)
For example, if you  enter & run the following code in the JScript Panel Configuration, you will get the "Aw, crashed :(" display:
alert("Hello World");
The error message states: The value of the property 'alert' is null or undefined, not a Function object.
It would seem logical that any JavaScript statement related to html would also not work in JScript Panel

foobar components are implemented as a .dll file. The name always starts with foo_.
The actual JScript panel component is foo_jscript_panel.dll and is located in the folder \user-components\foo_jscript_panel\.  The location of the folder \user-components depends on whether foobar was installed as a "Standard Installation" or "Portable Installation"
The DLL for JScript Panel (foo_jscript_panel.dll) is 2 to 3 times larger most of the foobar2000 system installed DLLs (foo_albumlist.dll, foo_converter.dll, etc)
Filetypes
A .js file is a javascript file. A .js filetype will be interpreted by JScript panel, and the javascript commands executed
A .txt file is a text file which can contain javascript statements or just "normal" text
If you paste the contents of a .txt file which contains javascript statements into the JScript Panel Configuration, or Import the .txt file containing javascript statements, it has effectively become a .js file

What programming language is used in JScript Panel:
What is the ECMA Script engine used by JScript panel?
In the JScript Panel Configuration there is an option for Script Engine: JScript9 or JScript, which seems to indicate the engine is the Microsoft JScript IE9-11 or some earlier version of Microsoft JScript (5.8?)
But when I look at the file, jscript.api, it shows "http://developer.mozilla.org/en/docs/Core_JavaScript_1.5", which seems like the earlier version of JavaScript from Mozilla as implemented in Firefox 1.0?

If I want to learn the basic syntax, etc of the scripting language used in JScript Panel, should I study a reference on JScipt Version 9, JavaScript, JavaScript Version 1.5, or something else?

Where is the ECMA Script engine used by JScript panel?
Is the engine built into JScript Panel or does JScript panel use some engine already installed elsewhere?

I am confused about the various files included with JScript panel, particulalrly about .txt files which are not code (and can't be used in a script) and .txt files which really are code (and can be pasted in the jScript Panel Configuration window or imported when my script is run).
In the foo_jscript_panel folder there are several files and sub-folders:
\docs: Contains .txt files
\samples
CHANGELOG.txt: List of JScript Panel versions and changes/fixes made in each version
foo_jscript_panel_dll: The actual JScript Panel Panel component
interface.api: A list of the custom functions available in JScript Panel (not part of the javascript language). These are the JScript panel functions which interface with foobar2000 and Windows (the operating system)
jscript.api: A list of the javascript language functions available in JScript Panel. Not all of the javascript functions are made available in JScript Panel
Both of the .api files (interface.api and jscript.api) are not code, and are not needed for JScript panel to work.  I think they are documenting what is made available in JScript panel
LICENSE.txt: License info. for the JScript Panel program.
License - <Name>.txt : License information for any samples included in the JScript Panel installation. For example: LICENSE - BoxBlurFilter.txt is the livcense info. for the sample script BoxBlur.txt

Looking at the files in the \docs directory:
What is the purpose of the file jscript.api?
Is this file for documentation only & is a complete list of jscript (javascript?) APIs supported by JScript panel?

What is the purpose of the file interface.api?
Is this file for documentation only & is a complete list of the non-jscript/javascript APIs supported by JScript panel?
Is the naming convention in interface.api an indication of what the "actual" API & SDK is?
fb. = Functions that interface to foobar2000 APIs. Normally, accessing these functions requires the SDK for that program and a program (written in C++?) to call the fb2k SDK API
gdi. = Functions that interfaces to various classes in the Windows SDK .GDI(+?) API
gr. = Same as gdi. but are used "in on_paint" (?)
plman. = interfaces to foobar2000 SDK playlist_manager Class API
window. = interfaces to the Microsoft Windows SDK API

What is the purpose of Flags.txt?
Some of the Windows APIs allow for multiple values in a parameter. This file lists those APIs supported by JScript which use these multiple-value parameters.
Using the first line in flags. txt as an example:  // Flags, used with GdiDrawText()
The values shown should be used whenever I use GdiDrawText() in a script. Does this actually apply to  gr.GdiDrawText (as listed in interface.api)?
Each line like: var DT_TOP = 0x00000000;  sets the value for each of the parameter mutliple values.

It looks like, I can import the entire flags.txt or just use the parts of flags.txt for the APIs I actually use in the script?

What is the purpose of the file interface.txt?
Is this file for documentation only and shows the details of the available "methods" & parameters used by each JScript Panel API?
It looks like the interface "groupings" match to the names used in interface.api. So:
interface IFbUtils {.. Is the I(nterface) for Fb(2k) for the Utils group

What is the purpose of Helpers.txt?
This file shows some potentially "helpful" code that can be used in a script. This helpful code includes:
-The values needed to set a specific color color - allows a script to specify a color using a nice English description like "Aqua" instead of 0xFF00FFFF.
-Useful "standalone" functions not related to another function?? For example:?
-"Helper" functions. " A helper function is a function that performs part of the computation of another function. Helper functions are used to make your programs easier to read by giving descriptive names to computations. They also let you reuse computations, just as with functions in general."
For example, the function in helpers.txt function stringFormat(), looks like it sets values for the optional parameter flags, as used in the gr.DrawSting API?

What Is the purpose of Callbacks.txt?
Is this file for documentation only and lists the "callback" functions available in JScript Panel?
"A callback function, also known as a higher-order function, is a function that is passed to another function (let’s call this other function “otherFunction”) as a parameter, and the callback function is called (or executed) inside the otherFunction."
For example, in the callbacks.txt is the line: function on_mouse_move(x, y, mask) {}
In one of the sample scripts, playback buttons.txt,  is the line: function on_mouse_move(x, y) {buttons.move(x, y);}
So the playback buttons script is calling the (callback) function on_mouse_move and passing the function buttons.move as a parameter to on-mouse_move ?
From marc2003: All these functions prefixed with on_ are special functions called callbacks and they are triggered by foobar itself no matter how the playback state changes.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-12-26 20:14:39
@marc2003 The Win 10 default system font is Verdana.
Title: Re: JScript Panel
Post by: Jailhouse on 2016-12-26 20:25:03
If I want to learn the basic syntax, etc of the scripting language used in JScript Panel, should I study a reference on JScipt Version 9, JavaScript, JavaScript Version 1.5, or something else?
I learned from w3schools.com's JavaScript tutorial (http://www.w3schools.com/js/). Search on "learn javascript" to find other sources.
Title: Learning Java
Post by: vince_57 on 2016-12-26 22:35:31
I learned from w3schools.com's JavaScript tutorial (http://www.w3schools.com/js/). Search on "learn javascript" to find other sources.
Jailhouse: Thanks for the link.
Is it correct to say that certain elements of JavaScript do Not work in JScript panel?
Specifically:
1) Anything to do Output (alert, write, etc)
2)Anything to do with Debugging (console.log, debugger)
3) Anything which involves HTML, Browser, Ajax, or JSON
Title: Re: JScript Panel
Post by: vanhoivanbinh on 2016-12-27 01:49:41
Well foo_customdb was never optional - it was absolutely essential to make it work. Anyway, it doesn't matter as I don't support that script any more. Use foo_softplaylists to love/unlove tracks.
Thank you, Marc2000 for you kindly answer
What would happen for the playcount sync between Last.fm and foobar2000 in the JScript?
Do you plan to bring that function back?
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-27 05:13:44
@vince_57

The jscript/interface api files exist only to provide auto-complete functionality when typing in the configuration window. You should ignore them.

(https://i.imgur.com/0MI9P3o.png)

As for javascript language support, yes we are stuck several generations behind what current javascript developers are working with. We are stuck with JScript 5.8/Javascript 1.5. This is basically IE8 levels of support. While the JScript9 option in the configuration window can provide slightly faster performance, there are no language improvements or changes.

While we don't have functions like alert or console.log, we do have alternatives. We can output message to the foobar2000 Console using fb.trace(message);. If you really wanted to, you can use this little snippet to have console.log available...

Code: [Select]
var console = {
log: function (msg) {
fb.trace(msg);
}
};

console.log("Hello world!");
console.log(2 * 5);

You can display popup windows using this bit of code...

Code: [Select]
fb.ShowPopupMessage("hello");
//code here will execute immediately even with the popup window still open

If you want the behaviour to more like alert, you can do this:

Code: [Select]
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.popup("hello", 0); //0 is the code for displaying just an OK button
//code here won't execute until the window is dismissed.

There is no problem with making web requests and working with JSON. I do this a fair bit myself such as using the musicbrainz API like this...

http://i.imgur.com/pu2wL2W.png

Of course when it comes to displaying text in the panel itself, this is only possible using the gdiDrawText or DrawString functions which are C++ but we can pass text, fonts, colours, etc via our script.

Do you plan to bring that function back?

No.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-27 12:26:54
We are stuck with JScript 5.8/Javascript 1.5. This is basically IE8 levels of support.
I think, I might be able to add full JScript9 support to JScriptPanel by wrapping all the JSRT API calls into WSH style calls. This will come at the cost of losing support of Windows versions below Windows 7 though. But we will have much more up-to-date JScript =)
Title: Re: JScript Panel
Post by: arch21 on 2016-12-27 12:54:50
hi, how to access installation path for import? so far, I only notice %fb2k_profile_path% and also %fb2k_component_path%.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-27 13:17:54
hi, how to access installation path for import? so far, I only notice %fb2k_profile_path% and also %fb2k_component_path%.
%fb2k_path%
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-27 13:21:17
docs\preprocessors.txt (https://github.com/19379/foo-jscript-panel/blob/133af6edb43598179cc7dd60ea4f4135a2a92457/component/docs/Preprocessors.txt#L18L19)

Using %fb2k_path% really isn't advisable though. %fb2k_profile_path% already points at the program folder when using foobar2000 in portable mode and you shouldn't be placing user files inside program files\foobar2000 if using standard mode.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-27 15:14:12
@marc2003: there is actually a simpler way to enable JScript9 (though probably only features from old Chakra engine(i.e. ECMA5 and not ECMA6) are available):

When using cls id for JScript9 you also must change JS language version to a higher value (it might not available on windows lower than Windows 7)

foo_jscript_panel\host.cpp:
ScriptHost::InitScriptEngineByName
Line 892: scriptLangVersion.lVal = SCRIPTLANGUAGEVERSION_5_8;

SCRIPTLANGUAGEVERSION_5_8 (which is 2) should be replaced by 3

Tested with Date.now() and String.prototype.trim() methods, that are not available in the ECMA3 and consequently in the current JScriptPanel build.

Getting ECMA6 will be much harder, because it requires to either rebase whole JScriptPanel on JSRT or make a WSH wrapper around JSRT (which will be slower than the former). Both are feasible, but since ECMA6 (i.e. new Chakra engine) is available only on Windows 10, I don't think I'll bother with it for now, because my main PC is Windows 7 =)

PS: I've not yet tested on Windows 7 though, but it should work, since old Chakra(ECMA5) is available via jscript9.dll, which is supplied with IE11, which is available on Win7. New Chakra engine (ECMA6) is Win10 exclusive, because the corresponding chakra.dll is supplied only with Edge.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-27 15:54:44
Assuming that all works out, that's a really nice find. Thanks. I'll do some testing later/tomorrow.

I'm using windows 8.1 myself and have no interest in windows 10.
Title: More Basic Question
Post by: vince_57 on 2016-12-27 19:35:49
@marc2003
Please don't do anything that would break JScript Panel on Windows7 (I use Win7Pro).
Since you didn't reply to my questions with "1)You are in way over your head & should stop asking questions"  :( , I have some more newbie questions.
1) Is it correct to think of JScript Panel as an SDK for foobar and Windows? That is, in addition to supporting javascript/jscript statements, JScript Panel has it's own APIs which allow me to interface to the foobar2000 SDK API's and the Windows SDK API's.
2)Thanks for clarification on the purpose of the .api files. Should I be using Interfaces.txt as my reference to all available JScript Panel APIs (similar to the Windows API Index at https://msdn.microsoft.com/en-us/library/ff818516(v=vs.85).aspx) ?
3)I did not really understand your discussion with TheQwertiest about JScript9, but it seems like the answer to the question "Where is the ECMA Script engine used by JScript panel?" is that the Script engine is built into JScript Panel & does not depend on any external engine (web browser). ?

The WScript.Shell "object" (?) is cool. I found some info at TechNet, and used WshShell.run to kick off another application from within JScript Panel!
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-28 06:16:24
@TheQwertiest, it works on Vista with IE9 so that's an added bonus. And no code changes are required if it's not supported. I tested Vista with IE7 and that works as expected without the extra goodies.

@vince_57, no I won't be breaking windows 7.

1) pretty much
2) yes, interfaces.txt and callbacks.txt are the most important files in the docs folder
3) until now, the underlying browser didn't really matter except the minimum requirement for working with the native JSON object was IE8. With the upcoming changes, IE9 or later will be required to use the newer ES5 features. like function.prototype.bind and array.prototype.map. I'll list more when I publish the updated component.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-28 09:41:46
it works on Vista with IE9 so that's an added bonus. And no code changes are required if it's not supported. I tested Vista with IE7 and that works as expected without the extra goodies.
That's good to hear!
Does anyone still uses Win Vista nowadays? =)

Btw, changing JS version to 3 via SetProperty only makes sense, when ScriptEngine is set to JScript9, otherwise it won't do anything (i.e. it won't enable ES5).
So, I think moving SetProperty under if (wcscmp(engineName, L"JScript9") == 0) might be a good idea.

And if I may, a few suggestions to consider:
1. Removing fallback to JScript in InitScriptEngineByName and returning error instead. So the component users won't think that JScript9 is enabled, while it is actually not.
2. Adding additional comboboxes to ScriptEngine dialog: smth like JScript9 (ES3 + json) and JScript9 (ES5).
3. Adding IE version detection, so ScriptEngine dialog could show only available ScriptEngines (JScript9 (ES5) and JScript for IE >= 9, JScript9 (ES3 + json) and JScript for lower versions).

If you want, I can make a PR for those.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-28 10:14:02
I've already made the changes (https://github.com/19379/foo-jscript-panel/commit/a39c3d56d23a93f80fccbfbebb97f9e309509234). The combo box is gone and JScript9+ES5 will be default for everyone if it's available. This is probably going to be 99.99% of users.

I've renamed the function because it doesn't take an "engineName" parameter any more.

https://github.com/19379/foo-jscript-panel/blob/a39c3d56d23a93f80fccbfbebb97f9e309509234/foo_jscript_panel/host.cpp#L846

As I mentioned already, the fallback works fine on Vista with IE7 (JScript 5.7) even with your change.

edit: you will get full credit for this on the releases page and in the changelog.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-28 10:30:10
I've already made the changes (https://github.com/19379/foo-jscript-panel/commit/a39c3d56d23a93f80fccbfbebb97f9e309509234). The combo box is gone and JScript9+ES5 will be default for everyone if it's available. This is probably going to be 99.99% of users.

I've renamed the function because it doesn't take an "engineName" parameter any more.

https://github.com/19379/foo-jscript-panel/blob/a39c3d56d23a93f80fccbfbebb97f9e309509234/foo_jscript_panel/host.cpp#L846

As I mentioned already, the fallback works fine on Vista with IE7 (JScript 5.7) even with your change.
Great minds think alike 8)

edit: you will get full credit for this on the releases page and in the changelog.
Thanks! Glad to be of help =)
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-28 15:45:19
Great minds think alike 8)

What I did was the complete opposite of what you said!!  :o

Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-28 15:56:04
What I did was the complete opposite of what you said!!  :o
Yeah, I should stop replying before waking up completely... By the time I noticed the incongruity of my reply, it was too late to edit my post -_-""
Title: Callbacks.txt Basic Questions
Post by: vince_57 on 2016-12-29 04:35:39
Spent most of the day reading about Windows User Interface, Messages , & Message Queues.
I used your fb.ShowPopupMessage in most of the various callbacks defined in callbacks.txt, like:
Code: [Select]
function on_mouse_lbtn_down()
{ fb.ShowPopupMessage ("Code invoked when mouse left button is pressed: See function on_mouse_lbtn_down");}

function on_volume_change()
{   fb.ShowPopupMessage("Code Invoked When Volume Changes: See function on_volume_change", "Volume Changed", 1);}
to test what I think was going on (When I did this for function on_paint() I locked up foobar with a never-ending display of popups  :o )
I have some "sanity" test questions I would appreciate help with:
Using the specific JScript Panel callback of  function on_mouse_lbtn_down(x, y, mask) {}:
1) Is this callback the JScript Panel equivalent of the Windows message WM_LBUTTONDOWN?
2) Are the x,y values the same as the "lparam" parameter after being processed by GET_X_LPARAM and GET_Y_LPARAM?
3) Is the mask value the same as the "wParam" parameter, and is that what is being defined in Flags.txt in the section "// Mask for mouse callbacks"
4) The Windows MSDN docs. describes a bunch of coding that a Windows program needs to do for WM_LBUTTONDOWN.
Is JScript Panel taking care of all this coding under the covers, and providing the (much) gentler/kinder "on_mouse_lbtn_down"?
Here is what MSDN says happens when the left mouse button is pressed:
    The operating system places a WM_LBUTTONDOWN message on the message queue.
    Your program calls the GetMessage function.
    GetMessage pulls the WM_LBUTTONDOWN message from the queue and fills in the MSG structure.
    Your program calls the TranslateMessage and DispatchMessage functions.
    Inside DispatchMessage, the operating system calls your window procedure.
    Your window procedure can either respond to the message or ignore it.

Assuming I understand, I have a greater appreciation  :) for what your code is doing to make these callbacks user friendly  (I don't need to write code for a message queue, no code for translate/dispatch message, no code to separate out the x,y values, etc.)
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 08:46:46
Code: [Select]
v1.2.0 Beta 1
ADD: If your computer has IE9 or later installed, newer ECMAScript5 features
     are now available. Many thanks to TheQwertiest for discovering how to do this.
CHG: The "JScript engine" option has been removed from the "Configuration" window.
     JScript9 is always used if available but will fall back if not.
ADD: utils.version reports the component version. See docs\interfaces.txt.
FIX: A previous window.RepaintRect bug with JScript9 reported by Wilb has now been fixed.

https://github.com/19379/foo-jscript-panel/releases

Forcing JScript9 may reveal previously unknown bugs - that's why this is a beta! Please report any problems.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 08:48:31
@vince57, have a look at...

https://github.com/19379/foo-jscript-panel/blob/a39c3d56d23a93f80fccbfbebb97f9e309509234/foo_jscript_panel/js_panel_window.cpp#L846
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-29 10:32:43
Forcing JScript9 may reveal previously unknown bugs - that's why this is a beta! Please report any problems.
With my scripts the only changes I've noticed are stricter rules on Java Script: some implicitly declared variables have their visibility scope reduced, which resulted in errors; calls to named IIFE started to work inconsistently, i.e. sometimes calling IIFE may result in Undefined function error. Both are considered bad practices though =)

I could not find any meaningful difference performance-wise with ES3 Jscript9, probably because Script Engine language version only limits available keywords.

PS: And it seems that, despite all the other ES5 features being implemented, Strict Mode (i.e. "use strict" ) is still not supported by the engine =(
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 11:00:15
For those you who have a string.prototype.trim "polyfill" in your own scripts, you may wish to check and use the native version if it's present...

Code: [Select]
if (!String.prototype.trim) {
String.prototype.trim = function () {
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
};
}

If you know you're using IE9 or later everywhere, you could remove it entirely.

Here's some of the other ES5 stuff available...

https://msdn.microsoft.com/library/ff974378.aspx#_ecmascript
Title: Re: JScript Panel
Post by: zeremy on 2016-12-29 11:46:23

Forcing JScript9 may reveal previously unknown bugs - that's why this is a beta! Please report any problems.

stricter rules on Java Script have broke jsplaylist-mod from your sample directory.
Tested on clean foorbar2000 installation 1.3.14 with Win10.
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 12:01:25
Argh, that would be crazy Falstaff's coding style   :D

Code: [Select]
if (something) {

}; else { // <--this semi-colon is the problem

}

Thanks for spotting. I guess testing all included scripts would have been a wise idea.
Title: Re: JScript Panel
Post by: zeremy on 2016-12-29 12:05:15
Argh, that would be crazy Falstaff's coding style  :D

Code: [Select]
if (something) {

}; else { // <--this semi-colon is the problem

}

Thanks for spotting. I guess testing all included scripts would have been a wise idea.

And

Code: [Select]
  try {
                 }; catch(e) {          
                };
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 12:13:01
All fixed. Changes will be uploaded soon.
Title: Re: JScript Panel
Post by: extratype on 2016-12-29 13:45:50
@marc2003 From your suggestion I realized the bug occurs only during playing, so I tracked every settings related to playing.
Through dozens of test sessions I tried to find the exact triggers to the bug.

1. Install foobar2000 and jscript panel plugin. (Columns UI not required)
2. Leave a jscript panel and delete everything else.
3. Configure the panel
font = gdi.Font("Segoe UI", 12);
function on_paint(gr){
   gr.GdiDrawText("井美空  -  TVアニメ「キルラキル」ED", font, 0, 0, 0, window.Width, window.Height, 0);
}
4. Rename the foobar2000 window title by setting the title format or forcing with an external tool: 沢
5. Repeatedly minimze and restore the foobar2000 window.

The original window title from the Eole skin was:
沢井美空  -  TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」  -  01 : ごめんね、いいコじゃいられない。  -  2013
If the above steps don't work, use this for the GDI text and the window title. It's more likely for Windows 10 to freeze. Also the font size should be 11 or 12. FYI, I used Windows 10 Enterprise x64 build 14393.576 Korean.

A workaround for now is just to fix the foobar2000 window title. I set the title format just "foobar2000"
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 15:07:08
Well like I said, I don't have windows 10 so can't investigate myself. At least you have a workaround.

@zeremy I've updated the component on github with a fixed jsplaylist. The version hasn't been bumped because there are no component changes.

I checked and Falstaff/Br3tt's JS Smooth scripts on deviantart have the same issue. Users of those should avoid this component for now.
Title: Re: JScript Panel
Post by: TheQwertiest on 2016-12-29 15:32:37
Through dozens of test sessions I tried to find the exact triggers to the bug.
I could not reproduce it on Windows 10 Enterprise x64 build 10586.713. It might be caused by different version of Windows or 3rd party software.
Test theme:
Spoiler (click to show/hide)

Title: Re: JScript Panel
Post by: extratype on 2016-12-29 15:57:27
I could not reproduce it on Windows 10 Enterprise x64 build 10586.713. It might be caused by Windows or 3rd part software.
Spoiler (click to show/hide)
Oops, I was a bit speculative, I can't reproduce it on a fresh install.
UPDATE: The bug occurred after updated to 14393.576 but suddenly disappeared after a forced reboot.
Title: JScript Panel Beta1 V1.2.0
Post by: vince_57 on 2016-12-29 17:27:35
1)Just installed V1.2.0 Beta1 and noticed that in \samples\complete\js, playback buttons is missing. Any reason why this sample was removed (I used the V1.1.7 sample, changed the icons, & added a few more buttons as a sort of control panel for my foobar layout)?
2) Maybe a silly question, but I have to ask: Have you thought about/is is "possible" to separate JScript panel from foobar & make it a standalone program?  I am using using your code to learn JavaScript, understand windows & other non-foobar stuff.  It would be really cool to allow folks to write JScript programs which can create a window & use your "friendly" APIs without having to learn C++.
3)Thanks for the js_panel_window.cpp - I had no idea you made your source code available.  I don't "speak" C++, but this answers many questions I had about the callbacks.


Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 17:39:23
1) It was never in the \js folder. It's in the parent folder along with all the other samples.
2) Nope. Perhaps look at something like autoit..  https://www.autoitscript.com/site/autoit/
3) Well it's not really my code. Someone else wrote 99% of it. I just maintain it since they abandoned it years ago.
Title: Re: JScript Panel
Post by: vince_57 on 2016-12-29 17:54:11
@marc2003
Quote
It was never in the \js folder
:-[ Sorry, I renamed your sample to .js so I could import it during the preprocessor & use Notepad++ to see the code better

Is there a better/easier way to write/debug scripts? Currently, I have a foobar widow with like 20 JScript panels, each having different code.
I use Notepad++ to edit the code, then go to the foobar panel with the changed code, right-click & select reload to see what I messed up.
Is there a way to sort of pre-interpret the code for stupid mistakes (missing }, ; , etc) 1st, without having to reload the JScript panel
Title: Re: JScript Panel
Post by: marc2003 on 2016-12-29 17:59:32
You can get Notepad++ to highlight .txt files like .js files. It also makes the docs easier to read. Go to Settings>Style Configurator and select Javascript in the left column. Now add txt to the user ext: box.

(https://i.imgur.com/RF9Romz.png)

Title: Re: JScript Panel
Post by: vince_57 on 2016-12-29 18:06:16
Thanks for the Notepad++ tip!
So do you develop/debug your own scripts using the 1."Edit code in notepad++", 2,"Reload JSctipt Panel in foobar" method?
Title: Re: JScript Panel
Post by: extratype on 2016-12-30 08:48:09
It turns out I have missed one more step: go to taskbar settings, set combine taskbar buttons option to combine when taskbar is full
Alternatively add this to registry and restart the explorer:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced]
"TaskbarGlomLevel"=dword:00000001

That's it! I could reproduce the bug also in build 14393.0
It is easier to trigger it when
沢井美空  -  TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」  -  01 : ごめんね、いいコじゃいられない。  -  2013
is used for both gdi text and window title
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-01 07:35:21
Code: [Select]
v1.2.0 Beta 2
ADD: If your computer has IE9 or later installed, newer ECMAScript5 features
     are now available. Many thanks to TheQwertiest for discovering how to do this.
CHG: The "Script engine" option has been removed from the "Configuration" window.
     The newer Chakra engine is always used if available but will fall back to
     JScript if not.
ADD: utils.version reports the component version. See docs\interfaces.txt.
CHG: Minor tweaks to Configuration window.
FIX: Update samples\jsplaylist-mod so it works with Chakra engine. Thanks to zeremy
     for reporting.
FIX: A previous window.RepaintRect bug reported by Wilb has now been fixed.
FIX: Zap a few more compiler warnings.

Using the Chakra engine may reveal previously unknown bugs - that's why this is a beta!

Some of the newer ECMAScript5 features are documented here: https://msdn.microsoft.com/library/ff974378.aspx#_ecmascript

As mentioned in the script thread, I've updated Falstaff/Br3tt's JS Smooth scripts here: https://github.com/19379/JS-Smooth-Scripts-By-Br3tt

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: always.beta on 2017-01-01 14:51:44
Could you add the console to the configuration window? Like wsh plus. That would be more convenient.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-02 00:19:10
Nope. There is nothing wrong with the existing Console window/panels.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-01-07 10:15:47
You can get Notepad++ to highlight .txt files like .js files. It also makes the docs easier to read. Go to Settings>Style Configurator and select Javascript in the left column. Now add txt to the user ext: box.

(https://i.imgur.com/RF9Romz.png)

The original docs from Wang.T.P is in Java syntax. If you referred to the first line of `interface.txt` you would find the format settings there.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-01-07 10:17:46
Could you add the console to the configuration window? Like wsh plus. That would be more convenient.

I just think that JS Panel does not need to be the same with WSH Panel Plus....
Marc seems to make it simple and I agree it's good.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-09 01:05:26
v1.2 has been released - no changes from Beta2 except there is no expiration.

Code: [Select]
ADD: If your computer has IE9 or later installed, newer ECMAScript5 features
     are now available. Many thanks to TheQwertiest for discovering how to do this.
CHG: The "Script engine" option has been removed from the "Configuration" window.
     The newer Chakra engine is always used if available but will fall back to
     JScript if not.
ADD: utils.version reports the component version. See docs\interfaces.txt.
CHG: Minor tweaks to Configuration window.
FIX: Update samples\jsplaylist-mod so it works with Chakra engine. Thanks to zeremy
     for reporting.
FIX: A previous window.RepaintRect bug reported by Wilb has now been fixed.
FIX: Zap a few more compiler warnings.

Some of the newer ECMAScript5 features are documented here: https://msdn.microsoft.com/library/ff974378.aspx#_ecmascript

As mentioned in the script thread, I've updated Falstaff/Br3tt's JS Smooth scripts here: https://github.com/19379/JS-Smooth-Scripts-By-Br3tt

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-01-09 09:21:41
It turns out I have missed one more step: go to taskbar settings, set combine taskbar buttons option to combine when taskbar is full

It is easier to trigger it when
沢井美空  -  TVアニメ「キルラキル」EDテーマ -「ごめんね、いいコじゃいられない。」  -  01 : ごめんね、いいコじゃいられない。  -  2013
is used for both gdi text and window title

Still could not reproduce on 10586.713 even with your additional changes to scenario :\
Most likely it is a MS bug, but I don't have the latest Win10 ISO on hand, so I can't test it thoroughly.
Title: Re: JScript Panel
Post by: evillive on 2017-01-20 20:28:54
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-01-20 21:50:54
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: evillive on 2017-01-21 10:25:00
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
https://github.com/19379/foo-jscript-panel/releases
Ther's no foobar component only source code, I'm not familiar with compiling etc. Can someone uplod 1.1.7 foobar component? Thanks in advance.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-21 11:25:07
Well I don't have any old versions lying around and I don't have Visual Studio installed at the moment.

Can you post an example of a script you're having problems with? By "unstable", do you mean script errors (Aw, crashed) or something a lot more serious like affecting/crashing foobar itself?

edit: if you really must go back, this theme contains v1.1.6

http://tedgo.deviantart.com/art/DarkOne4Mod-v1-637189138

Using 7-zip, browse inside the 7z file then inside the .bck file within.
Title: Re: JScript Panel
Post by: evillive on 2017-01-21 12:22:00
Well I don't have any old versions lying around and I don't have Visual Studio installed at the moment.

Can you post an example of a script you're having problems with? By "unstable", do you mean script errors (Aw, crashed) or something a lot more serious like affecting/crashing foobar itself?

edit: if you really must go back, this theme contains v1.1.6

http://tedgo.deviantart.com/art/DarkOne4Mod-v1-637189138

Using 7-zip, browse inside the 7z file then inside the .bck file within.

Thanks!
My foobar is highly customized so maybe jscript panel has some conflict in it.
It hangs during installation of jscript panel and hangs when I'm closing foobar either.

But I'm little confused because today is working almost fine. Anyway will try 1.1.6 version and will post how it's behave on it.
Title: Re: JScript Panel
Post by: arch21 on 2017-01-21 14:02:00
Where can I find 1.1.7 relese? With 1.2 my foobar is unstable and I want to try older version of  JScript Panel to check.
http://www.mediafire.com/file/mqv1ld9uang7f7c/foo_jscript_panel-v1.1.7.fb2k-component
Title: Re: JScript Panel
Post by: evillive on 2017-01-21 17:40:16
Thanks for your help.

Problem with my foobar is probably coincidence and JScript Panel is fine. Freezes occurs randomly while closing foobar (not every time, rather rarely). I'm thing it's related to buffer or disk write/read processes ... perhaps disk fault.
Title: Re: JScript Panel
Post by: nikolai4ik on 2017-01-29 14:00:07
I suddenly started getting this error though nothing (neither foobar nor script) was modified

Quote
JScript Panel (Last.fm Artist Info/User Charts/Recent Tracks by marc2003)
JavaScript runtime error:
Unable to get property 'innerText' of undefined or null reference
File: C:\Users\username\AppData\Roaming\foobar2000\js_marc2003\js\list.js
Line: 695, Col: 9
<source text only available at compile time>

Updated to 1.2 and another error started appearing too
Quote
JScript Panel (JS Smooth Browser v20151114-1630-340 by Br3tt aka Falstaff >> http://br3tt.deviantart.com)
JavaScript compilation error:
Syntax error
File: C:\Users\RivaGe\AppData\Roaming\foobar2000\js_br3tt\jssb\js\JScommon.js
Line: 540, Col: 8
    }; else {

Confused about the first error, why would list.js be missing innertext if I haven't touched it? Any solutions? :(
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-30 08:11:51
1) Well I don't support that script any more but I think if you scrobble something using the same account you're viewing for the charts, it should prevent that error.

2) This goes to show no one reads the download page.... go back and look again.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: nikolai4ik on 2017-01-31 19:17:53
Wow haha my bad, I skimped through the changelog and as always I didn't find any familiar words I just downloaded it without reading lower. Thanks and sorry :)

btw shame about last.fm script, I am using same account and this error occurs.
Title: Re: JScript Panel
Post by: marc2003 on 2017-01-31 19:47:56
I dug around in my old files git history and found a copy which may fix your issue...

https://gist.githubusercontent.com/19379/a6f823ad7e0ba3177746e343caddf24a/raw/62cd2c843bc78236fe99ea677c3d4ed8768c5469/list.js

Try replacing list.js inside the js_marc2003\js folder. Make a backup of the old file first just in case.
Title: Re: JScript Panel
Post by: arhipov_rp on 2017-02-02 20:10:35
There is problem with JS Smooth Browser (downloaded from here https://github.com/19379/JS-Smooth-Scripts-By-Br3tt) and JScript Panel v1.2. Genre list in Smooth Browser is not the same as Album list. Can this be fixed?
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-03 01:48:42
Is it definitely set in Library mode and not playlist? I don't know much else about it as I don't use day to day but it seemed to list all genres when I tested it just now.

edit: I see it doesn't appear to support multi-value tags. You'll have to ask @Falstaff about that.

http://br3tt.deviantart.com/art/JS-Smooth-Browser-571376160
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-04 21:57:49
This component is now live on the official component repository. There have been no changes since the last release but future updates will be available via the built-in update mechanism.

http://www.foobar2000.org/components/view/foo_jscript_panel
Title: Re: JScript Panel
Post by: juniiflow on 2017-02-07 22:47:58
js_br3tt\jssp\js\JScommon.js
Line: 540, Col: 8
    }; else {

How to fix?
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-08 01:02:15
Replace all files and update scripts in panels with this...

https://github.com/19379/JS-Smooth-Scripts-By-Br3tt
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-02-08 08:19:35
This component is now live on the official component repository. There have been no changes since the last release but future updates will be available via the built-in update mechanism.

http://www.foobar2000.org/components/view/foo_jscript_panel
Congratulations! It was long due =)
Title: Re: JScript Panel
Post by: Coreda on 2017-02-19 07:25:41
Just noticed the JSPlaylist mod (https://github.com/19379/jsplaylist-mod/) is no longer at marc2003's Github repo. Any reason for this? It's a port of panel I'm constantly recommending to others.

Noticed this as I had a question about how to force group sorting, since I found it doesn't appear to auto apply the group sorting settings but manually requires it to be applied each time. I'd only just discovered this as most of my library is naturally sorted via filenames but some recent directories have filenames whose naming differs from the track number order and I discovered the panel sorted them by the filename order instead.
Title: Re: JScript Panel
Post by: marc2003 on 2017-02-19 07:34:40
JSplaylist is now bundled with the component itself.

https://github.com/19379/foo-jscript-panel/tree/master/component/samples
Title: Re: JScript Panel
Post by: Coreda on 2017-02-19 08:21:14
JSplaylist is now bundled with the component itself.

https://github.com/19379/foo-jscript-panel/tree/master/component/samples

Ah, good to know.

With regard to force sorting in the panel, any ideas? I find I have to right-click the columns header>Groups>Apply group sorting to override the filename sorting and apply track number order, but the option doesn't seem to be able to be permanently set.

Title: Re: JScript Panel
Post by: marc2003 on 2017-02-19 10:35:25
It's never been a playlist viewer's job to sort or "force" sort. How a playlist is originally sorted depends entirely on how the files were added in the first place. If you're adding from the File menu or drag/dropping from explorer, check the setting under File>Preferences>Shell Integration>Sort incoming files by. If you're using Album list, the playlist items are always sorted the same way they are displayed. Other 3rd party library viewers may have their own sorting preferences.

This has never been something any other playlist viewer has dealt with so I'm unsure why you're questioning it now.
Title: Re: JScript Panel
Post by: Coreda on 2017-02-19 11:33:06
How a playlist is originally sorted depends entirely on how the files were added in the first place. If you're adding from the File menu or drag/dropping from explorer, check the setting under File>Preferences>Shell Integration>Sort incoming files by. If you're using Album list, the playlist items are always sorted the same way they are displayed. Other 3rd party library viewers may have their own sorting preferences.

Turned out to be the Facets component sort order. Apologies for the mix-up. Was due to having previously always formatted the collection using filenames that naturally sort, and seeing how carefully I customized the JSPlaylist panel title formatting wondered why it wasn't following the order there. Had I noticed it in a default playlist panel I probably would have realized the source of the issue sooner. Thanks.
Title: Re: JScript Panel
Post by: wcs13 on 2017-03-13 14:24:06
So, abour JScript Smooth Playlist Manager, here's a feature request : folders.
And by this I mean a way to hierarchically group playlists in a tree view. Virtual folders containing playlists.
Example : Folder name = "New Year's Party" and then 3 sub-playlists : "Ambient", "Slow & Sexy", "Fast & Furious".
You get the idea.
Thanks.
Title: Re: JScript Panel
Post by: colagen on 2017-03-20 12:00:36
Hi,

I wondered : can't we find a generous developper who would be willing to add the ability to drag a list of tracks outside a Jscript panel ? It's clearly the big missing feature of this component. I've got no idea of the time it would take to code it, i tried to take a look myself, i saw that the initial developper began this task (there is a bunch of lines related to that in some files), but i'm completely not able to finish the work myself, so i gave up.
Title: Re: JScript Panel
Post by: widerock on 2017-03-21 01:58:12
I'd like to know if there is any method to import different 'js file' according to "if" condition.

What I want to to is that one specific panel show differnet JScript after getting notified with "function on_notify_data(name, info)"
The below is something what I'd like to do.
Code: [Select]
function on_notify_data(name, info) {
    switch(name) {
        case "chk_yt":
            if(info == "youtube") {
                 here I'd like to import "biography.js"
            } else {
                here I'd like to import "playlist view.js"
            }
       }
}
I'm not sure if this kind of thing is possle or not. Any comment or tip would be appreciated.
Title: Re: JScript Panel
Post by: marc2003 on 2017-03-21 07:30:02
Yes, I've done this before - with a little help from foosion...

Code: [Select]
// ==PREPROCESSOR==
// @author "marc2003 / foosion"
// @name "Panel Receiver"
// ==/PREPROCESSOR==

var script = window.GetProperty("current_script", "path\\to\\biography.js");
var pre = "";
var text = utils.ReadTextFile(fb.ProfilePath + script);
var lines = text.split("\n");
if (lines[0].indexOf("// ==PREPROCESSOR==") == 0) {
for (var i = 0; i < lines.length; i++) {
if (lines[i].indexOf("// @import") == 0) {
var fq = lines[i].indexOf("\"") + 1;
var lq = lines[i].lastIndexOf("\"") - fq;
var file = lines[i].substr(fq, lq).replace("%fb2k_profile_path%", fb.ProfilePath).replace("%fb2k_component_path%", fb.ComponentPath);
pre += utils.ReadTextFile(file) + "\n";
} else if (lines[i].indexOf("// ==/PREPROCESSOR==") == 0) {
break;
}
}
}
eval(pre + text);
(function (global) {
var original_callback = global.on_notify_data;
global.on_notify_data = function (name, info) {
if (name == "load_script") {
if (utils.FileTest(fb.ProfilePath + info, "e")) {
window.SetProperty("current_script", info);
window.Reload();
}
} else if (original_callback) {
original_callback(name, info);
}
}
})(this);

The only thing you should edit is the default script it loads on the first line...

Code: [Select]
"path\\to\\biography.js"

It must be in subfolder of your profile path.

Then in your other panel...

Code: [Select]
window.NotifyOthers("load_script", "path\\to\\biography.js");
or
Code: [Select]
window.NotifyOthers("load_script", "path\\to\\playlist view.js");

Again these must be relative in your profile folder.
Title: Re: JScript Panel
Post by: widerock on 2017-03-21 09:37:50
Yes, I've done this before - with a little help from foosion...
Thank you very much, marc2003 & foosion.
I've succeeded in setting up my foobar as I wanted.
I have one more question.
Could you let me know how to check if 'the current playlist name' includes a specific string such as "Library"?
Title: Re: JScript Panel
Post by: marc2003 on 2017-03-21 09:55:37
Code: [Select]
var playlist_name = plman.GetPlaylistName(plman.ActivePlaylist);
if (playlist_name.toLowerCase().indexOf("library") > -1) {
    //do something
}
Title: Re: JScript Panel
Post by: widerock on 2017-03-21 14:53:27
Thank you, marc2003. That is exactly what I wanted.
Title: Re: JScript Panel
Post by: marc2003 on 2017-03-22 12:44:39
edit: WINE setup instructions removed. They can now be found here:

https://github.com/19379/foo-jscript-panel/wiki/WINE



Title: Re: JScript Panel
Post by: randomuser on 2017-04-01 23:39:19
Hi guys! I was previously ranting in ColumnsUI subforum, hope you don't mind seeing me here too :)
Problem was net radio stream not showing artist/title correctly, not sure is it exactly CUI, PSS, ELP or something else.
Then I used Falstaff's JScript playlist and there it was
Code: [Select]
fb.TitleFormat("%title%").Eval(true)
Tested that in old WSH panel, shows exactly what it should show (title).
Maybe someone could give a hint, why or how this script version works differently compared to usual titleformat %title%?
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-02 02:08:50
I could give a technical answer explaining the difference but what's the point? You have a problem with some other component you can't even identify so nothing I say is going to help.
Title: Re: JScript Panel
Post by: randomuser on 2017-04-02 02:40:17
Ok, fair enough.
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-24 10:47:52
Since the Last.fm Charts API is working again, I've decided to restore the sample along with Musicbrainz...

Code: [Select]
v1.2.0.1
- CHG: Minor code cleanups but no new component features for now.
- ADD: Add Last.fm Similar Artists / Charts & Musicbrainz samples.

https://github.com/19379/foo-jscript-panel/releases

It's also on the official component repository here: http://www.foobar2000.org/components/view/foo_jscript_panel
If you have a previous version installed, you can update from the Help menu>Check for updated components.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-04-24 12:59:20
Since the Last.fm Charts API is working again, I've decided to restore the sample along with Musicbrainz...

Code: [Select]
v1.2.0.1
- CHG: Minor code cleanups but no new component features for now.
- ADD: Add Last.fm Similar Artists / Charts & Musicbrainz samples.
Nice! Finally I can retire the old script folder (/js_marc2003) and use the one in the component!

PS: Since my PM was blocked, I'll try asking here: you've included your lastfm API key in the script - was it intentional?
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-24 13:07:07
Just be aware the new script doesn't have top tracks/albums. It only has similar artists/charts.

And yes, the API key is included on purpose. I would have given instructions on how to use your own if I didn't!
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-04-24 14:23:39
Just be aware the new script doesn't have top tracks/albums. It only has similar artists/charts.
Actually, these are the only features that I'm using =)
And yes, the API key is included on purpose. I would have given instructions on how to use your own if I didn't!
I thought it might be so, but better safe than sorry...
Title: Re: JScript Panel
Post by: seriousstas on 2017-04-26 13:48:16
marc2003
Please return, if possible :
on_tooltip_custom_paint()
thnx!
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-26 16:13:28
Nope, that is not coming back. Look at the extra parameters you can pass to window.CreateTooltip if you want custom font/size/style.
Title: Re: JScript Panel
Post by: seriousstas on 2017-04-26 20:36:50
On_tooltip_custom_paint ()
allows  to make the hint still.
Without this function - it is impossible, moves ..
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-26 22:53:40
It appears in the editor because I forgot to update the "autocomplete" file at the same time I removed it. I realised this mistake back in March.

https://github.com/19379/foo-jscript-panel/commit/d45bcf5358ad4f11b8bfcabb0b146f07b14dce4b

You can save this updated file in your component folder - overwriting the existing file.

https://raw.githubusercontent.com/19379/foo-jscript-panel/master/component/interface.api

If you don't like the change, use WSH panel mod as before or even WSH panel mod PLUS.
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-28 20:58:38
Code: [Select]
v1.2.1
- FIX: Fix bug where the playing item handle was never sent to the
       "on_playback_edited" callback even though the docs said it would.
- FIX: Tidy up docs and auto-complete hints for "on_metadb_changed"
       and "on_selection_changed". Specifically, "on_metadb_changed" always
       receives a "handle list" and never a "handle" as the first argument.
       "on_selection_changed" never receives a "handle" argument. This behaviour
       is consistent with WSH panel mod having the "v1.4" @feature preprocessor set
       as documented here:
       https://git.io/v9cVw
       https://git.io/v9cVD

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: Jailhouse on 2017-04-28 21:51:44
Check for updated components gives me, "No updates are available at this time."

It's only been a bit less than an hour since your post here. How long does it generally take before fb2k finds a new version?
Title: Re: JScript Panel
Post by: marc2003 on 2017-04-28 21:59:33
If you'd visited the components site, you'd see I forgot to upload it. But it's there now!

edit: just had to re-upload the files because of a typo in changelog.  :-[
Title: Re: JScript Panel
Post by: Jailhouse on 2017-04-28 22:48:20
One of those days, eh? But no harm done; after all, it took me three days to notice that the last version had been uploaded. In comparison, my update today felt like getting it instantaneously.
Title: Re: JScript Panel
Post by: KoO on 2017-05-07 08:07:27
@marc2003
On the subject of Foobar on Linux..
Been tiring to get jscript 1.2.1 to run jsplaylist-mod and Library Tree 1.3.3 both just crash.

After i run these commands I get this for both

sh winetricks gdiplus_winxp
wine cmd.exe /c echo '%ProgramFiles%' returned empty string, error message "wine: WINEARCH set to win32 but '/home/koo/.wine' is a 64-bit installation."

sh winetricks wsh57 fontsmooth=rgb msscript ie8
wine cmd.exe /c echo '%ProgramFiles%' returned empty string, error message "wine: WINEARCH set to win32 but '/home/koo/.wine' is a 64-bit installation."

---------------------------------------------------------
I have everything installed as stated above..
wine 2.7
MX-16 x64 Linux =Debian
Foobar 1.3.15 full installed with wine.(Tried my Foo portable from windows scripts crash)
architecture i386 and installed

All the standard components for foo run fine UI,NG,Albumlist and so on...

Using wine is new to me the only reason I have it installed is to run FooBar.I no interest installing anymore windows programs in wine.If foobar was native linux I would not need wine at all.I have tried most of the linux media players. Foo is God

If you can help all good if not I and live with a standard Foobar columns UI...

Thanks to You and all the Foo modder and scriptwriters out their...





Title: Re: JScript Panel
Post by: marc2003 on 2017-05-07 11:11:43
Try deleting your .wine folder and running winecfg again. It looks like you may have used an existing terminal window that was already open when you edited your .bashrc file with export WINEARCH=win32
Title: Re: JScript Panel
Post by: KoO on 2017-05-08 04:28:39
@marc2003
Thanks very much for the reply
.Will do later tonight..

Have you ever had anything to do with DeadBeef ?
If that player had and Album List & Library Tree.X
It is by far the best Linux media player.{That my opinion anyway}

Foo is God
Title: Re: JScript Panel
Post by: Viewmax on 2017-05-17 12:39:43
I need two custom buttons for my foobar2000. One of them to set volume to -10db and another button to set volume to -30db.
Is it possible with this component? I'm not developer at all :(

P.S.: Didn't know where to post, so I got reply here https://hydrogenaud.io/index.php/topic,110516.new.html
Title: Re: JScript Panel
Post by: marc2003 on 2017-05-18 07:02:26
Code: [Select]
v1.2.2
- ADD: Add new "on_main_menu" callback. 10 main menu items have been created
       meaning you can now bind them to global keyboard shortcuts, standard
       toolbar buttons, etc and have them run your own custom code. See
       docs\callbacks.txt

From callbacks.txt

Code: [Select]
function on_main_menu(index) {}
/*
On the main menu>File>JScript Panel, there are 10 menu items and whichever number
is selected is sent as the "index" to this callback. Being main menu items now means you
can bind them to global keyboard shortcuts, standard toolbar buttons, panel stack splitter
buttons, etc. Remember to think carefully about where you use this code as you probably only
want it to run once and so don't include it in common files and scripts where you might have
multiple instances. Also, you should avoid sharing scripts containing this code so as not
to conflict with what other users may already be using.
Example:

function on_main_menu(index) {
switch (index) {
case 1: // triggered when File>Jscript Panel>1 is run
do_something();
break;
case 2: // triggered when File>Jscript Panel>2 is run
do_something_else();
break;
}
}
*/

https://github.com/19379/foo-jscript-panel/releases

Also available on the official components site or updating through foobar itself.
Title: Re: JScript Panel
Post by: easonjim on 2017-05-27 10:13:01
@marc2003
Dear marc2003,
I just started learning to use JScript Panel, there are several questions you would like to ask about your.
1, why do I use JScript when these syntaxes will be prompted for errors: import System.Windows.Forms;
2, if I want to introduce the System command space, I need to do?
3, "// @import "%fb2k_component_path%samples\complete\js\albumart.js"",like this is the expression of the introduction of documents, but I can not find such a grammar in the official JScript document, is this is their own custom?

Thanks you.
Title: Re: JScript Panel
Post by: marc2003 on 2017-05-27 14:15:28
1) This only supports javascript. That looks like .net??
2) Not possible, see 1.
3) It's unique to the component. See docs\preprocessors.txt

https://github.com/19379/foo-jscript-panel/blob/master/component/docs/Preprocessors.txt
Title: Re: JScript Panel
Post by: easonjim on 2017-05-27 20:29:51
@marc2003
Dear marc2003,
Thanks very much for the reply.
I get it now. Thank you.
Title: Re: JScript Panel
Post by: cliffflip on 2017-06-01 08:32:00
Hi marc,
what happens to your "thumbs" script? From your latest scripts, if I copy the contents of "thumbs.txt" from 'sample' directory, it won't download and show the currently now playing artist pictures, even when I set it to auto-download and use 'download now' option. If I use "thumbs.txt" from 'sample\complete', it only shows album art or whatever image included in the folder of the currently playing track.

Thanks in advance!
Title: Re: JScript Panel
Post by: marc2003 on 2017-06-10 00:26:27
Code: [Select]
v1.2.3
- ADD: Add fb.ReplaygainMode. Can be used to retrieve or set the value. See
       docs\interfaces.txt
- CHG: Hide JScript Panel main menu items. Given they're meant for binding to
       to keyboard shortcuts/standard buttons, there is no need for them to be
       visible. Hold Shift if you really want to access them from the menu.
- FIX: Fix MakeUnion handle list method and update docs with examples for
       MakeUnion, MakeDifference and MakeIntersection methods.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: seriousstas on 2017-06-29 07:43:23
marc2003
Use it in conjunction with foo_uie_mega_panel_splitter.(MPS)
Noticed - on the latest versions, starting with 1.2 scripts are loaded with a delay (50-500ms ..)
As a consequence - I see a white screen sometimes .. And for example with version 1.1.4 - always a quick start ..
Title: Re: JScript Panel
Post by: marc2003 on 2017-07-01 15:57:37
Yes, I see a flash of blank white panel when using Panel stack splitter (not using mega splitter) but it never happens with default UI or columns UI so I figured it was an issue with that component. As for script startups, mine are between 10-40ms . I can live with that and no one else has complained during the last 6 months....
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-07-03 09:53:35
marc2003
Use it in conjunction with foo_uie_mega_panel_splitter.(MPS)
Noticed - on the latest versions, starting with 1.2 scripts are loaded with a delay (50-500ms ..)
As a consequence - I see a white screen sometimes .. And for example with version 1.1.4 - always a quick start ..
What OS do you have and what is your IE browser version?

PS: I dunno about MPS, but in PSS you can avoid having white background if you draw background directly in PSS Script (i.e. PerTrack Script), because PSS panel load times are miniscule (especially when compared to complicated JScript's scripts).
Title: Last.Fm: Library Search for Similar Artists
Post by: fuffi on 2017-07-21 00:59:05
Since the Last.fm Charts API is working again, I've decided to restore the sample
Code: [Select]
v1.2.0.1
- ADD: Add Last.fm Similar Artists / Charts & Musicbrainz samples.

Thank you,

how would it be possible to have a library search when clicking on any artists in the Similar Artists window? (and for the tracks in the User Charts)

I remember there was a time (but maybe another component), we could choose between "open the last.fm artists site" *or* "list all music from the selected artist". but thats a long time ago.
I also remember, there was a little help on the github issues, but could'nt find it anymore.

Any help would be ... helpful, i guess :-)




Title: Re: JScript Panel
Post by: marc2003 on 2017-07-21 22:39:48
Added (https://github.com/19379/foo-jscript-panel/commit/5e450c9538aa36a9dfb51650d8f938ab37834be3) for the next release.

If you really can't wait, save this inside the component folder\samples\complete\js

https://raw.githubusercontent.com/19379/foo-jscript-panel/master/foo_jscript_panel/samples/complete/js/list.js

Note: it only works in similar artists and when the charts are displaying artist only. It won't work in chart album/track mode.
Title: Re: JScript Panel
Post by: hyydrogen on 2017-07-25 19:11:01
Hi.

I have a bit strange question. I am trying to run foobar2000 on an old Windows XP laptop. That Windows version is supported by foobar2000 but not by JScript Panel. Is there any way to get JScript Panel that would work on Windows XP?

Thanks in advance.
Title: Re: JScript Panel
Post by: marc2003 on 2017-07-27 07:54:44
I suspect someone who is competent could make it work but I don't know how.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-07-27 11:47:11
Hi.

I have a bit strange question. I am trying to run foobar2000 on an old Windows XP laptop. That Windows version is supported by foobar2000 but not by JScript Panel. Is there any way to get JScript Panel that would work on Windows XP?

Thanks in advance.
You can try the following:
https://support.microsoft.com/en-us/help/949140/when-i-run-a-script-in-windows-script--i-receive-an-error-message-libr

Not sure if it will help though, since I don't have a VM with WinXP to test it with.
Title: Re: JScript Panel
Post by: marc2003 on 2017-07-27 19:20:04
^That won't be an issue as the original WSH panel mod runs fine on XP. I was also releasing updated versions of WSH panel mod which also ran under XP.

Basically, all the problems started when I upgraded from VS2013>2015, updated to the latest foobar2000 SDK and also updated WTL at the same time. I remember lots of compiler errors which magically went away when I dropped the XP toolset. This was at the same time I was releasing JScript Panel as "new" component so I didn't have to care about breaking any upgrades and took the easy way out. Like I say, someone competent would have seen the errors and probably fixed it in 5 minutes.  :P
Title: Re: JScript Panel
Post by: hyydrogen on 2017-07-27 20:16:22
I couldn't apply that scripting component, I already have newer version installed.

Anyway, on Windows XP I receive the following message

Failed to load DLL: foo_jscript_panel.dll
Reason: The specified procedure could not be found.

I also tried running foobar2000 on Linux Zorin, latest version through Wine. foobar2000 runs OK, but JScript Panel crashes ("Aw, crashed" message displayed.)

Title: Re: JScript Panel
Post by: marc2003 on 2017-07-27 20:19:26
Here are some complete setup instructions for use with WINE...

https://github.com/19379/foo-jscript-panel/wiki/WINE
Title: Re: JScript Panel
Post by: fuffi on 2017-08-05 20:46:21
If you really can't wait, save this inside the component folder\samples\complete\js
https://raw.githubusercontent.com/19379/foo-jscript-panel/master/foo_jscript_panel/samples/complete/js/list.js
Thank you very much.
I will wait, because I'm too helpless staring of this crash-message, after doing the simple task you have written...
Code: [Select]
JScript Panel (Last.fm Similar Artists / User Charts by marc2003)
Laufzeitfehler in JavaScript:
Das Objekt unterstützt die Eigenschaft oder Methode "scale" nicht
File: E:\m\portable\foobar2000\user-components\foo_jscript_panel\samples\complete\js\list.js
Line: 977, Col: 3
<source text only available at compile time>
Title: Re: JScript Panel
Post by: garbanzo.bean on 2017-08-07 20:10:30
Does anyone have a script for a simple button to toggle between Default and Shuffle (tracks) playback modes? Thanks!
Title: Re: JScript Panel
Post by: marc2003 on 2017-08-09 05:05:54
Code: [Select]
v1.2.3.1
- CHG: No component changes except a version bump. All changes are to samples.
- ADD: Last.fm Bio, Allmusic, Listenbrainz samples. "Thumbs" can download images
       from Last.fm again but only manually.
- FIX: Most samples are now DPI aware so text/tooltips should increase inline
       with other desktop elements. For existing users, each panel script should
       be re-imported from the "samples\complete" folder.

https://github.com/19379/foo-jscript-panel/releases

late edit: It's now on the components site as well.
Title: Re: JScript Panel
Post by: marc2003 on 2017-08-24 09:46:45
Code: [Select]
v1.2.3.3
- CHG: No component changes except a version bump.
- FIX: Fix typo in "musicbrainz.txt". Thanks to zeremy for spotting.
- CHG: Listenbrainz now has caching/retry support. It's my first attempt
       at this so please report any issues! I also need reports of any
       code 400 errors from the server as the script will need updating
       before these tracks can be submitted successfully.
- ADD: Br3tt's JS Smooth scripts are now bundled with the component and the
       separate repository has been nuked.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: miras on 2017-08-24 18:31:02
Hi There! Great fan of your work marc2003
I'm upgrading my foobar skin (wsh to jscript) and I really want to change my graphical browser to Js Smooth Browser, much more pretty and fluid. But Smooth Browser don't have keyboard navigation. Any chance of adding keyboard arrows navigation?

Title: Re: JScript Panel
Post by: marc2003 on 2017-08-24 23:31:10
I'll have a look but from the post right above yours, you can see I'm not the original author....
Title: Re: JScript Panel
Post by: fuffi on 2017-08-25 00:25:32
Does anyone have a script for a simple button to toggle between Default and Shuffle (tracks) playback modes? Thanks!
I have spottet this sample: ...user-components\foo_jscript_panel\samples\basic\PBOButton(Menu).txt
named: "Playback Order Button (Popup Menu)"

Theoretical question about buttons:
Would it be possible (and how)  to replace all the f2k-default buttons with JScript Panels? Is it even possibe to hide the default f2k buttons and use only JScript Panels instead? (I'm using ColummsUI)
I have seen some examples for functions like volume or the playbar, so I guess, it is possible to ADD more buttons, but would there be an impact in speed, when adding very much buttons?

I'm asking, because I have about 40 customized buttons and the space is getting low... It seems not to be possible to add another buttonbar to f2k via columns UI, so I'm thinking about adding those buttons as JScript Panels and maybe have the benefit of flexibility in placing out of the button toolbar.

anyone using JScript Panels for buttons? Standard f2k buttons *and* customized buttons (like, i.e. starting foo_runservices or other actions) defined in foobar?

Thanks!
Title: Re: JScript Panel
Post by: marc2003 on 2017-08-25 12:14:46
You should be able to add multiple instance of columns UI buttons to your toolbar. Just hold shift when selecting it. Otherwise, unchecking will hide them but you'd lose the custom ones I think??

Really there's no reason why you can't have rows and rows of buttons if you want.
Title: Re: JScript Panel
Post by: aloola on 2017-09-01 13:40:48
hello, I'm using newest version and I got this error when playing a track with a super long artist field. Last.fm Bio and thumbs got crashed. :))


Code: [Select]
JScript Panel (Last.fm Bio by marc2003)
JavaScript runtime error:
Path not found
File: D:\Application\foobar2000\user-components\foo_jscript_panel\samples\complete\js\helpers.js
Line: 108, Col: 4
<source text only available at compile time>

the file's title and artist looks like this
 "M@STERPIECE (MOVIE VERSION)" by "Amami Haruka (CV: Nakamura Eriko), Hoshii Miki (CV: Hasegawa Akiko), Kisaragi Chihaya (CV: Imai Asami), Takatsuki Yayoi (CV: Nigo Mayako), Hagiwara Yukiho (CV: Asakura Azumi), Kikuchi Makoto (CV: Hirata Hiromi), Futami Ami/Mami (CV: Shimoda Asami), Minase Iori (CV: Kugimiya Rie), Miura Azusa (CV: Takahashi Chiaki), Shijou Takane (CV: Hara Yumi), Ganaha Hibiki (CV: Numakura Manami)"
Title: Re: JScript Panel
Post by: Tropoje on 2017-09-03 09:45:14
Hello
I'm using foobar CUI. I am new in JScript Panel. I was recently interested in JScript Panel components and especially JS Smooth Playlist. Is it possible to add more information to view next to the album art ?. I have several different releases of the same disc. Other catalog number, publisher, year of reissue, etc. I would like to add this information to the view. Of course, everything is tagged correctly.

(https://i.imgur.com/K2JQRno.jpg)

Best regards
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-04 18:40:34
@aloola, bug fixed in next version

@Tropoje, the original script author doesn't post here at the moment and I don't think anyone else can help with that.
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-06 18:59:51
Code: [Select]
v1.2.4
- ADD: Add utils.ColorPicker which is a popup dialog for selecting colours.
       See docs\interfaces.txt, samples\basic\Color Picker.txt
- FIX: Fix various bugs in samples\complete folder.
- CHG: Listenbrainz sample now has an on/off toggle on the menu.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: fuffi on 2017-09-08 02:00:47
Hi marc2003,
Code: [Select]
- CHG: Listenbrainz sample now has an on/off toggle on the menu.
This project was new to me, so I signed in to add some listens to it in addition to all my last.fm scrobbles. Good thing, thanks for supporting it!

After reviewing my listens on the listenbrains site, I recognized, that they're "incomplete", because I save remix/version info in the COMMENT Tag, which seems not to be submitted. (also, I did not found any option to tell what should be submitted by the script. Please forgive me, being a old n00b which can't analyze/understand all of your (greatly apreciated!) coding to change it myself without bothering you...)

Maybe you can add Field remappings, like in foo_audioscrobbler ?

foo_audioscrobbler settings: (https://picload.org/thumbnail/dgglodcl/1.jpg) (https://picload.org/view/dgglodcl/1.png.html)

My scrobbles in last.fm: (https://picload.org/thumbnail/dgglodcr/l.jpg) (https://picload.org/view/dgglodcr/l.png.html) (with remix information)
My listens on listenbrains: (https://picload.org/thumbnail/dgglodca/s.jpg) (https://picload.org/view/dgglodca/s.png.html) (without remix information)



Title: Re: JScript Panel
Post by: marc2003 on 2017-09-09 11:01:08
The script doesn't use title formatting and I'm not updating it for now.
Title: Re: JScript Panel
Post by: fuffi on 2017-09-09 23:37:51
Thanks,
foo_audioscrobbler is sufficient then, also, it is possible to import last.fm history to listenbrains....

Another question (about building buttons via JScript)
You should be able to add multiple instance of columns UI buttons to your toolbar. Just hold shift when selecting it. 
Really there's no reason why you can't have rows and rows of buttons if you want.
Is it possible to give the buttons different behaviour, when ALT+click or CTRL+click on it?
That would be useful to add some activate/deactivate-functions or insert/remove-buttons.
Title: Re: JScript Panel
Post by: fuffi on 2017-09-10 01:54:18
Another thingy,
thank you for the updates on the autoplaylist script. Its clearly an improve in usablility to have a contextmenu to choose from opened when clicking on a list, and not directly start the query automaticly.  nice one!

But since the config file is in JSON format, its not easy sortable (via texteditor) anymore. (which I did to have the lists sorted the way I need them)

I have about 100 entries and new lists are added at the bottom, not where I like them to be :-)

Can you consider to add some drag'n'drop or dialogue for letting the user move entries to sort them somehow ?
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-10 05:36:26
You can customise the buttons with a bit of scripting. Taking the example from the menu button script...

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function () { _.menu(0, 36); }, 'Menu');

You could replace it with...

Code: [Select]
buttons.buttons.menu = new _.button(0, 0, 36, 36, {normal : 'misc\\foobar2000.png'}, function () {
var VK_SHIFT = 0x10;
var VK_CONTROL = 0x11;
var VK_ALT = 0x12;

if (utils.IsKeyPressed(VK_SHIFT)) {
fb.ShowPreferences();
} else if (utils.IsKeyPressed(VK_CONTROL)) {
fb.ShowConsole();
} else {
_.menu(0, 36);
}
}, 'Menu');

As for autoplaylists, I never really imagine people adding that many entries. I'm too lazy for drag/drop but I have added an option to move items up/down from the menu.

(https://i.imgur.com/mNEL20e.png)

Obviously this is still going to be a bit cumbersome for you...

But if you use Notepad++, you can edit quite easily using the JStool plugin. After installing, press Ctrl+Alt+M with an open JSON document and you get something like this...

(https://i.imgur.com/9uReF8g.png)

Title: Re: JScript Panel
Post by: fuffi on 2017-09-10 21:38:34
Great help, for the buttons, thank you!
As for npp, I already installed the plugin to "read" the config easy and change small typos, but was too cowardly for sorting multiple lines. Will try.
The Move/Up/Down item will also help. Thank you! Its better than nothing and lazyness is very important those fast paced days... :-)
Keep up the lazyness and the good work ;-)
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-12 11:01:31
I'm currently breaking stuff for the next version. A preview of what I'm doing can be read here...

https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes

@WilB, you might be interested since I'm nuking UpdateFileInfoSimple !! I hope the replacement makes sense to you.
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-15 10:44:49
Code: [Select]
v1.3.0-Beta-1
- CHG: Support for IE7/IE8/WINE users has been dropped. Your computer
       must have IE9 or later installed.
- CHG: The "UpdateFileInfoSimple" handle and handle list methods are
       now gone.
- ADD: A new "UpdateFileInfoFromJSON" method has been added. See
       https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v130
       If anyone needs help with this, just ask.
- ADD: You can now create an empty handle list with fb.CreateHandleList()
       See docs\interfaces.txt

https://github.com/19379/foo-jscript-panel/releases

Users of @WilB 's bio script who use it to update tags should avoid for now. Also, anyone else who uses the component to update tags should read this link to find out what is broken and how to update.

https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v130 << this has had notable changes since I posted the first draft the other day

If anyone has trouble understanding it, then ask for help.

This update will only be available on github. I'm not posting it on the official components site because I don't want people blindly updating to it!

edit: renamed Alpha to Beta,  :P
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-22 04:09:06
Beta version is now final. Details in previous post.

Because of the breaking changes, v1.2.4 will remain available on the official components site and on the github releases page.
Title: Re: JScript Panel
Post by: cFlavien on 2017-09-23 10:50:04
Hi, from today I have this error :
Quote
JScript Panel (Menu Button by marc2003)
Erreur d’exécution JavaScript:
Un composant ActiveX ne peut pas créer un objet
File: E:\Ma LiberKey 5\MyApps\foobar2000\js_marc2003\js\helpers.js
Line: 45, Col: 1
<source text only available at compile time>
I have update with last version but same error
Quote
JScript Panel (Menu Button by marc2003)
Erreur d’exécution JavaScript:
Un composant ActiveX ne peut pas créer un objet
File: E:\Ma LiberKey 5\MyApps\foobar2000\user-components\foo_jscript_panel\samples\complete\js\helpers.js
Line: 560, Col: 1
<source text only available at compile time>
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-23 11:47:35
You generally don't see ActiveX errors with this component and any version of Windows unless something is really broken or perhaps something is interfering like an over-zealous security application??? Can you think anything just installed/changed recently?

What is the output of this script alone in a panel??

Code: [Select]
var arr = ['htmlfile', 'Shell.Application', 'WScript.Shell', 'Scripting.FileSystemObject', 'ScriptControl'];

for (var i = 0; i < arr.length; i++) {
try {
var obj = new ActiveXObject(arr[i]);
if (arr[i] == 'ScriptControl')
obj.Language = 'VBScript';
fb.Trace(arr[i] + ' tested OK!');
} catch (e) {
fb.Trace(arr[i] + ' not OK!')
}
}

Check the Console. I get...

Code: [Select]
htmlfile tested OK!
Shell.Application tested OK!
WScript.Shell tested OK!
Scripting.FileSystemObject tested OK!
ScriptControl tested OK!
Title: Re: JScript Panel
Post by: cFlavien on 2017-09-23 12:57:33
Quote
htmlfile tested OK!
Shell.Application tested OK!
WScript.Shell tested OK!
Scripting.FileSystemObject tested OK!
ScriptControl not OK!
JScript Panel ({9D1E0696-2F50-42AE-95E5-8B494D9D0A40}): initialised in 10 ms

I do not install anything more than the update nvidia drivers, nodejs, git !
before sending the message I desintaler last update windows update (KB)
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-23 13:23:12
Well sorry but I have no idea how to fix that. Something has been corrupted or is being blocked??

But you can use most of my scripts without it You can browse to samples\complete\js\helpers.js and comment out these lines... (around 560 according to your previous post)

Code: [Select]
//var vb = new ActiveXObject('ScriptControl');
//vb.Language = 'VBScript';

This will break anything that requires a popup dialog for user input so my autoplaylists script would be unusable.

edit: maybe you could try running this from an administator command prompt (assuming 64bit windows??)

Code: [Select]
c:\windows\syswow64\regsvr32 c:\windows\syswow64\msscript.ocx
Title: Re: JScript Panel
Post by: cFlavien on 2017-09-23 14:55:20
works by deleting both lines! Thank you
I have tried with a new foobar2000 installation and even error.

Note I use Windows 10 x64, it had always worked until today. Maybe because of an IE update. I had IE11 installed but I removed it to try to correct the error.

ps: I would like to suggest a new design for "CD Javel Case Modern". (I use it)

edit : Can't load module
I have no file msscript.ocx in syswow64
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-23 15:29:06
I'm on windows 10 fully updated. I guess you could look at this for restoring any missing files...

https://support.microsoft.com/en-gb/help/4026529/windows-10-using-system-file-checker
Title: Re: JScript Panel
Post by: Jailhouse on 2017-09-24 06:02:56
@marc2003
Now that you're using Windows 10, might you consider looking into updating to ECMAScript 6?
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-24 06:37:57
You've already posted in a previous discussion about how it isn't possible...  ;D

https://hydrogenaud.io/index.php/topic,110516.msg919089.html#msg919089

I guess you could code in ES6 and transpile it with something like babel? Just don't ask me how. I'm aware of it but I've never used it.

Title: Re: JScript Panel
Post by: Jailhouse on 2017-09-25 15:12:25
You've already posted in a previous discussion about how it isn't possible...  ;D
I couldn't have posted about how it's not possible because that's over my head. I did read the posts--then forgot all the technical explanations, retaining only that you and TheQuertiest were using Windows 8.1 and 7, respectively, and somehow concluding that it might be possible when you could test it. Sometimes, it's hell getting old.

Quote
I guess you could code in ES6 and transpile it with something like babel?
Or, to paraphrase myself, I can code JScript Panel in ES5 and like it. :)
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-25 15:43:28
Even though it might break for a handful of users, I've decided to go ahead and stick the latest version on the official components site.

If people really are stuck on Vista/7 which they cannot upgrade to IE9 or are using WINE, they can safely downgrade to v1.2.4 which is still available on github (https://github.com/19379/foo-jscript-panel/releases/tag/v1.2.4).
Title: Re: JScript Panel
Post by: Inhibited on 2017-09-29 16:00:35
@marc2003

Hi Marc,

I'm playing around with your 'rating' script in conjunction with js-smooth browser but have a minor issue.

When I rate a song, then rate the next track, it overwrites the first rating.
I can change it successfully by selecting, deselecting and selecting again the second track I want to rate.

But I'm wondering if there's a more elegant way to refresh the rating when changing track?

Don't worry if it's too much, and thank you for your work all the same!
Title: Re: JScript Panel
Post by: marc2003 on 2017-09-30 03:24:52
Sorry, I have no idea what you're talking about.

All I can say is check the right click selection mode setting on the rating script. The first option means it will always be focused on the playing item even if something else is selected. Option 2 will always focus on the selected track and the tooltips you get when hovering it always show the artist/title so you should always know before clicking it.
Title: Re: JScript Panel
Post by: juniiflow on 2017-10-18 11:49:38
What's the font for the play button? https://github.com/19379/foo-jscript-panel/tree/master/foo_jscript_panel/samples/jsplaylist-mod
I though it was guifx, but it doesn't seem to work
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-18 12:06:09
Wingdings 3, characters u and w
Title: Re: JScript Panel
Post by: juniiflow on 2017-10-18 13:27:09
Yeah, I came back to share the fonts after finding out it was those, anyway you can download them on megafonts.net (don't know if I am allowed to link them)

It seems to be for everything though @marc2003 (play/check), anyways thanks really appreciate it.
Title: Re: JScript Panel
Post by: OwlPants on 2017-10-25 02:46:48
Hi,

I was wondering if there was a way to access the panel outside of the foobar application because
I was trying to see if I could things such as "fb.Play()" outisde of the application and I couldn't find
a way.

Thank you
 
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-25 08:56:36
You can use the command line to run simple playback commands and execute menu items. See foobar2000.exe /?

I guess for complex bits of code, you could trigger the JScript Panel menu commands to run code inside the on_main_menu callback.

https://github.com/19379/foo-jscript-panel/blob/d9db86494ec68d48c6812c458a29fa20dea1c4f1/foo_jscript_panel/docs/Callbacks.txt#L59L80
Title: Re: JScript Panel
Post by: OwlPants on 2017-10-25 21:57:29
Thanks, i'll look into it  :)
Title: Re: JScript Panel
Post by: OwlPants on 2017-10-26 03:16:07
How would you refer to the box created if I
want to add an event listener e.g. (what could I put in place of "element"?)

Code: [Select]
element.addEventListener('keydown', function(ev){
console.log(ev.which);
});

var e = new KeyboardEvent('keydown',{'keyCode':75,'which':75});
console.log(e);
element.dispatchEvent(e);
break;

Thanks
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-26 06:51:25
fb.Trace is the component's equivalent to console.log. If you want to use console.log in your script, you can write your own function like this...

Code: [Select]
var console = {
    log: function (message) {
        fb.Trace(message);
    }
}

And you can't use html/DOM stuff like addEventListener. You'll need to use the on_key_up and on_key_down callbacks from docs\callbacks.txt

Code: [Select]
var console = {
log: function (message) {
fb.Trace(message);
}
}

function on_key_down(vkey) {
if (vkey == 75) {
console.log("You pressed k");
}
}

https://github.com/19379/foo-jscript-panel/blob/d9db86494ec68d48c6812c458a29fa20dea1c4f1/foo_jscript_panel/docs/Callbacks.txt#L40L50

Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-10-31 13:57:19
Hi Marc
I've modified my existing script, that tidies new tracks, to use your new tag update method - all working fine. However one function in my script removes unwanted tags. Currently I have a fixed list of required tag names and loop through all files and all tags, either removing or skipping them according to this list. It occurs to me that there must be a better way to do this, any ideas?

Cheers and once again thanks for your work so far.
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-31 16:28:18
Are you using the GetFileInfo handle method to get all tags from each file? If so, I don't think there is anything else you can do to improve it. I assume you can't know the bad tags in advance if the files are from random sources so your only choice is to loop through them.
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-10-31 17:02:01
Hi Marc
Thanks for the quick reply. Yes I'm using GetFileInfo as you thought.

One idea could be for you to modify UpdateFileInfoFromJSON to allow it to either add/overrite existing tags as now with a switch to remove all tags not in the array.

Just a thought!
Title: Re: JScript Panel
Post by: marc2003 on 2017-10-31 17:41:17
This component provides the bare metal required to do it yourself!! You can read the tags from each handle as you loop through and build a new handle list if it contains tags that aren't on your "good" list.

Consider using the difference function built in to the lodash library that I use and is already bundled with the component..

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// ==/PREPROCESSOR==

https://lodash.com/docs/3.10.1#difference


Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 11:12:55
Hi marc
I've come up with this to remove any unwanted tags from the list of files;

Code: [Select]
    var toKeepArray=["band", "album","artist","composer","date","genre","title","tracknumber", 
    "totaltracks", "disctype", "disctitle", "discnumber", "totaldiscs", "album artist", "musicbrainz_artistid", "musicbrainz_albumid"];
   
// Loop thru all metadb fields in this file to see which ones to keep/delete
// Firstly forms an array of all unwanted unique tag names
    var foundArray=[];
    for (var trk = 0; trk < l_handles.Count; trk++) {
        var track_metadb = l_handles.Item(trk);
        var track_fileinfo = track_metadb.GetFileInfo();

        for (flds = 0; flds < track_fileinfo.MetaCount; flds++) {
            foundArray.push(track_fileinfo.MetaName(flds));
        }
    }
// Only want one of each
    var uniqArray=_.uniq(foundArray, false);
// Now get the names of tags to remove   
    var difArray=_.difference(uniqArray, toKeepArray);
// Loop through unwanted array to form object with properties
    if (difArray.length > 0) {
        var tagobj = {};
        for (itm = 0; itm < difArray.length; itm++) {
            tagobj[difArray[itm]] = "";
        }
        var str = JSON.stringify(tagobj);
        l_handles.UpdateFileInfoFromJSON(str);
    }

However it doesn't seem to work. Any ideas would be greatfully received.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 11:39:43
You'll want to use toLowerCase() here...

Code: [Select]
foundArray.push(track_fileinfo.MetaName(flds).toLowerCase());

MetaName seems to return differently cased strings depending on tagging format.


Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 12:49:32
I've tried hard-coding the exact tag names to be removed (both in lower and upper cases) and still I can't get it to remove the tags. I've checked the resultant str variable and it contains both upper and lower case versions - sill doesn't work.

PS these are mp3 files using ID3v2.3 formatted tags if that makes any difference.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 13:09:30
The case doesn't matter when constructing your object - it matters when using the difference function because uppercase/lowercase values are different in javascript..

Code: [Select]
var a = ["test"];
var b = ["TEST"];

var c = _.difference(a, b);

fb.trace(c); //test

c would be an empty array if the cases were the same which is what you want. I used toLowerCase to match your hardcoded values.

I tested the code and it works for me...

Before:
(https://i.imgur.com/vymwMP2.png)

After:
(https://i.imgur.com/CFgv1OQ.png)

Code:
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"
// ==/PREPROCESSOR==

function on_mouse_lbtn_dblclk() {
    var l_handles = plman.GetPlaylistItems(plman.ActivePlaylist);
   
     var toKeepArray=["band", "album","artist","composer","date","genre","title","tracknumber",
    "totaltracks", "disctype", "disctitle", "discnumber", "totaldiscs", "album artist", "musicbrainz_artistid", "musicbrainz_albumid"];
  
// Loop thru all metadb fields in this file to see which ones to keep/delete
// Firstly forms an array of all unwanted unique tag names
    var foundArray=[];
    for (var trk = 0; trk < l_handles.Count; trk++) {
        var track_metadb = l_handles.Item(trk);
        var track_fileinfo = track_metadb.GetFileInfo();

        for (flds = 0; flds < track_fileinfo.MetaCount; flds++) {
            foundArray.push(track_fileinfo.MetaName(flds).toLowerCase());
        }
    }
// Only want one of each
    var uniqArray=_.uniq(foundArray, false);
// Now get the names of tags to remove  
    var difArray=_.difference(uniqArray, toKeepArray);
// Loop through unwanted array to form object with properties
    if (difArray.length > 0) {
        var tagobj = {};
        for (itm = 0; itm < difArray.length; itm++) {
            tagobj[difArray[itm]] = "";
        }
        var str = JSON.stringify(tagobj);
        l_handles.UpdateFileInfoFromJSON(str);
    }
}

Blank white panel, double click to process all tracks in active playlist.
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 14:35:47
Hi marc
Thanks for your help on this.

I think I may have mis-understood the meaning of 'clearing existing tags'. I had thought that the tags with the unwanted names would not appear in the properties list. Your code leaves them behind but sets them to null or "" (not sure).
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 14:45:05
No, those tags appear in my properties dialog because they are configured in my advanced preferences. They really don't exist in the file.

Look at "comment" and "album artist". Both are empty before and after.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-01 15:41:10
Just to expand on my previous post (I was out earlier on mobile so couldn't link/do screenshots), the tags appearing in my Properties dialog are defined here...

(https://i.imgur.com/ceNiq49.png)

And the C++ code in the component always deletes all fields sent before attempting to add anything..

https://github.com/19379/foo-jscript-panel/blob/4d36208d172df751773ca353e41c8b62d152e3b1/src/script_interface_impl.cpp#L778

It's only on these following lines when it's determined that the values aren't empty that tags are written...

https://github.com/19379/foo-jscript-panel/blob/4d36208d172df751773ca353e41c8b62d152e3b1/src/script_interface_impl.cpp#L785L786
https://github.com/19379/foo-jscript-panel/blob/4d36208d172df751773ca353e41c8b62d152e3b1/src/script_interface_impl.cpp#L792L793
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2017-11-01 15:48:25
Hi marc
I understand the tags in advanced properties - thanks for the clarification.

I can't get the object method to work so what I did was to generate the object containing tags to be removed and then used _.assign to 'add' it to each object in the array solution and it works fine.

Not sure what I was doing wrong but thanks to you I now have a working solution.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-11 16:14:29
Hey @marc2003 !
I'm trying to change value of the metadata via following code:
Code: [Select]
var file_info = metadb.GetFileInfo();
var rating_meta_idx = file_info.MetaFind('RATING');
if (rating_meta_idx === (-1 >>> 0)){
  file_info.MetaAdd('RATING',new_rating );
}
else {
  file_info.MetaSet(rating_meta_idx,new_rating );
}
But it seems, that this code does not actually modify the file, i.e. it only saves to FileInfo structure and does not save the changes to the file itself.

The following code works properly though:
Code: [Select]
var handle = fb.CreateHandleList();
handle.Add(metadb);
  handle.UpdateFileInfoFromJSON(
  JSON.stringify({
    'RATING': new_rating
  })
);

Am I missing something?
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-11 16:51:03
Funnily enough, I figured those methods were pointless and removed them several days ago.

https://github.com/19379/foo-jscript-panel/commit/4d36208d172df751773ca353e41c8b62d152e3b1

They were obviously part of WSH panel mod but I've never seen them used before.

edit: I suspect they could be used if I added additional methods which do the "writing" part but you know I'm what like... I don't like having multiple ways of doing the same thing and I'm incredibly lazy and incompetent.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-11 17:33:33
Funnily enough, I figured those methods were pointless and removed them several days ago.
They were obviously part of WSH panel mod but I've never seen them used before.
I see, thanks! As long as I have a way to view and edit tags, I don't really care how I achieve that.

Quote
edit: I suspect they could be used if I added additional methods which do the "writing" part but you know I'm what like... I don't like having multiple ways of doing the same thing and I'm incredibly lazy and incompetent.
I'm glad though that we have someone that lazy and incompetent to develop this component :D
Title: Re: JScript Panel
Post by: MojoBass on 2017-11-12 09:13:58
I am trying to use this https://pastebin.com/uJ5fjXW7 (https://pastebin.com/uJ5fjXW7)  code from ExtremeHunter in a JS Panel to show the current Playlist. It is doing what is expected, however crashes eg when jumping to next title ("getPlaylistInfo" is undefined).
Can anyone help how to get this running properly (or suggest an alternative)?
Thanks, MojoBass
Title: Re: JScript Panel
Post by: always.beta on 2017-11-12 10:53:33
however crashes eg when jumping to next title ("getPlaylistInfo" is undefined).
(function getPlaylistInfo() {
...
})();
==Try the following.==
function getPlaylistInfo() {
...
};
getPlaylistInfo();
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-12 11:11:46
^Yep, that is exactly it. Enforcing the use of the chakra javascript engine in IE9 or above breaks those types of functions.
Title: Re: JScript Panel
Post by: MojoBass on 2017-11-12 12:10:13
Great, works perfect!
Thanks to you, always.beta and marc2003 !! Great community here!
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-14 14:50:19
Quick heads up about the next release (no idea when it's coming out as I haven't added anything yet!!)

I''ve removed the gdi.CreateStyleTextRender method. Anything based on the glow text sample.txt script will no longer work.

Code: [Select]
		gdi.CreateStyleTextRender([pngmode]); (IStyleTextRender)
// pngmode: boolean, default false.
// see samples\basic\Glow Text Sample.txt

interface IStyleTextRender {
Methods:
// ---- outline mode ----
OutLineText(text_color, outline_color, outline_width);
DoubleOutLineText(text_color, outline_color1, outline_color2, outline_width1, outline_width2);
GlowText(text_color, glow_color, glow_width);

// ---- shadow ----
EnableShadow(enable);
ResetShadow();
// it's recommended to call ResetShadow() directly after EnableShadow()
Shadow(color, thickness, offset_x, offset_y);
// default shadow, used in solid shadow colour
DiffusedShadow(colour, thickness, offset_x, offset_y);
// soft shadow

// while using DiffusedShadow(), these two methods below are useful
SetShadowBackgroundColor(colour, width, height);
SetShadowBackgroundImage(img);

// ---- Render ----
// Not recommended if the flags contains something like "center". it won't
// work properly because of the lack of width and height information.
RenderStringPoint(g, str, font, x, y[, flags]);
RenderStringRect(g, str, font, x, y, w, h[, flags]);
SetPngImage(IGdiBitmap);
// Only in pngmode, the image should be a transparent image created by gdi.CreateImage().
}
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 13:38:46
Hey again @marc2003 !
I've found an inconsistency in the interface description and it's implementation:
In interfaces.txt plman.IsPlaylistItemSelected is described to have boolean return type, but actually it has a UINT return type.
Code: [Select]
fb.trace(typeof plman.IsPlaylistItemSelected(plman.ActivePlaylist, 0) === "boolean");
// false
This causes some checks to fail, when strong comparison is used with other bool values (i.e. '===', instead of '==').
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 13:51:00
Well spotted. It was added before my time but it should be fixed now (https://github.com/19379/foo-jscript-panel/commit/160f3677cd4edc6be038ab70c1c8301af0325dda).
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 13:55:57
Thanks =)

To anyone using IntelliJ WebStorm or IDEA to create\edit scripts:
I've made a JSDoc'd version of JScript's interface.txt (with param and return types specified), which can be used as plugin in IDEA/WebStorm.
This will remove all the undefined symbol warnings and will also provide some type checks, when using JScript interface.

Instructions:
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 14:05:58
Do you really need the Ultimate edition for Javascript support??
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 14:11:25
Do you really need the Ultimate edition for Javascript support??
Regretfully, yeah.

There is WebStorm IDE from the same dev ( https://www.jetbrains.com/webstorm ), which contains only JavaScript features from IDEA Ultimate, but has price that is much more humane ( https://www.jetbrains.com/webstorm/buy/#edition=personal ).

PS: There is a very simple way to activate Ultimate IDEA semi-permanently though (which I can't discuss here, but PM me if interested).
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 14:35:04
Thanks but I'll pass. I'll continue slumming it with Notepad++ for now.  :P
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-15 15:40:35
@marc2003 :
Btw, what about interface methods that can return -1? Shouldn't their return type be INT instead of UINT? Otherwise the return value of -1 will be equal to UINT_MAX and thus will require workarounds for strong comparisons with -1:
Code: [Select]
// Example

fb.trace(file_info.MetaFind('AZAZA') === -1, file_info.MetaFind('AZAZA') === (-1 >>> 0));
// false true
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-15 16:27:51
MetaFind and InfoFind don't return -1. This is directly from the foobar2000 SDK...

https://github.com/19379/foo-jscript-panel/blob/133af6edb43598179cc7dd60ea4f4135a2a92457/foobar2000/SDK/file_info.h#L99L100

I did clarify the docs (https://github.com/19379/foo-jscript-panel/blob/e2793273655621c9b162ea4575313582462b52bd/foo_jscript_panel/docs/Interfaces.txt#L1277L1285) the other day when I realised it wasn't clear...

Quote
InfoFind(name);
// returns idx. if found the value will be lower than InfoCount

MetaFind(name);
// returns idx. if found the value will lower than MetaCount
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-17 03:42:27
I've been checking the docs and there is some inconsistency where some methods return 4294967295 (or Math.pow(2, 32) -1) for things that aren't found and others are returning -1. I shall be making this consistent in the next update by using -1 for all because it's what people are used to when using Javascript.

edit: I've updated the Breaking Changes page on the wiki with the upcoming changes...

https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v131
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-17 12:31:06
v1.3.1 Beta1 (final release notes a few posts down)

Unfortunately, nothing new but fixes a few things and updates the docs to be more consistent. It's a beta because it has a few internal changes and I might not have caught everything.

https://github.com/19379/foo-jscript-panel/releases

My own "status bar.txt" sample in the "complete" folder was broken by this update so anyone else using it will need to re-import.
Title: Re: JScript Panel
Post by: Decalicatan_Decalicatan on 2017-11-18 19:25:03
Out of curiosity, is there a reason why to remove the  IStyleTextRender interface?

Also, do you know if it possible, in a JS Smooth Playlist panel to reorder the tracks within playlist withdrag n' drop ? I can't do it. Too bad because it's possible with JSPlaylist (which is... not smooth sadly).
Maybe only Falstaff could tell...

Thanks anyway for your great component!
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-19 05:14:34
The styletextrender thingy required an entire 3rd party project to be part of the Visual Studio solution and I selfishly got rid of it because I never use it. I know I should try and be more considerate of others but I'm mean!!  ;D WSH panel mod still works and there is WSH panel mod plus which shares many of the newer features with JScript Panel.

As for the playlist, you know the answer. They both use the same component!
Title: Re: JScript Panel
Post by: J.Fleming on 2017-11-20 09:03:03
Any chance of a non SSE2 build?

(http://tommycatkins.com/2017/jscript_nonsse2.png)

:(

I thought maybe version 1.1.0 might work, but sadly, the author has removed all binaries on Github earlier than version 1.2.4.

Edit - I'm trying to run this on a XP machine. Saw in the changelog that 1.3.0 drops IE8/IE7/WINE support. So I tried 1.2.4 and got the same error. It's SSE2 related. Wish I knew how to compile it so I could try to do so with SSE2 requirement disabled.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-20 09:45:48
This component has never ran on XP. Older versions with support for IE7/IE8 still required Vista or above.

The component it was based on (WSH panel mod) still runs on XP because it hasn't been updated since 2012...

https://code.google.com/archive/p/foo-wsh-panel-mod/downloads
Title: Re: JScript Panel
Post by: J.Fleming on 2017-11-20 09:52:04
OK, that makes sense, thanks! :)
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-23 08:43:30
Code: [Select]
v1.3.1
- FIX: Fixed a bug where plman.IsPlaylistItemSelected didn't return a proper boolean
       value. Thanks to TheQwertiest for reporting.
- FIX: Fixed a bug where plman.ShowAutoPlaylistUI didn't always return the correct
       boolean value.
- CHG: plman.MovePlaylistSelection now returns a boolean value to indicate success
       or failure.
- CHG: Update docs for consistency with actual component behaviour. Some methods
       which returned useless values have been updated to return nothing.
- CHG: On failure, these now return -1
       IFbFileInfo InfoFind
       IFbFileInfo MetaFind
       IFbMetadbHandleList BSearch
       IFbMetadbHandleList Find
       plman.ActivePlaylist
       plman.CreateAutoPlaylist
       plman.PlayingPlaylist
       This could potentially break some existing scripts. See
       https://github.com/19379/foo-jscript-panel/wiki/Breaking-Changes#v131
- CHG: Remove the whole IStyleTextRender interface. Anything that uses
       gdi.CreateStyleTextRender or was based on "glow text sample.txt"
       will no longer work
- CHG: Remove these IFbPlaylistRecyclerManager properties/methods:
       Id
       FindById
       RestoreById

No changes since beta.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: carp on 2017-11-23 13:00:49
With 1.3.1 and DarkOne4Mod, I now get the following error:

JScript Panel (DarkOne4Mod - Cover Panel v1.0 build20160929 by tedGo, includes partial code by T.P Wang)
Laufzeitfehler in JavaScript:
Das Objekt unterstützt die Eigenschaft oder Methode "CreateStyleTextRender" nicht
File: <main>
Line: 10, Col: 1
<source text only available at compile time>

Ist there a chance to correct this error?
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-23 13:06:31
With 1.3.1 and DarkOne4Mod, I now get the following error:

JScript Panel (DarkOne4Mod - Cover Panel v1.0 build20160929 by tedGo, includes partial code by T.P Wang)
Laufzeitfehler in JavaScript:
Das Objekt unterstützt die Eigenschaft oder Methode "CreateStyleTextRender" nicht
File: <main>
Line: 10, Col: 1
<source text only available at compile time>

Ist there a chance to correct this error?

See post above you:
Quote
- CHG: Remove the whole IStyleTextRender interface. Anything that uses
       gdi.CreateStyleTextRender or was based on "glow text sample.txt"
       will no longer work
Title: Re: JScript Panel
Post by: carp on 2017-11-23 13:44:14
Thanks! So I have to wait for Tedgo to update his DarkOne4Mod. Is the previous version 1.3.0 of JScript Panel still available as a foobar2000 component?
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-23 13:56:22
Replace the code in the panel with this...

https://pastebin.com/tLqCXvH3
Title: Re: JScript Panel
Post by: carp on 2017-11-23 14:17:45
Thank you marc2003! This works!  :)
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-24 10:15:48
Encountered a small bug in panel properties:
If you select an entry and then scroll, the entry's value will remain at the same (but wrong) place. For example:
(http://i.imgur.com/pwQUrUO.gif) (https://imgur.com/pwQUrUO)
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-24 11:30:05
I find that pretty hard to reproduce but I do get the occasional flicker.

FWIW, it looks like 3rd party PropertyList (https://github.com/19379/foo-jscript-panel/tree/master/PropertyList) library is to blame but I have no idea how to fix it.
Title: Re: JScript Panel
Post by: widerock on 2017-11-24 13:41:43
- CHG: Remove the whole IStyleTextRender interface. Anything that uses
       gdi.CreateStyleTextRender or was based on "glow text sample.txt"
       will no longer work

Is there anything to replace " gdi.CreateStyleTextRender" thing?
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-11-24 20:30:11
I find that pretty hard to reproduce but I do get the occasional flicker.
I can consistently reproduce it though. The easiest way:
1. Open property list that is big enough to have scrollbar.
2. Click on top item to make it 'blue'.
3. Click on 'arrow down' button on scrollbar.
Result: value of first item is wrong now and matches the selected 'blue' item.

FWIW, it looks like 3rd party PropertyList (https://github.com/19379/foo-jscript-panel/tree/master/PropertyList) library is to blame but I have no idea how to fix it.
I've tried debugging a bit (lib is back from 2003, lol), but couldn't find the exact source of the problem. I've managed to prevent the bug from happening by removing "bHandled = FALSE" from OnLButtonUp method (PropertyList.h:605). But that's just brute-force programming -_-. This lib should be probably replaced some day with the more robust one (and may be a bit younger than 14 years old).
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-24 21:34:37
I've managed to prevent the bug from happening by removing "bHandled = FALSE" from OnLButtonUp method (PropertyList.h:605).

Doing that results in crazy buggy behaviour.  :o  :o 
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-25 04:32:43
Code: [Select]
v1.3.2
- FIX: Improved handling of utf8 files without BOM. This affects files loaded
       via the PREPROCESSOR section and the Configuration window>Tools>Import button.
       They should now be treated the same as files with BOM.

https://github.com/19379/foo-jscript-panel/releases
Title: Re: JScript Panel
Post by: MordredKLB on 2017-11-27 20:15:23
Is there anything to replace " gdi.CreateStyleTextRender" thing?
I have the same question. My theme is using a bunch of TextRender stuff (GlowText, Shadow, RenderStringRect, etc.) and that's broken now. I had to roll back to 1.2.4 because I'm not sure what, if any, alternatives I've got.
Title: Re: JScript Panel
Post by: marc2003 on 2017-11-29 13:26:05
Since I can't help myself breaking things, I've removed the component from the official repository. At least now people can't blindly update using the components updater.

If people want to update, they should check the changelog and download manually from github.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-01 10:33:08
Yay for fb.AlwaysOnTop!
Btw, do you know if it's possible to make on_main_menu_command_status_changed callback with fb2k api?
Title: Re: JScript Panel
Post by: widerock on 2017-12-01 15:31:11
Recently, I've got this message.

JScript Panel (JS Smooth Browser v20151114-1630-340 by Br3tt aka Falstaff >> http://br3tt.deviantart.com)
JavaScript Runtime error:
Overflow
foo_jscript_panel\samples\js-smooth\js\jssb.js
Line: 1090, Col: 3
<source text only available at compile time>

I've looked into that line.
Code: [Select]
this.cursorImage_normal = gdi.CreateImage(this.cursorw, this.cursorh);

Could anyone let me know how I can fix it?
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-01 15:33:24
Yay for fb.AlwaysOnTop!
Btw, do you know if it's possible to make on_main_menu_command_status_changed callback with fb2k api?

I can't give a definitive answer but I'm pretty sure it's not possible.

However, it looks like other components may use the config_object API and that would give other components (like JScript Panel) the option to read/write/get notified of their settings changes. Of course they'd have to make this public knowledge if it's already implemented.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-12-02 11:29:30
ok, just forget it...
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-02 11:41:40
No. If you don't want to use the preprocessor, that's your problem - not mine.
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-02 15:42:54
Recently, I've got this message.

JScript Panel (JS Smooth Browser v20151114-1630-340 by Br3tt aka Falstaff >> http://br3tt.deviantart.com)
JavaScript Runtime error:
Overflow
foo_jscript_panel\samples\js-smooth\js\jssb.js
Line: 1090, Col: 3
<source text only available at compile time>

I've looked into that line.
Code: [Select]
this.cursorImage_normal = gdi.CreateImage(this.cursorw, this.cursorh);

Could anyone let me know how I can fix it?

I can't reproduce this at all?? I thought it might be related to panel size but even resizing as small as possible doesn't do anything.

Does it error on startup or is it some time later?
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-03 09:27:03
Code: [Select]
v1.3.2.1
- ADD: Add fb.AlwaysOnTop property. Can be used to read or write the setting. A
       new "on_always_on_top_changed" callback has been added to detect when it
       changes via any other means such as using the menu, keyboard shortcuts, etc.

https://github.com/19379/foo-jscript-panel/releases


Title: Re: JScript Panel
Post by: widerock on 2017-12-03 13:24:28
Quote
I can't reproduce this at all?? I thought it might be related to panel size but even resizing as small as possible doesn't do anything.

Does it error on startup or is it some time later?

This happens on startup, and when I reload after startup, it's OK.
Title: Re: JScript Panel
Post by: J.Fleming on 2017-12-13 02:02:32
I need an older version of Jscript Panel that supports Foobar 1.2.4.

Sadly, the developer is one of those developers that completely obliterates all older versions of his work and only has the latest available, with no way to download older versions. That is not user friendly, at all.

If anyone knows of a place where I can download previous versions of Jscript Panel and not get nailed with malware I would greatly appreciate a reply or a PM if that's not allowed.


Edit - Looks like the component always needed 1.3. Would just delete the post, but the forums don't give users that option.
Title: Re: JScript Panel
Post by: praktis.pa.01 on 2017-12-13 08:34:34
What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-13 11:04:55
Edit - Looks like the component always needed 1.3.

Well it was released over 3 years ago and my component has only been around for 2 years. :/

What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.

Sorry, I have no idea. I guess looking up windows script host would be your best bet.
Title: Re: JScript Panel
Post by: J.Fleming on 2017-12-14 02:45:16
Here's some info that may help someone (and public notes for myself; I tend to do that)...

I use the DarkOne v4 mod (https://tedgo.deviantart.com/art/DarkOne-v4-360862076). That was set up with Foobar 1.2.x - I had 1.2.4 - so I figured updating to Foobar 1.3.x would bomb it.

I had a test machine available so I just tried running the Foobar 1.3.17 installer over top of 1.2.4. The installer has an "Update" button so I clicked it and prayed.

It does in fact seem that DarkOne v4 all survives the update. Everything seems to look and work fine.

So, I was finally able to install the Jscript Panel v1.3.2.1 (https://github.com/19379/foo-jscript-panel/releases), and Biography 0.8.5.2 (https://hydrogenaud.io/index.php/topic,112913.msg945845.html#msg945845).

For DarkOne v4, there are two unused reserved panels on the right (nice foresight by the author), so I made a "BIO2" panel on one of the reserves, added the Jscript panel, then imported the Biography script. It seems to work great so far!

(https://tommycatkins.com/2017/DarkOnev4_Foobar1_3_17_JscriptBio.png)

To move the panel position, I right clicked the panel labels, selected "Splitter Settings...", temporarily cleared the "Forced Layout" check boxes for each of the panels, renamed the Jscript Panel to "BIO2", then right clicked and used "Move Up" and "Move Down" to adjust position. I placed BIO2 (Jscript / 0.8.5.2) next to BIO1 (old Biography with CDATA hex edit mod (https://hydrogenaud.io/index.php/topic,70955.msg923149.html#msg923149) - last.fm text works but not images). Finally I went back in to Splitter Settings and re-checked the "Forced Layout" check boxes.
Title: Re: JScript Panel
Post by: elia_is_me on 2017-12-14 16:27:03
What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.
global = this
Title: Re: JScript Panel
Post by: praktis.pa.01 on 2017-12-15 13:35:10
What is the name of the global context in JScript Panel? I have been trying to use it alongside Webpack. I can make it work with a few hacks but if I can just straight up access the global variable I would take it.
global = this

That only works when you're on the top level. If you're calling functions on different contexts (bound functions, as methods, etc), of course this will not point to the global object. In my case I was using a module loader/bundler. Sometimes you may need access to the global within those contexts.

Anyways, I've read a bit, I'm not too sure yet but I found out that the global object is not directly accessible. So there is no other way to access it other than the this keyword or a few quite ugly hacks like so:

Code: [Select]
// in non-strict mode
var _global = (function(){
    return this;
}).call(null);

Just posting as a reference to others who encounters the same problem.
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-15 18:31:31
A very minor release...

Code: [Select]
v1.3.2.2
- ADD: Component now reports version on script error.
- FIX: JSplaylist/JS Smooth playlist have been unable to tag files since v1.3.0
       when foo_playcount was missing.

https://github.com/19379/foo-jscript-panel/releases

I guess anyone using ratings in JSplaylist/JS Smooth playlist must be using foo_playcount because no one has reported the file tagging feature being broken.
Title: Re: JScript Panel
Post by: zeremy on 2017-12-16 11:10:23
A very minor release...

Code: [Select]
v1.3.2.2
- ADD: Component now reports version on script error.
- FIX: JSplaylist/JS Smooth playlist have been unable to tag files since v1.3.0
       when foo_playcount was missing.

https://github.com/19379/foo-jscript-panel/releases

I guess anyone using ratings in JSplaylist/JS Smooth playlist must be using foo_playcount because no one has reported the file tagging feature being broken.

Actually it sort of was reported https://hydrogenaud.io/index.php/topic,110516.msg945862.html#msg945862 , but I guess he is on your ignore list .. ;)
Title: Re: JScript Panel
Post by: marc2003 on 2017-12-16 12:38:01
Ah yes, the good old ignore list. It's just about saved me from getting myself banned!!  :))
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-18 09:08:41
@marc2003 :
It seems that your git got taken down =(
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-18 15:19:24
Judging by the first post of this thread, it seems that marc2003 was either banned or moved to read-only on hydrogenaud.io.
Most likely enraged by such turn of events he deleted his git account (jscript included).
Though I doubt that we'll get the full story anyway...

A shame really, fb2k does not have that many active 3rd party component developers, especially in UI department...
Oh well, thanks @marc2003 for all your hard work! My fb2k experience would not even have been started without your component! =)
Title: Re: JScript Panel
Post by: Jailhouse on 2017-12-18 15:39:00
Damn.... It seems I deleted the last release of the component after installing it. Can someone link me to a copy?
Title: Re: JScript Panel
Post by: MojoBass on 2017-12-19 04:33:31
it seems that marc2003 was either banned or moved to read-only on hydrogenaud.io.
This is bad news :-(
Does anyone understand what has happened (was not even aware that someone can be 'banned' here - and by whom and for which 'crimes'?) ?
Any chance to bring Marc back?
Title: Re: JScript Panel
Post by: kode54 on 2017-12-19 05:59:12
He apparently went off his meds and/or experienced a psychotic break, as he felt the need to use harsh language to demoralise someone for daring to ask him to do something he didn't want to do, and was placed on moderator approval for what was supposed to be a few days. Instead, he decided to ask the staff to ban him, so his users would know he was being "censored" by the moderation team. When he didn't get that, he decided to edit some swearing into his old posts, through the combination of moderator preview, but also the free editing of the Developer profile. Now I see he has thrown a temper tantrum and deleted his Github again. Maybe he'll cool down and come to his senses again, maybe not.
Title: Re: JScript Panel
Post by: zeremy on 2017-12-19 07:04:08
Code: [Select]
Star articlePublish article	Re: script to update all music library to 1.3.2 — greynol  Collapse article	Dec 16, 20:53	0
I guess he has no reasonable answer other than he's opposed to rational and level-headed discussion(?).

Can you moderators enforce  rational and level-headed discussion in those vinyl topics also !!!!!
Title: Re: JScript Panel
Post by: redorb on 2017-12-19 09:05:26
Damn.... It seems I deleted the last release of the component after installing it. Can someone link me to a copy?
I could do that. Are we allowed to? Any mods around that can OK this?
Title: Re: JScript Panel
Post by: jazzthieve on 2017-12-19 09:30:40
Just go ahead, no problem uploading recent components. Only with outdated banned components mods might take issue.
Title: Re: JScript Panel
Post by: redorb on 2017-12-19 09:36:09
Just go ahead, no problem uploading recent components. Only with outdated banned components mods might take issue.
OK!
Here it is in a rar file: foo_jscript_panel-v1.3.2.2.rar
http://www.filedropper.com/foojscriptpanel-v1322
Title: Re: JScript Panel
Post by: MojoBass on 2017-12-19 12:16:27
@kode54: so marc2003 has still read-access here? (he can still see us?)
Title: Re: JScript Panel
Post by: MojoBass on 2017-12-19 12:24:44
ok, stupid question... everybody can read w/o registration :-)
@marc2003: Hope you'll be back soon!
Title: Re: JScript Panel
Post by: davideleo on 2017-12-19 14:07:51
He apparently went off his meds and/or experienced a psychotic break, as he felt the need to use harsh language to demoralise someone for daring to ask him to do something he didn't want to do, and was placed on moderator approval for what was supposed to be a few days. Instead, he decided to ask the staff to ban him, so his users would know he was being "censored" by the moderation team. When he didn't get that, he decided to edit some swearing into his old posts, through the combination of moderator preview, but also the free editing of the Developer profile. Now I see he has thrown a temper tantrum and deleted his Github again. Maybe he'll cool down and come to his senses again, maybe not.

I saw it coming :))  :))  :)) Sorry if this is not politically correct, but I find it hilarious. I have no idea what kind of person marc2003 actually is, but I picture him like a sort of Sheldon Cooper: a misanthropic sarcastic and hysterical geek. Interacting with him on the forum is like walking on eggshells, but at a safe distance it's pure fun.
Title: Re: JScript Panel
Post by: Jailhouse on 2017-12-19 16:35:00
Here it is in a rar file:
Appreciated, but I am without the ability to open it since I uninstalled an archiving application that kept crashing Windows Explorer. Can you create a zip file for me, or are you going to make me install 7-Zip?  ;D
Title: Re: JScript Panel
Post by: redorb on 2017-12-19 17:08:19
OK!
Here is the file:
http://www.filedropper.com/foojscriptpanel-v1322_2
Title: Re: JScript Panel
Post by: Jailhouse on 2017-12-19 22:25:05
@redorb  Got it, thanks. I feel much better now.
Title: Re: JScript Panel
Post by: kode54 on 2017-12-21 02:11:24
Sorry if this is not politically correct, but I find it hilarious.

I only speak from experience, but I don't recall my one major episode or any other minor episodes having an effect on my posting ability, other than merely silencing it, as I tended to stay offline when I was really in moods, because I didn't really have the competency to handle operating a computer properly while in those moods.

I know another developer who has exploded at people from mood swings, but they've mostly gotten that under control, and mostly stay away from places that make them angry.

I wonder if @marc2003  knows that his posts were not blocked, but merely invisible to all but the moderators for the <hours it would take them to approve something, and that the status was meant to be removed within a day or two? Such a problem.

I see he has attempted to lock himself out by setting his own email address to an invalid address. I can undo that.
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-21 04:01:47
This sucks. @marc2003 hope you come back. This component is easily one of the most useful out there, and you've benefited a lot of people with your work.

On the off chance that he's gone for good, did anyone fork the original repo?
Title: Re: JScript Panel
Post by: zeremy on 2017-12-21 07:30:33
This sucks. @marc2003 hope you come back. This component is easily one of the most useful out there, and you've benefited a lot of people with your work.

On the off chance that he's gone for good, did anyone fork the original repo?

@MordredKLB
You can find it @ http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581 (http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581)

@marc2003
Whatever you decide to do , I wish you the best.
Take a break , you deserve it.

@kode54
It would benefit all to send such misbehavior to the  dedicated recycle-bin of the forum instead of deleting it.
 
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-21 09:25:03
On the off chance that he's gone for good, did anyone fork the original repo?
I have a fork with commits up to v1.3.2.1 (w/o wiki and actual releases though): https://github.com/TheQwertiest/foo-jscript-panel
But v1.3.2.2 commits are lost :\

You can find it @ http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581 (http://foobar2000.ru/forum/viewtopic.php?p=67581#p67581)
Regretfully they don't have v1.3.2.2 sources...
Title: Re: JScript Panel
Post by: davideleo on 2017-12-21 21:09:39

I only speak from experience, but I don't recall my one major episode or any other minor episodes having an effect on my posting ability, other than merely silencing it, as I tended to stay offline when I was really in moods, because I didn't really have the competency to handle operating a computer properly while in those moods.

I know another developer who has exploded at people from mood swings, but they've mostly gotten that under control, and mostly stay away from places that make them angry.

Why is it so hard for developers to keep calm on the internet? The most aggressive people I've met on the web (I'm not talking about marc2003, who is a pretty cool guy at the end of the day) were in forums about programming languages.
Title: Re: JScript Panel
Post by: kode54 on 2017-12-22 00:50:51
@kode54
It would benefit all to send such misbehavior to the  dedicated recycle-bin of the forum instead of deleting it.
I wasn't the moderator who deleted it (to the trash forum, which is hidden.) And said moderator had one of his own posts deleted for the same thing many months ago, which drove him away from the forum for four or five months.
Title: Re: JScript Panel
Post by: Peter on 2017-12-22 13:53:53
For reference, marc2003's full posting ability was restored a while ago ( by myself ) as mod preview was in my opinion by far unnecessary. I only wish I had gotten to this sooner.
Anyway, let's not drag the thread further off-topic from here on and hope for the best.
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-22 20:50:33
I have a fork with commits up to v1.3.2.1 (w/o wiki and actual releases though): https://github.com/TheQwertiest/foo-jscript-panel
But v1.3.2.2 commits are lost :\
That's a lot better than nothing. Sounded like v1.3.2.2 was a real minor release.

Hopefully marc2003 will restore the repo himself though, and we won't need to worry about this stuff.
Title: Re: JScript Panel
Post by: praktis.pa.01 on 2017-12-26 09:53:35
If worse comes to worse and jscript-panel is abandoned, do any of you want to collaborate on a new project?
Title: Re: JScript Panel
Post by: stardeath on 2017-12-26 21:11:28
seems like my local version is from the 2017-12-16, commit 20b1d71, i don't know if i will be able to keep git history, but i can make a zip of the source if someone is interested.
Title: Re: JScript Panel
Post by: MediterraneanMonkSeal on 2017-12-27 02:23:30
v2.0.0-dev???
https://github.com/marc2k3/foo_jscript_panel
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-27 09:05:42
seems like my local version is from the 2017-12-16, commit 20b1d71, i don't know if i will be able to keep git history, but i can make a zip of the source if someone is interested.
Can you create a format-patch from 'af50da9d8cb7176c2cd6877333316f5b90311740' to your latest commit, please?

E.g.:
Code: [Select]
git format-patch af50da9 --stdout > my.patch
Title: Re: JScript Panel
Post by: stardeath on 2017-12-27 20:18:35
here, another attempt : http://text-share.com/view/b5d73a88
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-27 20:31:27
hope this ok : https://nofile.io/f/7V0aVp7TNR2/foo-jscript-panel.patch
"File Not found" =(
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-28 05:43:33
v2.0.0-dev???
https://github.com/marc2k3/foo_jscript_panel
Seems like it. Development is continuing on it seems.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-28 09:00:16
here, another attempt : http://text-share.com/view/b5d73a88
This one is fine, thanks!

[EDIT]: Thanks to @stardeath we now have v1.3.2.2 repo with commit history and stuff =)
https://github.com/TheQwertiest/foo-jscript-panel/tree/vanilla
Title: Re: JScript Panel
Post by: J.Fleming on 2017-12-28 11:06:57
He apparently went off his meds and/or experienced a psychotic break, as he felt the need to use harsh language to demoralise someone for daring to ask him to do something he didn't want to do, and was placed on moderator approval for what was supposed to be a few days. Instead, he decided to ask the staff to ban him, so his users would know he was being "censored" by the moderation team. When he didn't get that, he decided to edit some swearing into his old posts, through the combination of moderator preview, but also the free editing of the Developer profile. Now I see he has thrown a temper tantrum and deleted his Github again. Maybe he'll cool down and come to his senses again, maybe not.

Thanks for chasing away a long standing contributor of useful scripts and mods for Foobar. Maybe use some diplomacy when communicating with a major contributor so as not to achieve this negative of a result?
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-28 11:22:38
Thanks for chasing away a long standing contributor of useful scripts and mods for Foobar. Maybe use some diplomacy when communicating with a major contributor so as not to achieve this negative of a result?
While I agree that situation in that thread could have been handled better, I'm strongly against preferential treatment you are talking about. We have forum rules for a reason. Adding exceptions to these rules will only make moderating much more subjective, potentially resulting in conflicts, flaming, bashing and etc which could have been avoided otherwise :\
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-28 15:16:52
Hey Qwertiest, how would you feel about adding a CheckFont style function to see if a font is loaded on a system. Seems cleaner than try/catch's and allows for smarter fallback.
Title: Re: JScript Panel
Post by: TheQwertiest on 2017-12-28 15:23:22
Hey Qwertiest, how would you feel about adding a CheckFont style function to see if a font is loaded on a system. Seems cleaner than try/catch's and allows for smarter fallback.
But we already have utils.CheckFont()? =)
Title: Re: JScript Panel
Post by: MordredKLB on 2017-12-30 03:59:16
But we already have utils.CheckFont()? =)
Haha, guess I never noticed since it was under Utils, and not GDI. Thanks!
Title: Re: JScript Panel
Post by: Mrakobes on 2018-01-09 21:32:53
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?
Title: Re: JScript Panel
Post by: jazzthieve on 2018-01-10 06:40:05
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?

I doubt he'll be very responsive. Read the posts on page 17. Also, you're asking a question about a script that's not even marc's. He's not the author of jsplaylist-mod.
Title: Re: JScript Panel
Post by: always.beta on 2018-01-10 06:42:38
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?
Drag to change the width of the cover column.
Title: Re: JScript Panel
Post by: Mrakobes on 2018-01-10 08:12:51
Drag to change the width of the cover column.
columns change the width and cover is not((
Title: Re: JScript Panel
Post by: Mrakobes on 2018-01-10 08:29:30
columns -> ststus -> visible>>>>checkboks! Thx
Title: Re: JScript Panel
Post by: Jailhouse on 2018-01-10 17:21:07
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?

I doubt he'll be very responsive. Read the posts on page 17. Also, you're asking a question about a script that's not even marc's. He's not the author of jsplaylist-mod.
It's in his Samples folder. It's his modified version of Br3tt's script.
Title: Re: JScript Panel
Post by: loz on 2018-01-10 19:44:02
I'm using your new development marc2k3/foo_jscript_panel, tell me how to change the size of the cover in the playlist on jsplaylist-mod?

I doubt he'll be very responsive. Read the posts on page 17. Also, you're asking a question about a script that's not even marc's. He's not the author of jsplaylist-mod.
He's still active on the foobar2000 subreddit (as you can see here https://www.reddit.com/r/foobar2000/comments/7nmndb/jscript_panel_v2_beta/). May want to try there if you don't find what you're looking for here.
Title: Re: JScript Panel
Post by: jazzthieve on 2018-01-11 12:05:36
It's in his Samples folder. It's his modified version of Br3tt's script.

Yeah, I got some scripts too that I modified to my own desire, but they're not mine. As I said, marc's not the author of  jsplaylist-mod.
Title: Re: JScript Panel
Post by: Jailhouse on 2018-01-11 15:37:48
It's in his Samples folder. It's his modified version of Br3tt's script.

Yeah, I got some scripts too that I modified to my own desire, but they're not mine. As I said, marc's not the author of  jsplaylist-mod.
Which never kept him from supporting it in the past.
Title: Re: JScript Panel
Post by: jazzthieve on 2018-01-11 15:56:18
Is there anything meaningful you're trying to contribute here other that starting a useless discussion? He's not the author, period. And he's not here for now. Don't waste my or anyone else's time with useless discussion and next time before you comment ask yourself this "what useful information am I contributing here".  Have a nice day.
Title: Re: JScript Panel
Post by: colagen on 2018-01-24 18:47:43
Anyway, this jscript component work quite well now. The BIG thing missing in this component is the ability to drag a selection of songs out of a jscript panel, drag and drop is something quite essential to any UI (yes it's possible to drop into, but not to drag out). Maybe if one day a c++ developer come here and have some free time that he's willing to spend on this, then we'll have a component with everything in it : )
Title: Re: JScript Panel
Post by: jazzthieve on 2018-02-02 02:20:33
I can't seem to find the Recent Tracks script in the new 2.0.1 beta sample pack. It used to be included with lastfm artist info- user charts sample. Has it been moved to a separate script sample or has it been bumped out of the sample pack?
Title: Re: JScript Panel
Post by: colagen on 2018-02-08 23:50:31
Anyway, this jscript component work quite well now.

I must say, it work even better with the 2.0 update, thanks marc2003 if one day you read that! It's a lot faster with the Chakra script engine
Title: Re: JScript Panel
Post by: kode54 on 2018-02-09 02:41:22
I reset his account email address ages ago, so he'll be able to get back in, but he'll have to request that it send the activation mail again.
Title: Re: JScript Panel
Post by: rolf1955 on 2018-02-10 16:28:13
Since "JScript panel 2.01+" my "JS Smooth Playlist Manager" is not working any more.

Any ideas?

PS : Nice work!
Title: Re: JScript Panel
Post by: davideleo on 2018-02-13 10:40:25
Out of curiosity, how many of you are switching to version 2 or higher?
Right before marc2003 took over the project, there were quite a few unofficial WSH panel versions around and making sense out of the various script samples and contributions was kind of a mess. The advent of JScript panel put an end to this, and I happily resolved to align all of my scripts to the new standard. But now, since marc2003 left, I have the feeling the development is once again at random. At first I thought the best decision would be to stick to the last official JScript panel version, but now I see many are updating their scripts.
I learn a lot form other people's scripts and being familiar with the version they are using is crucial, let alone testing the scripts requires the right version of the component. So - my survey is especially addressed to the more active scripters - how are you dealing with marc2003's new developments?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-02-13 12:20:00
how are you dealing with marc2003's new developments?
Most of the breaking changes are documented (https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes), so dealing with those is not that hard, unless, of course, your script does heavily rely on the removed\deperecated functionality.
All the other changes are usually documented in release changelogs.

Also only v2.+ of JScript utilizes new fb2k SDK, thus being the only option, if you want to fit more components before reaching the max component cap.
Title: Re: JScript Panel
Post by: davideleo on 2018-02-13 13:13:33
Most of the breaking changes are documented (https://github.com/marc2k3/foo_jscript_panel/wiki/Breaking-Changes), so dealing with those is not that hard, unless, of course, your script does heavily rely on the removed\deperecated functionality.
All the other changes are usually documented in release changelogs.
Yes, that's understood. What I'm asking is whether you resolved to follow marc2003 updates (or maybe one of the new updates, but not the latest) or if you are sticking with JScript panel v1.3.2.2.


Also only v2.+ of JScript utilizes new fb2k SDK, thus being the only option, if you want to fit more components before reaching the max component cap.
I didn't really get this: what are the limitations I have with previous JScript panel versions? And what is the max component cap?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-02-13 13:42:31
Yes, that's understood. What I'm asking is whether you resolved to follow marc2003 updates (or maybe one of the new updates, but not the latest) or if you are sticking with JScript panel v1.3.2.2.
Welp, to quote myself from CaTRoX release:
...
Added
  • Added compatibility fixes for vanilla JScript v2.0.0 component.
...
:D

@WilB migrated all his scripts to v2 as well.


I didn't really get this: what are the limitations I have with previous JScript panel versions? And what is the max component cap?
I have not researched it thoroughly, but from what I gathered:

Simplified description: potentially you can have no more than 128 components (actually less) that were build with static VC runtime (that is 99.9% of the components built with old fb2k SDK). Components with dynamic VC runtime do not count towards that limit (components built with new fb2k SDK usually use dynamic runtime).

Full description: https://hydrogenaud.io/index.php/topic,110142.msg907834.htm
Title: Re: JScript Panel
Post by: MojoBass on 2018-02-18 05:15:10
v2.0.4 released: https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.4 (https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.4)
Credits to marc2k3
Title: Re: JScript Panel
Post by: MojoBass on 2018-03-03 05:28:23
v2.0.5 released: https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.5 (https://github.com/marc2k3/foo_jscript_panel/releases/tag/v2.0.5)
Credits (again) to marc2k3
Title: Re: JScript Panel
Post by: rolf1955 on 2018-03-09 14:19:29
Since "JScript panel 2.01+" my "JS Smooth Playlist Manager" is not working any more.

Any ideas?

PS : Nice work!

Works! - Closed -
Title: Re: JScript Panel
Post by: seriousstas on 2018-03-27 13:45:23
Please RETURN EnableMenuItem
This is an important function and other replacements are not convenient - THANKS!
Title: Re: JScript Panel
Post by: MordredKLB on 2018-03-27 17:40:19
Please RETURN EnableMenuItem
This is an important function and other replacements are not convenient - THANKS!
It was a needlessly duplicated method and it won't be coming back. See the discussion starting here: https://hydrogenaud.io/index.php/topic,110516.msg954181.html#msg954181
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2018-03-28 11:52:23
Is it possible that some (hopefully short!) time in the future that we could use Lodash v 4.17.5 libraries with our scripts?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-03-28 12:57:51
Is it possible that some (hopefully short!) time in the future that we could use Lodash v 4.17.5 libraries with our scripts?
But we can? =)
E.g. my theme uses it. For full v4.17.5 support you only need enabled Chakra engine + SetTimeout/SetInterval shims.
Of course all your scripts need to be updated to reflect lodash changes (since there are incompatibilities with v3.10.2 that is used in marc2003 samples).
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2018-03-28 13:18:56
This sounds great news. Just one question then. My scripts currently have the following line at the top;

// @import "%fb2k_component_path%samples\complete\js\lodash.min.js"

Is there a file for the later Lodash library?
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-03-28 13:28:39
It can be downloaded from official repository and/or CDN (e.g. https://www.jsdelivr.com/package/npm/lodash)
Title: Re: JScript Panel
Post by: Black_Over_Bills_Mothers on 2018-03-28 14:11:19
Hi TheQwertiest
Thanks for the info. I've downloaded the .js file and have proved it's being used. Great.

I don't understand your earlier remark .....SetTimeout/SetInterval shims.

Could you point me in the right direction for this please.
Title: Re: JScript Panel
Post by: TheQwertiest on 2018-03-28 14:40:47
AFAIK most browsers provide SetTimeout, SetInterval, ClearTimeout, ClearInterval methods, which are needed by the latest lodash. JScript can't provide these methods natively (in global namespace), they can be only accessed via window object (e.g. window.SetTimeout).
So for lodash to become fully functional you have to define these methods somewhere in global namespace through window.* methods.
Title: Re: JScript Panel
Post by: 62a on 2018-03-31 22:34:33
[deleted]
Title: Re: JScript Panel
Post by: year98 on 2018-08-29 23:17:43
Can I have a rudimentary question?
I want to add the follwing titleformat display in the seekbar at the center. I have no idea about jscript. I tried many combination and it all failed. Who can help?

$if(%isplaying%,%_time_elapsed% / %length%,)
https://github.com/marc2k3/foo_jscript_panel/blob/master/foo_jscript_panel/samples/complete/seekbar.txt
Title: Re: JScript Panel
Post by: TimsFong on 2018-09-02 15:04:33
v2.1.7 released:https://github.com/marc2k3/foo_jscript_panel/releases
Title: How to add an extra tag to the listenbrainz submission
Post by: fuffi on 2018-11-29 21:48:25
After reviewing my listens on the listenbrains site, I recognized, that they're "incomplete", because I save remix/version info in the COMMENT Tag, which seems not to be submitted. (also, I did not found any option to tell what should be submitted by the script. Please forgive me, being a old n00b which can't analyze/understand all of your (greatly apreciated!) coding to change it myself without bothering you...)

Maybe you can add Field remappings, like in foo_audioscrobbler ?
The script doesn't use title formatting and I'm not updating it for now.
Hello,
finally, I managed to add my own "feature wish".

If anybody is interested, here is the code. If not, I'll use it as a public note to myself in case updates will overwrite my addition and I'm wondering, why the scrobbles/listens not containing any remix information anymore...  ;-)

How to use it?

Open
Code: [Select]
listenbrainz.js
which is commonly found in
<f2k install dir>\user-components\foo_jscript_panel\samples\complete\js\listenbrainz.js

find the code
Code: [Select]
			var payload = {
track_metadata : {
artist_name : _.first(tags.artist),
release_name : _.first(tags.album),
track_name : _.first(tags.title)
}
};
This is the place where the submitted tags to the listenbrainz server are "generated".

Now add those following lines after the block of code from above. Thats a line after "};"
Code: [Select]
	if (tags.comment) { // fuffi: add comment to tracktitle
var payload = {
track_metadata : {
artist_name : _.first(tags.artist),
release_name : _.first(tags.album),
track_name : _.first(tags.title)+' ('+_.first(tags.comment)+')'
}
};
};  // fuffi
Don't replace any existing code, just add this code, which checks, if a comment-tag exists in the playing track, and if, generate the additional comment-tag after the tracktitle, separated with "(" and ")", which will look like "Artist - Tracktitle (Comment)" or "Tears For Fears - Mad World (World Mix)"
Title: Re: JScript Panel
Post by: Forfit on 2019-05-14 17:39:10
Do it is possibile a function to create custom tag instead only tag as PlayCount?

f.e.: fb.GetNowPlaying().SetJspTag("Playcount", 1);

f.e. i would add a tag (outside the file) "Lyrics" only if file "artist - title.lrc" exist.
SimplePortal 1.0.0 RC1 © 2008-2019