Skip to main content

Topic: WSH Panel Mod script discussion/help (Read 840296 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • colagen
  • [*]
WSH Panel Mod script discussion/help
Reply #2250
Hi,

Does someone know a way to display a simple dialog box, with two button yes/No, and use the result in a WSH script ?
(I'm adding a menu for quick tagging things like genre, date, but i want to avoid bad clics and get all my library re-tagged..)

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2251
you need to disable safe mode in the preferences for this to work.

put this code somewhere and don't edit it
Code: [Select]
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";

function MsgBox(prompt, buttons, title) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "');
    prompt = prompt.replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    return vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}


now you can use some custom code like this.

Code: [Select]
var result = MsgBox("Open preferences?", 4, "Question");
if (result == 6) fb.ShowPreferences();


note i passed 4 as the buttons argument. that's a simple Yes/no. i check to see if the result was 6 because that means Yes was clicked.

see all codes here- http://msdn.microsoft.com/en-us/library/sf...v=vs.84%29.aspx

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2252
Is there any way to apply actions with a button for a bunch of files instead of only one selected or nowplaying?
Like File Operations/Delete files or tagging actions

For now i tried with fb.RunContextCommandWithMetadb(..., fb.GetFocusItem()) but it only applies to the first file of a selection...
  • Last Edit: 10 April, 2013, 06:26:55 AM by tedgo

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2253
fb.GetSelections()

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2254
Instead of fb.GetFocusItem()
Is it new? (i haven't engaged with wsh panel mod's new interfaces for a long time...)

EDIT: Thanks btw. ...
  • Last Edit: 10 April, 2013, 06:32:20 AM by tedgo

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2255
it's been around since 1.4.0 so quite awhile.

one other thing you might find useful is the flags..

Code: [Select]
    // [1.4.0] Changed: Accept IFbMetadbHandleList interface for metadb handle list.
    // [1.5.0 Preview 2] Changed: Add new "flags" parameter
    // flags:   0 - default (depends on whether SHIFT key is pressed, flag_view_reduced or flag_view_full is selected)
    //          4 - flag_view_reduced
    //          8 - flag_view_full
    boolean RunContextCommandWithMetadb(command, handle_or_handles, flags = 0);


if you set it to 8, it will even work on context commands that have been hidden by the user. i've found it very handy as people generally like to hide the foo_customdb/last.fm options used by my last.fm playcount script.
  • Last Edit: 10 April, 2013, 06:40:19 AM by marc2003

  • tedgo
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2256
Oh, then i must have overread it all the time (or confused with GetSelection...)

EDIT (according to yours):
Wow, i should really read the interfaces.html carefully and play with all the new unknown stuff
  • Last Edit: 10 April, 2013, 06:47:58 AM by tedgo

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2257
dropbox are now using a new domain/URL re-direction which has broken my update script feature. i've had to make changes which need to be downloaded manually.

snippet from changelog:

Quote
10.04.2013.01

Due to recent changes made by dropbox, you may see
"HTTP error: 0" in your foobar2000 console when trying to run
"Update script". The only way around this is to download this
file manually and save it in the "marc2003" folder.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js


this only affects people using the full zip posted on or after the 2nd april. previous versions don't update any more.

the full download is available here: https://dl.dropboxusercontent.com/u/22801321/samples.zip
  • Last Edit: 10 April, 2013, 07:22:17 AM by marc2003

  • colagen
  • [*]
WSH Panel Mod script discussion/help
Reply #2258
you need to disable safe mode in the preferences for this to work.

put this code somewhere and don't edit it
Code: [Select]
var vb = new ActiveXObject("ScriptControl");
vb.Language = "VBScript";

function MsgBox(prompt, buttons, title) {
    prompt = prompt.replace(/"/g, '" + Chr(34) + "');
    prompt = prompt.replace(/\n/g, '" + Chr(13) + "');
    title = title.replace(/"/g, '" + Chr(34) + "');
    return vb.eval('MsgBox' + '("' + prompt + '", "' + buttons + '", "' + title + '")');
}


now you can use some custom code like this.

Code: [Select]
var result = MsgBox("Open preferences?", 4, "Question");
if (result == 6) fb.ShowPreferences();


note i passed 4 as the buttons argument. that's a simple Yes/no. i check to see if the result was 6 because that means Yes was clicked.

see all codes here- http://msdn.microsoft.com/en-us/library/sf...v=vs.84%29.aspx


Thanks a lot, this code snippet which allow to use vbscript functions will be useful fore sure

  • colagen
  • [*]
WSH Panel Mod script discussion/help
Reply #2259
And do you know a way to open the properties dialog ? (The one you see when you right-click selected items in a playlist)

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2260
my post just up the page shows the documentation for that.

http://www.hydrogenaudio.org/forums/index....st&p=830729

in your case, the command would simply be "Properties".

  • colagen
  • [*]
WSH Panel Mod script discussion/help
Reply #2261
Okey, thanks. Now, it seems pretty obvious, shame on me for missing it (maybe the documentation should include some basic descriptions of each functions utility)

  • VlaKor
  • [*]
WSH Panel Mod script discussion/help
Reply #2262


Help please.
  • Last Edit: 13 April, 2013, 02:59:49 PM by VlaKor

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2263
i just tested my musicbrainz script with Iron Maiden set as the artist and it works for me so something must have have corrupted the download of the file??

you can force a fresh download by doing this.

-first of all close foobar
-browse your foobar2000 profile folder in explorer and into the wsh_lastfm folder.
-search for and delete all files named musicbrainz_URLs.json
-lastly open internet explorer and clear the temporary files. (even if you don't use the browser, it still caches data used by my scripts so it needs to be cleared.)

now start foobar and a fresh copy should be downloaded.

edit: completely unrelated to this but discogs seems to be having major server problems at the moment. if anybody finds my script not updating/working, you now know why.
  • Last Edit: 13 April, 2013, 05:51:38 PM by marc2003

  • Reith
  • [*]
WSH Panel Mod script discussion/help
Reply #2264
I just did an update of the scripts and now they all crash.

Error: WSH Panel Mod (Art Reader by marc2003): Microsoft JScript runtime error:
'panel' is undefined
File: <main>
Ln: 9, Col: 1
<source text only available at compile time>

Did I mess something up?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2265
when i do major updates, files inside the marc2003 folder change so you just need to extract it again.

if you think you have extracted it, then you've put it in the wrong place. the readme will tell you.
  • Last Edit: 15 April, 2013, 08:58:22 PM by marc2003

  • Reith
  • [*]
WSH Panel Mod script discussion/help
Reply #2266
Did you do another major update after the one on April 10? I manually extracted and replaced everything then and it was working fine until today.

EDIT: Never mind, I fixed it. Looks like the common7.js file somehow got screwed up when I ran the update scripts command. It was only 1 kb so obviously something was wrong. I just replaced it manually and it's ok now.
  • Last Edit: 15 April, 2013, 09:05:59 PM by Reith

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2267
sorry about that. it looks like i need to do some more robust checking on file contents before over-writing existing files. i rely on the http server response code of  200 (which means "OK") from dropbox and assume it's safe to update if version numbers don't match. obviously it went a bit wrong when you did your update.

edit: i've now put some checking in. here's a direct link in case you don't trust Update script in the current version.

https://dl.dropboxusercontent.com/u/2280132...2003/common7.js
  • Last Edit: 15 April, 2013, 09:53:37 PM by marc2003

WSH Panel Mod script discussion/help
Reply #2268
Hi Marc,

I'd like to say that your work with wsh/fb2k sure is appreciated by many and myself, and you are quite generous in helping others with questions.

I was wondering if you would you be so kind as to help me with a minor change to "nowplaying". I need the ratings stars to read/edit a custom metatag instead of the playback statistics db or standard "rating" metatag as it currently does. I found a post where someone asked the same, but it was many versions ago and didnt apply to your much updated lib and script.

Many thanks

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2269
i couldn't be bothered to implement it properly (such as giving people a choice between foo_playcount or file tags) so i just did a quick bodge job.

https://dl.dropboxusercontent.com/u/2280132...ating%20tag.txt


WSH Panel Mod script discussion/help
Reply #2270
i couldn't be bothered to implement it properly (such as giving people a choice between foo_playcount or file tags) so i just did a quick bodge job.

https://dl.dropboxusercontent.com/u/2280132...ating%20tag.txt


1000 thank you very muches

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2271
i don't really use my discogs script much but added it today and noticed it's returns anything containing the search term. i've changed it to filter out all the results that don't exactly match.

this is a before/after screenshot. https://dl.dropboxusercontent.com/u/2280132...ril/discogs.png

if this causes issues, i might make an option to toggle the behaviour on/off.

just right click>Update script.

if nothing happens check the foobar console. if it's http error code 0, you should see the changelog entry dated 10.04.2013

https://dl.dropboxusercontent.com/u/2280132...h/changelog.txt

if it's a 404 error, your package is out of date and you need extract the full zip and update the scripts in the panels.

https://dl.dropboxusercontent.com/u/22801321/samples.zip

new users should also download this zip and there are full instructions inside.

  • matav
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2272
is it possible to have individual right-click context menus for different buttons in the same WSH panel?

i plan to make a simple playback panel with the usual play, pause, stop, prev, next.
> the Play button will have "Play random track" in it's right-context menu
> the Stop button will have "Stop after current"
> the Next button will have the 3 Shuffle playback orders

also i have been wondering if this can be achieved with a <keyboardKey + mouseClick> event so i can do a shift+mouseLeftClick
--
i am not much of a WSH coder so i'd like to know upfront if this is possible before i set out on a wild goose chase
  • Last Edit: 17 April, 2013, 09:33:39 AM by matav
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2273
yes that's definitely possible.

this is the callback for a left mouse click and you can check whether shift was held.

Code: [Select]
function on_mouse_lbtn_up(x, y) {
    if (utils.IsKeyPressed(0x10)) {
        //shift key was pressed. do something
    } else {
        //do something else
    }
}
  • Last Edit: 17 April, 2013, 09:42:03 AM by marc2003

  • matav
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2274
yes that's definitely possible.

great!
--
thanks for the help marc, much appreciated.
try my portable foobar theme -- eXdb v4d
http://bit.ly/matavfb