Skip to main content

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

0 Members and 1 Guest are viewing this topic.
  • romor
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1800
edit it so it becomes...

Code: [Select]
WshShell.Run("cscript //nologo " + script_path...

marc2003, can't you use WSC (wrap vbscript in XML and set parameters) then call it as object function from javascript?

I've done the opposite here, when needed crypto service from javascript function, not knowing that there is already crypto COM object exposed by .NET

Hope it helps instead complicate things
  • Last Edit: 27 August, 2012, 11:51:28 AM by romor

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1801
I tested that filename path was correct and file exists = true; but if read is a function, it's missing?

the read function is my common4.js file. it would error if missing plus no text from any cached files would display. although unlikely, it's possible the txt file is empty but it shouldn't be created unless there was something to save.

Quote
the WSH version only displays & saves to allmusic_bio.txt the 1st paragraph from allmusic, while the biography panel displays the whole bio text...

i have no idea why this is. i'll look into it. this is now fixed. just the script in the panel needs re-importing.

@romor, i'm not using your amazon script so i don't really have any idea what you're on about.  if you look at the parameters, i'm just calling your allmusic script with a file path added to the end. rather than output the text using WScript.echo, i'm saving to text file which my script then reads.

i know it should be fairly trivial to port the whole thing into a WSH panel but i've don't have much access to a computer at the moment.
  • Last Edit: 28 August, 2012, 09:24:40 AM by marc2003

  • romor
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1802
i'm not using your amazon script so i don't really have any idea what you're on about.  if you look at the parameters, i'm just calling your allmusic script with a file path added to the end. rather than output the text using WScript.echo, i'm saving to text file which my script then reads.

I was suggesting you use it as COM object instead using shell run. You could run any function from it as it was JS. Amazon script was working example
Nevermind...

Cheers

  • Emerelle
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1803
Concerning my problems with the allmusic script, I think I found out that I simply dont receive any info because that very album is not there, in spite of the artist info being there. I think that is the way it works? Its a pity though

I have another two questions for the simple text reader: Does the path to the text file need to be changed in both script and dialog? I tried to insert an if function because I wanted it to look in one level up if no info.txt is found, but that did not display anything.
Second question concerns the right margin: I managed to change both top and left text margins only the value for the right one is unclear to me which one I have to change in the script.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1804
normally users would not need to edit the script as the dialog accepts any title formatting. your problem is that you cannot check for the existence of files using title formatting alone. i might add a hack to get around this.

as for the margins, you need to browse the marc2003 folder in your foobar profile directory. edit common4.js in a text editor. on line 286, you'll see

Code: [Select]
        lines = temp_gr.EstimateLineWrap(paragraphs[i], normal_font, ww - 16).toArray();


ww - 16 is the relevant bit. increase the number to make the margin bigger. after changes have been saved you need to reload the script in your panel for it to pick the changes up.

also i should mention that playing with the top margin may break the calculation for how many rows to display. you might need to adjust the panel script on line 25.

Code: [Select]
rows = Math.floor((wh - 32) / row_height);


just the number 32 would need tweaking.
  • Last Edit: 01 September, 2012, 07:20:34 AM by marc2003

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1805
normally users would not need to edit the script as the dialog accepts any title formatting. your problem is that you cannot check for the existence of files using title formatting alone. i might add a hack to get around this.


samples updated: http://dl.dropbox.com/u/22801321/samples.zip

simple text reader you can now use multiple file paths in the path to text file dialog. it will check each one in turn until a file is found. separate each entry using | with no spaces.

unfortunately there is a limit of 255 characters for the standard input dialog. if you find yourself running into this limit, hold down shift before right clicking the panel. select Properties from the menu and then edit the value of text_file in the popup dialog.

  • Emerelle
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1806
Awesome Marc, thanks so much for both your advice and the update.

EDIT - I figured it out - look in one folder up works like this
$directory_path($directory_path(%path%))\info.txt

And now it works for both the content folder plus one folder up using it like this:

$directory_path(%path%)\info.txt|$directory_path($directory_path(%path%))\info.txt

Awesome!
  • Last Edit: 01 September, 2012, 04:31:50 PM by Emerelle

WSH Panel Mod script discussion/help
Reply #1807
Has anyone tried Marc2003's scripts in OSX via wineskin?  I have my config working very well, but use Marc2003's scripts heavily, and am getting errors all over the place.  I have one other WSH panel working fine that doesn't any dependencies so I don't think it's a WSH panel problem.

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1808
Has anyone tried Marc2003's scripts in OSX via wineskin?  I have my config working very well, but use Marc2003's scripts heavily, and am getting errors all over the place.  I have one other WSH panel working fine that doesn't any dependencies so I don't think it's a WSH panel problem.

I run them under Wine on Ubuntu and had errors at first. I basically had to comment out some parts of the common4.js script. I think I figured out which ones by looking at the line number that was causing problems in the foobar console and going from there. I can specify which bits I effectively cut out if you like, although it may be a bit different for you. Also, naturally some of the scripts won't necessarily be usable if you do cut chunks out of the common script. Personally I'd rather have some than none so that's why I went down this route
  • Last Edit: 07 September, 2012, 08:06:46 PM by rawny

WSH Panel Mod script discussion/help
Reply #1809
I run them under Wine on Ubuntu and had errors at first. I basically had to comment out some parts of the common4.js script. I think I figured out which ones by looking at the line number that was causing problems in the foobar console and going from there. I can specify which bits I effectively cut out if you like, although it may be a bit different for you. Also, naturally some of the scripts won't necessarily be usable if you do cut chunks out of the common script. Personally I'd rather have some than none so that's why I went down this route


I was going to attempt that but the console wasn't helpful.  It reads:

WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\users\Sixth Street\Application Data\foobar2000\marc2003\common3.js"

The popup dialog box says:

Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x800a01ad): Unknown error code (2148139437)

