Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: JScript Panel script discussion/help (Read 287916 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: JScript Panel script discussion/help

Reply #625
It is a conflict that occurs when you select in ESLyrics , Lyrics save scheme "Save when 60s or 1/3 of length have played".
I always thought the track title artist information has not changed, and will not affect it. :-[  I've changed the Lyrics save scheme. Thank you.

Re: JScript Panel script discussion/help

Reply #626
Can I compare two objects?
For example.
I have two massive of embedded covers
I need    if (embedded_1[0] == embedded_2[0] ) {.........}

or

var img1 = gdi.Image(img_path + "1.png"),
var img2 = gdi.Image(img_path + "2.png"),

if ( img1  ==  img2 ) {.........}




UR5EQF. Ukraine

Re: JScript Panel script discussion/help

Reply #627
Nope.


Re: JScript Panel script discussion/help

Reply #629
Is there a way to detect if the windows theme, or the screen settings were changed?
I'm late

Re: JScript Panel script discussion/help

Reply #630
Is there a way to detect if the windows theme, or the screen settings were changed?
Can you elaborate your question a bit? =)
Are you talking about Windows (e.g. Windows 10) theme? Or fb2k theme?
And there a lot of various screen settings as well both in fb2k and Windows...

Re: JScript Panel script discussion/help

Reply #631
Is there a way to detect if the windows theme, or the screen settings were changed?
Can you elaborate your question a bit? =)
Are you talking about Windows (e.g. Windows 10) theme? Or fb2k theme?
And there a lot of various screen settings as well both in fb2k and Windows...


I'm talking about the windows 10 theme. I have a script that reads the registry key value of the accent color and other related settings such as transparency mode and whether the accent color is applied to the window titlebar. The script than refreshes panel stack splitter in order to apply the new accent color, if changed. At the moment it is triggered by the on_size and by the on_playback_new_track events, but I would like to execute the script when one of those screen settings is changed, or when a new theme is applied.
I'm late

Re: JScript Panel script discussion/help

Reply #632
Well, there are no such functions in JScript. But you could probably make something with window.setInterval, i.e. get, compare and update theme values from registry every N seconds .

Re: JScript Panel script discussion/help

Reply #633
Well, there are no such functions in JScript. But you could probably make something with window.setInterval, i.e. get, compare and update theme values from registry every N seconds .

I'll give it a look, thanks.
I'm late

Re: JScript Panel script discussion/help

Reply #634
Does anybody have or know of a fairly simple script for an input box?
I'm late

Re: JScript Panel script discussion/help

Reply #635
Does anybody have or know of a fairly simple script for an input box?

I'm trying to replace the quicksearch toolbar with a jscript panel, but I'm not looking for a ready made script, which would probably have the same layout issues that the quicksearch toolbar has.  I've seen some configurations with a jscript searchbox, but they are far too complex to extrapolate the relevant code.
I thought I could build what I needed with the on_key_down and on_key_up events, but perhaps I've been a little too optimistic. What are the basic guidelines? Which callbacks should I use and, by the way, how do I get the proper character codes from key events?
I'm late

Re: JScript Panel script discussion/help

Reply #636
I'm trying to replace the quicksearch toolbar with a jscript panel, but I'm not looking for a ready made script, which would probably have the same layout issues that the quicksearch toolbar has.  I've seen some configurations with a jscript searchbox, but they are far too complex to extrapolate the relevant code.
I thought I could build what I needed with the on_key_down and on_key_up events, but perhaps I've been a little too optimistic. What are the basic guidelines? Which callbacks should I use and, by the way, how do I get the proper character codes from key events?
The issue is that JScript is not a web browser (which is my fucking dream... can you imagine how easy this stuff would be if we could use css/html for displaying panels and stuff -- I digress) so you can't really do an input box without completely faking EVERYTHING. i.e. you'd have to draw a rectangle on the screen. When the user clicks on it you have to draw a carat. When the user presses a key you have to draw a character to the screen and move the carat, you have to redraw on backspaces,.... etc.

I assume it *could* be done and maybe someone has done it, but it sounds awful to me.

