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: WSH Panel Mod script discussion/help (Read 1400158 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod script discussion/help

Reply #1175
Thanks again marc - I installed the latest WSH panel mod (1.5.0 beta3 showing in list of installed components).

Still get the same error with your new thumbs script - error "scripting engine initialisation failed ... CODE 0x80020101.

Edit: works now, but i had to copy the new marc2003 folder to the foobar profile directory after all !

One other request - is it possible to have the script scan one folder higher if it doesn't find any art in the colder? E.g. if there is a folder structure

Arist - Album
  - Disc 1
  - Disc 2

And the images are in the root directory artist-album, could the script look there IF there are no images in the disc folders?

Thanks 

WSH Panel Mod script discussion/help

Reply #1176
Marc - I've just figured out what was wrong with the thumbs script - it recognises only .jpg files, not .jpeg. Could you fix it to recognise .jpeg also? Thanks!

WSH Panel Mod script discussion/help

Reply #1177
support for jpeg files added. this time the script hasn't changed - just files inside the marc2003 folder. so extract that and make sure you restart foobar.

you can use foobar title formatting to get to the parent folder

Code: [Select]
$replace($directory_path(%path%),\%directory%,)

WSH Panel Mod script discussion/help

Reply #1178
Thanks again marc 2003. Where do I put that code?

WSH Panel Mod script discussion/help

Reply #1179
Marc, I've finished the Autoplaylist Properties Dialog exe.  You can download the source code and the exe here: http://www.4shared.com/file/Ufb_EfTk/Autop...tiesDialog.html



The archive contains also a working WSH script, that demonstrates its usage, but currently, it displays only a simple menu when you left-click the panel.  It should be easy to bind it to a button.

Note that the script uses hardcoded paths.  The exe file must be placed in fb.ProfilePath\wsh_scripts\, and it saves the autoplaylist file in fb.ProfilePath\wsh_settings\ (but the script filename can be changed with the windows properties, for users who want to implement it in several panels).
Also, the autoplaylist file format is not compatible with your file format, because my script saves the force-sorted flag too.  Anyway, the default filename is different.

Look at GetAutoplaylistProperties() in the WSH panel code and the comments in f2k_autoplaylist_dialog.ahk if you want to use the exe for your own code.  If you need some minor modifications (such as removing the "do not add to list" option), let me know.  I can recompile the exe easily...

WSH Panel Mod script discussion/help

Reply #1180
@danhackley. you are kidding, right? i haven't told you to edit anything so where do you think it should go? 

@r0lZ, thanks. that autohotkey thing looks interesting. i might have to learn that myself.

WSH Panel Mod script discussion/help

Reply #1181
@r0lZ, thanks. that autohotkey thing looks interesting. i might have to learn that myself.

Well, it is wonderful to automate repetitive tasks that you cannot do easily manually, as it can control most application windows (and simulate clicks on precise controls, independently of the position and size of the window - something that most automation tools cannot do), but building GUIs is not as easy as it sounds (because they use fixed positions for everything), and the AutoHotkey language is terrible (with many discrepancies in the syntax, missing flow-control instructions, and so on).  I much prefer jscript, but I use AutoHotkey to build simple GUIs and for its automation power.

Luckily, AutoHotkey_L is born.  It is a new project, based on the source code of AutoHotkey, but maintained by other guys.  They have already added the objects and real arrays, and there are plans to completely revamp the syntax of the language.  Maybe one day it will become a really good language.  Anyway, if you want to try it, be sure to download the AutoHotkey_L installer (here).

WSH Panel Mod script discussion/help

Reply #1182
well to be honest, i was only interested in making a unified input for Last.fm username and API key at the same time. i'm hoping that will be easy enough if i can dissect what you've done.

WSH Panel Mod script discussion/help

Reply #1183
Yes, that should be easy.  Feel free to ask for some help.

WSH Panel Mod script discussion/help

Reply #1184


done. here's the source if you wouldn't mind giving a quick look over. no comments but it's simple enough.

http://pastie.org/2769555


WSH Panel Mod script discussion/help

Reply #1185
Seems OK.  You learn quickly!

But you don't check if the user has typed something in both editboxes.  IMO, you should add, in ButtonOK, something like this:
Code: [Select]
ButtonOK:
Gui, Submit, NoHide; get the content of the GUI, but do not hide it
if (username == "" || api_key == "") return

Of course, you can do better tests, for example test the length of the API key.

If you want to display easily simple error messages, you can add a status bar to your window, or use MsgBox.

In my script, I've opted for another solution: the OK button becomes active only when all required fields have some contents.  Look at CheckGui:

And I've also used a powerful feature of AutoHotkey to force the window to be always on top of the Foobar window: DialogAlwaysOnTop:

But your script should work fine as it is.

[EDIT]
#SingleInstance force
is used to force a new instance to silently REPLACE the already running instance.  Not sure it's what you want.  It could be better to use
#SingleInstance ignore
With ignore, the first instance continues to run, and the second one doesn't open its window and exits immediately.

WSH Panel Mod script discussion/help

Reply #1186
BTW, I wonder if it is possible to run an external app and grab what it writes to stdout from WSH.  That would make the temp_file thing useless.  (I know that, for your last.fm scripts, you need to write the two output files anyway, but for a more general usage, the possibility to grab the stdout channel could permit to write complex input dialogs with AutoHotkey, and get the values in your panel easily.)
Do you think it's possible?  With WshShell.Exec() ?

WSH Panel Mod script discussion/help

Reply #1187
i've had to ditch that autohotkey thing. it doesn't always write to file when clicking OK so it has to go.

as for capturing stdout with WSH, if you google i think you'll find pretty much everyone says write to file. i checked this ages ago - before i discovered the VBscript thing i'm currently using and that's fine for the simple values i use.

WSH Panel Mod script discussion/help

Reply #1188
i've had to ditch that autohotkey thing. it doesn't always write to file when clicking OK so it has to go.

Strange.  Are you sure it's an AutoHotkey problem?  I have never had problems when writing a file (except the usual and normal 'access denied' or 'disc full' problems).
Oh, another thing: when passing the path to the wsh_settings dir via the command line, be sure to remove the tailing slash, or it will be interpreted as an escape character, and therefore removed, and replaced by the closing quotes.  Another way to handle it is to double the backslash.  For example:
Code: [Select]
"\"" + fb.FoobarPath + "\\\""

BTW, maybe you could change your output files to an unified INI file.  Autohotkey and WSHPM have the functions to read and write them.

as for capturing stdout with WSH, if you google i think you'll find pretty much everyone says write to file. i checked this ages ago - before i discovered the VBscript thing i'm currently using and that's fine for the simple values i use.

The VBscript method is elegant, but unfortunately, I had to find another way to edit the arguments, due to the 254 characters limitation of the InputBox.  (And it's why I can't use INI files either, as the INI values are also limited to 256 characters or so.  Pity!)
I'll stick with the current "temp file" method.

Oh, I have discovered several bugs in my Autoplaylist Properties Dialog script and in the demo script.  I think I've fixed most of them, and I have improved the dialog (now, the edit boxes are ComboBoxes, with a dropdown menu with some useful default values) but this time I will check it carefully before updating the new version...

I have also a question about the Autoplaylist query syntax.  I have an autoplaylists panel (foo_softplaylists, not written with WSHPM) that can maintain autoplaylists with a query that changes dynamically when the now playing track changes.  For example, it can generates an autoplaylist with all titles in CDs by the currently playing artist, with this query:
Code: [Select]
%artist% HAS $nowplaying{%artist%} OR %album artist% HAS $nowplaying{%artist%} OR %artist% HAS $nowplaying{%album artist%} OR %album artist% HAS $nowplaying{%album artist%}

I can't get $nowplaying{%artist%} to work with fb.CreateAutoPlaylist().  Also, there is no mention of that  $nowplaying{} function in the title formatting help page, and the syntax with {} instead of () is strange, so I suppose that that syntax is handled specifically by the foo_softplaylists panel, and is not "official".  Note also that foo_softplaylists doesn't really create the autoplaylist, but it stores it in its own panel, and I can see the number of hits changing when the nowplaying artist changes.  However, when the real playlist is created, a normal (not auto) playlist is created.

Anyway, I wonder if it is possible to create real autoplaylists that change dynamically when the currently playing (or focussed) artist, album, track or whatever changes.  A playlist that shows constantly, for example, all albums by the currently playing artist would be nice.  But I wonder if the autoplaylist syntax is powerful enough, or if it's the responsibility of the panel to update the playlist query when it's necessary.  (BTW, I think that currently, it is not possible to change the query of an existing autoplaylist from WSH without having to delete and recreate the playlist.  Correct?)

WSH Panel Mod script discussion/help

Reply #1189
well you've seen my source. there is no validation on input and the files should get written to if OK is clicked no matter what. but it's failed a good few times today. re-running again afterwards works so i'm pretty sure it can't be a problem with the code/path to files. maybe it is a permissions problem but i really can't be arsed to troubleshoot it because a) i'm not familiar with it and b) i'm lazy 