Any help would be greatly appreciated!

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1810
I run them under Wine on Ubuntu and had errors at first. I basically had to comment out some parts of the common4.js script. I think I figured out which ones by looking at the line number that was causing problems in the foobar console and going from there. I can specify which bits I effectively cut out if you like, although it may be a bit different for you. Also, naturally some of the scripts won't necessarily be usable if you do cut chunks out of the common script. Personally I'd rather have some than none so that's why I went down this route


I was going to attempt that but the console wasn't helpful.  It reads:

WSH Panel Mod (Thumbs by marc2003): Parsing file "C:\users\Sixth Street\Application Data\foobar2000\marc2003\common3.js"

The popup dialog box says:

Scripting Engine Initialization Failed (Thumbs by marc2003, CODE: 0x800a01ad): Unknown error code (2148139437)

Any help would be greatly appreciated!

If you copy the whole of the common.js script into a panel above the script you're trying to use it for, or maybe even on its own to begin with, you should get more informative errors in the console. If your adding to a script though, make sure to remove the import line:
Code: [Select]
// @import "[...]common4.js"
  • Last Edit: 07 September, 2012, 10:38:55 PM by rawny

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1811
i've had my scripts working in WINE. i found an old post where i detailed what i had to do...

save this somewhere as winetricks

http://www.kegel.com/wine/winetricks

run it from a terminal

Code: [Select]
sh winetricks


select

Code: [Select]
gdiplus
ie8
wsh57


i suggest downloading my latest scripts (i can tell yours is old because you mention common3.js and i've been on common4.js for ages now).

edit common4.js in a text editor and comment out lines 401 & 402 like this...

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


doing this means input dialogs won't work from the context menu but if you copy the entire config from a working windows machine, it should just work. if you do need to set some variables then you might need to edit the script directly. give me a shout if you need any help.




  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1812
i've had my scripts working in WINE. i found an old post where i detailed what i had to do...

save this somewhere as winetricks

http://www.kegel.com/wine/winetricks

run it from a terminal
Code: [Select]
sh winetricks
select
Code: [Select]
gdiplus
ie8
wsh57

I'm not sure whether this part will be applicable as Sixth Street is running foobar on OSX via wineskin - they may have a winetricks equivalent though...? (I don't know how much wineskin differs from pure WINE.)
  • Last Edit: 08 September, 2012, 09:38:08 AM by rawny

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1813
oops, i missed that.  i'd hazard a guess at WINE being installed though so it may work??

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1814
Wow epic formatting screw-up -.-

I was trying to say that it might work from the point of view that some WINE is probably in there.

I think the best thing to do would be for Sixth to update all your scripts first and then see what's happening after that.
  • Last Edit: 08 September, 2012, 09:46:29 AM by rawny

  • romka18
  • [*]