There is some good news though. Doing something on keypresses is the easy part! The delete and ctrl-A keys call functions specific to my theme, but ctrl-F and Shift-F will run different foobar searches which might be good enough for you.
Code: [Select]
function on_key_down(vkey) {
var CtrlKeyPressed = utils.IsKeyPressed(VK_CONTROL);
var ShiftKeyPressed = utils.IsKeyPressed(VK_SHIFT);
switch (vkey) {
case VK_DELETE:
RemovePlaylistSelection(activeList, crop = false);
break;
case VK_KEY_A:
CtrlKeyPressed && selectAll();
break;
case VK_KEY_F:
CtrlKeyPressed && fb.RunMainMenuCommand("Edit/Search");
ShiftKeyPressed && !CtrlKeyPressed && fb.RunMainMenuCommand("Library/Search");
break;
}

Re: JScript Panel script discussion/help

Reply #637
There is some good news though. Doing something on keypresses is the easy part! The delete and ctrl-A keys call functions specific to my theme, but ctrl-F and Shift-F will run different foobar searches which might be good enough for you.
Code: [Select]
function on_key_down(vkey) {
var CtrlKeyPressed = utils.IsKeyPressed(VK_CONTROL);
var ShiftKeyPressed = utils.IsKeyPressed(VK_SHIFT);
switch (vkey) {
case VK_DELETE:
RemovePlaylistSelection(activeList, crop = false);
break;
case VK_KEY_A:
CtrlKeyPressed && selectAll();
break;
case VK_KEY_F:
CtrlKeyPressed && fb.RunMainMenuCommand("Edit/Search");
ShiftKeyPressed && !CtrlKeyPressed && fb.RunMainMenuCommand("Library/Search");
break;
}
Thanks a lot! This is the kind of starting point I'm looking for, and thanks for pointing me to the utils interface which for some reason I always fail to take into account. I still can't figure out a reasonable way to determine the character code, though. The combination of keycode and utils.IsKeyPressed is actually enough, but do I really have to go through all possible combinations one by one with a switch statement? Isn't there something like a keyboard mapping? Perhaps some array of values in the registry key?



The issue is that JScript is not a web browser (which is my fucking dream... can you imagine how easy this stuff would be if we could use css/html for displaying panels and stuff -- I digress)
Indeed! I'm still waiting for the sciter ui plug-in.



so you can't really do an input box without completely faking EVERYTHING. i.e. you'd have to draw a rectangle on the screen. When the user clicks on it you have to draw a carat. When the user presses a key you have to draw a character to the screen and move the carat, you have to redraw on backspaces,.... etc.


I assume it *could* be done and maybe someone has done it, but it sounds awful to me.
Yes, someone has. There is one in colagen's eole skin, even though I think the script is taken from the DUItunes skin by Falstaff. The code that implements the searchbox - at least where I'm able to recognize it - is within my reach, but it is hidden in longer multipurpose scripts, specific for that particular configuration or layout and with a maze of crossfererence to other js documents that make reading it a real pain in the neck, unless you are the author, I guess.
I'm late

 

Re: JScript Panel script discussion/help

Reply #638
[Thanks a lot! This is the kind of starting point I'm looking for, and thanks for pointing me to the utils interface which for some reason I always fail to take into account. I still can't figure out a reasonable way to determine the character code, though. The combination of keycode and utils.IsKeyPressed is actually enough, but do I really have to go through all possible combinations one by one with a switch statement? Isn't there something like a keyboard mapping? Perhaps some array of values in the registry key?
on_key_down returns standard ascii character codes. So values 65-90 correspond to A-Z (you need to check if VK_SHIFT is down for upper/lower though). If you want to output the key pressed to the screen you can do something like:
Code: [Select]
var str = String.fromCharCode(65);    // str now contains 'A'

Re: JScript Panel script discussion/help

Reply #639
on_key_down returns standard ascii character codes. So values 65-90 correspond to A-Z (you need to check if VK_SHIFT is down for upper/lower though). If you want to output the key pressed to the screen you can do something like:
Code: [Select]
var str = String.fromCharCode(65);    // str now contains 'A'

Yes, the A-Z character codes, as well as the blank space and 0-9 characters, are the same as the key code, but all other symbols are messed up and I believe they change with the keyboard settings.
I'm late

Re: JScript Panel script discussion/help

Reply #640
I would assume punctuation and other printable characters are the same, but the other things probably require a select statement based off the VK_ defines.

Re: JScript Panel script discussion/help

Reply #641
on_key_down returns standard ascii character codes. So values 65-90 correspond to A-Z (you need to check if VK_SHIFT is down for upper/lower though). If you want to output the key pressed to the screen you can do something like:
Code: [Select]
var str = String.fromCharCode(65);    // str now contains 'A'

Yes, the A-Z character codes, as well as the blank space and 0-9 characters, are the same as the key code, but all other symbols are messed up and I believe they change with the keyboard settings.

We were on the wrong track! The on_char(code) callback is the one to look at: it takes the character code which is actually mapped to the key, rather than the key code.
I'm late


Re: JScript Panel script discussion/help

Reply #643
How do you escape the ampersand? The backslash doesn't seem to work as with other characters.
Basically: how can I write "Tom & Jerry" with a GdiDrawText method?
I'm late

Re: JScript Panel script discussion/help

Reply #644
Try "Tom && Jerry"

Re: JScript Panel script discussion/help

Reply #645
How do you escape the ampersand? The backslash doesn't seem to work as with other characters.
Basically: how can I write "Tom & Jerry" with a GdiDrawText method?
You need to add the flag  DT_NOPREFIX
https://github.com/marc2k3/foo_jscript_panel/blob/master/foo_jscript_panel/docs/Flags.txt#L16

https://github.com/marc2k3/foo_jscript_panel/blob/8ee7c4d084b535946922c05cadc3eba1b0e5c7e4/foo_jscript_panel/docs/Interfaces.txt#L1268


Re: JScript Panel script discussion/help

Reply #646
Thanks, both solutions work.
I'm late

Re: JScript Panel script discussion/help

Reply #647
Hello. I use
// @name "Text Reader"
// @author "marc2003"

1. I want to use it for viewing сue located of course in the playing folder, how to set the path? Default $directory_path(%path%) ... $directory_path(%path%)\*.CUE ... dont work

2. where to change the font type?

3. I want to display a text file with the name "discography.txt" in the root artist folder, the problem is that sometimes the depth of nesting, for example "artist \ album \" ... "artist \ album \ CD1"

Re: JScript Panel script discussion/help

Reply #648
EDIT
I'm late

Re: JScript Panel script discussion/help

Reply #649
2. where to change the font type?

The panel object uses the DUI or CUI font settings.


3. I want to display a text file with the name "discography.txt" in the root artist folder, the problem is that sometimes the depth of nesting, for example "artist \ album \" ... "artist \ album \ CD1"

It depends on your folder naming standards. For example, if all your multiple discs were in folders named CD%discnumber% this could be your custom path:
Code: [Select]
$if($strcmp($directory(%path%),CD%discnumber%),$replace($directory_path(%path%),$directory(%path%),),$directory_path(%path%))
I'm late