as for that $nowplaying thing, i have no idea what that is. i'm guessing you can't put it into Library>Search. whatever works there should work in WSH panel mod.

WSH Panel Mod script discussion/help

Reply #1190
Hum, I will try to find what's wrong with your ahk script.
Do you run if from WSH in compiled (exe) form?  If it's the case, perhaps the parsing of the command line doesn't work the same way than with the source version.

WSH Panel Mod script discussion/help

Reply #1191
yup, i'm running an exe version. it's reading the command line parameters just fine because it's loading the old values from the files and populating the input fields just like it should. i also pass a variable to be used as the window title and that also works perfectly.

it works most of the time when clicking OK by writing the new values. but the fact it's failed several times randomly means it's not fit for other people to use.

WSH Panel Mod script discussion/help

Reply #1192
but the fact it's failed several times randomly means it's not fit for other people to use.
Of course, I agree.  But I wonder what's happening. As far as I know, there are some bugs in AutoHotkey, but not in the file I/O functions.  It's why I want to check your script here...

I suppose you are sure that the files are not being read or accessed by your WSH panels when the dialog is running.  Right?

 

WSH Panel Mod script discussion/help

Reply #1193
well i do know for sure my other scripts aren't trying to access the files. they only read them after the .exe has completely exited with no exit code - i copied that part from your script. i wouldn't bother wasting your time. what i have now is perfectly fine. it's come a long way since i was getting people to edit the script with their preferences.