WSH Panel Mod script discussion/help
Reply #1815
writing playlist viewer like esplaylist - with grouping. i create an object - album, which contents the songs.

Code: [Select]
pl_album=function(name,content,metadb) {
                ...
                this.display_image=utils.GetAlbumArtV2(this.metadb,0,true);
            }

content=massive of objects contents the tracks
metadb=this.Items.item(i) - one item of playlist.

as i understand while creating groups i call for a cover, but callback on_album_image_load_done isnt called. what i doing wrong? or how better load images for albums on screen?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1816
i don't think there is any such thing as on_album_image_load_done. there is on_get_album_art_done which is only called when using utils.GetAlbumArtAsync, not utils.GetAlbumArtV2.

WSH Panel Mod script discussion/help
Reply #1817
I think the best thing to do would be for Sixth to update all your scripts first and then see what's happening after that.


Yup, you are correct.  I should try the newest scripts first.  It's just that I've heavily modified some of the scripts for my own usage and since they were working just fine never decided to update and have to try to re-create my modifications.  I'll try the latest stock scripts and report back.

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1818
I think the best thing to do would be for Sixth to update all your scripts first and then see what's happening after that.

Yup, you are correct.  I should try the newest scripts first.  It's just that I've heavily modified some of the scripts for my own usage and since they were working just fine never decided to update and have to try to re-create my modifications.  I'll try the latest stock scripts and report back.

You could compare your modified versions and the new ones using some kind of text comparison program and then put your changes in, but yeah. Yell if you need any more help
  • Last Edit: 10 September, 2012, 04:03:41 PM by rawny

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1819
I'm beating my head against a wall with something that seems simple, but I'm missing something - help appreciated!

I'm trying to invoke title formatting within a jscript to extract a portion of a path.  For example, let e_1 equal the variable that contains the path.  I echo e_1 to the console to ensure that e_1 really contains a path.  For example, the console echoes

c:\users\xyz\appdata\roaming\123456789_kjl.jpg

as I expect, which means the script recognizes e_1 and knows that it contains the string it echoed to the console.

But in the very next line of the script, when I try

y4 = fb.TitleFormat("$strrchr(e_1),_)").Eval();  (in this case I'm looking for the first occurrence of an underscore in the path stored in e_1),

y4 equals 2 instead of 10 per the console echo.  The title formatting is treating "e_1" as the string it's evaluating, instead of treating e_1 as a variable and evaluating the string "c:\users\xyz\appdata\roaming\123456789_kjl.jpg".  I played around with the name of my variable and moved around the underscore to ensure I was correct in my interpretation of what is happening.

I can't figure out how to get the command line to evaluate e_1's value.  I also tried fb.TitleFormat("$strrchr($get(e_1)),_)").Eval();  but that didn't work either.  I'm probably missing something simple as usual, but I can't figure it out.  Thanks for any advice!
  • Last Edit: 12 September, 2012, 09:22:18 PM by godrick

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1820
e_1 is your variable in the script but you're treating it as a plain text in your title formatting.

but you don't even need to use title formatting for this. javascript has indexOf.

y4 = e_1.indexOf("_");

  • sylla
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1821
I've got a suggestion for your "now playing" script marc2003.

Since it shows album art, I now use this panel instead of the album art viewer, the only downside is it takes a couple of clicks more to come to the directory of the currently playing track.

It's nice to be able to find the artist picture folder by double clicking, but if I double click on the albumart I would like to come to that directory instead. Just an idea, that I think makes sense?

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1822
that's a reasonable request. samples updated: http://dl.dropbox.com/u/22801321/samples.zip

now playing: double clicking the album art image locates the image in explorer. double clicking anywhere else in the panel opens the artist image.

  • sylla
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1823
wow, that's fast  thanks!

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1824
e_1 is your variable in the script but you're treating it as a plain text in your title formatting.

but you don't even need to use title formatting for this. javascript has indexOf.

y4 = e_1.indexOf("_");


Yes, marc2003 you are correct in describing the problem, and using javascript string object methods in this example does work.  But I've got other sting formatting actions I'm trying to do that either require me to figure out a way to have e_1 recognized correctly in a fb.titleformat expression, or at least seem easier with title formatting than with javascript string object methods.  I've successfully passed variables to fb.titleformat expressions previously and even in other places in the script I'm working on, but none of the other expressions involve string formatting  - is there something I need to do in this or similar cases to have the variable recognized as such?  Thanks for the help!