WSH Panel Mod script discussion/help

Reply #1194
what i have now is perfectly fine. it's come a long way since i was getting people to edit the script with their preferences.
Right, but I'm puzzled.  I don't understand the problem and I don't like that.  I have also to be sure that the same problem doesn't happen with my autoplaylist dialog.  So, I'll have a look anyway...

WSH Panel Mod script discussion/help

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

bugfix for simple biography, similar artists and last.fm charts. it would still let you click stuff you can't see when no username/api key was set.

autoplaylists
updated to support multiple instances. use the context menu to set it to use either a common file (default) or a unique file per panel. you can also change the panel title.

@q-stankovic, i see you're reading the thread just as i posted this. spooky. 

all the seekbar scripts require WSH panel mod 1.5.0 beta 4. all the other scripts require beta 3 as a minimum.

latest WSH panel mod beta 4 is available here: http://code.google.com/p/foo-wsh-panel-mod/downloads/list

edit: just uploaded again to fix a silly problem with autoplaylists. doh!

WSH Panel Mod script discussion/help

Reply #1196
Does it go under the "configure" bit where you have to paste the scripts ? Sorry for not understanding

WSH Panel Mod script discussion/help

Reply #1197
right click the panel>image source>set custom folder.

WSH Panel Mod script discussion/help

Reply #1198
Thanks. That code doesn't seem to work if the images are in the same directory as the music files though?

WSH Panel Mod script discussion/help

Reply #1199
well yes, that code only works for the parent folder. but you can use it together with the code for the current folder. the dialog tells you how.