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 (Read 812197 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

WSH Panel Mod

Reply #625
@carmenm:
Quote
what happens exactly when choose ok in the properties dialog? I would like to call a function at that very moment. Do you think it would be possible to have a callback for that?

Both "OK" and "Apply" buttons force to reparse/reload the script, as Configuration dialog does, so what you have to do is handle them during the script startup.

Perfect! Talking about reloading, when i enter ok in the preferences dialog all my scripts go into a strange state. By strange i mean not the same as if i press ok or apply in each script configuration dialog. I am not sure it s normal (i am under cui)

WSH Panel Mod

Reply #626
Just thought about the "pressing ok" in properties dialog and it actually is a problem. Let me explain.
I want to have my WSH config in a ini file.
How do i do this:
- i read the ini file when loading the script (so that it s loaded when foobar starts).
- i want it to be saved when i modify the properties

-> there is your problem, it means that directly in the script you must read and save the ini file without knowing if you come from the properties dialog or not.

Now you could tell me why using the ini file, that s what the properties are for. Yeah but the ini file is the only way for me to share config between multiple wsh panel mod.
So i think it would really be cool if we had a callback for that specific event.

Now a little note on the writeini function. If the file doesnt exist it doesnt create it. I think it should, dont you? I mean i dont want to have to make the test/creation everytime i want to write to my ini file

Thanks

WSH Panel Mod

Reply #627
@carmenm:
1.
Script initialization is script termination, so what you need to write properties is use WriteINI() during script initialization.

2.
From MSDN: http://msdn.microsoft.com/en-us/library/ms...28VS.85%29.aspx
Quote
If lpFileName contains a full path and file name and the file does not exist, WritePrivateProfileString creates the file. The specified directory must already exist.

WSH Panel Mod

Reply #628
Ok good there was a problem with the path. Now I cant writeIni during script init, or i wont be able to load an ini file on init? Or i am missing something

One question: Do you see a way to copy a string to the clipboard from a wsh panel? i couldnt find anything except for browsers ...

WSH Panel Mod

Reply #629
Quote
Now I cant writeIni during script init, or i wont be able to load an ini file on init? Or i am missing something

You can use utils.WriteINI() and utils.ReadINI() during script initialization.
What you should make sure:
0. Full path, you can trace if your path is right by using fb.trace("The INI file path is:", path_of_your_ini_file); and then check your console.
1. Directory of your INI located already exists.
2. You have permission of that directory about read/write.

Quote
Do you see a way to copy a string to the clipboard from a wsh panel?

I only know "InternetExplorer.Application"

WSH Panel Mod

Reply #630
Quote
Now I cant writeIni during script init, or i wont be able to load an ini file on init? Or i am missing something

You can use utils.WriteINI() and utils.ReadINI() during script initialization.
What you should make sure:
0. Full path, you can trace if your path is right by using fb.trace("The INI file path is:", path_of_your_ini_file); and then check your console.
1. Directory of your INI located already exists.
2. You have permission of that directory about read/write.

Sorry to insist on that but the problem is not with how it works but with the sequence.
If i first read then write, it wont work when i click ok on the properties dialog because i will first load the ini file and so loose the properties values just entered

If i do the contrary i wont be able to load the ini file at startup!

That s the reason why i say that maybe we would need a callback where i could do the writeini. THat would solve everything. Unlessyou see a way to do it today.

WSH Panel Mod

Reply #631
Well, I may add a on_script_unload() callback later.


EDIT: And the new version 1.3.0 Beta 6 is uploaded.


WSH Panel Mod

Reply #633
Yeah but the ini file is the only way for me to share config between multiple wsh panel mod.
Maybe asking for some kind of inter-script communication method instead of the .ini file kludge in the first place would be a better solution?
Full-quoting makes you scroll past the same junk over and over.

WSH Panel Mod

Reply #634
Yeah but the ini file is the only way for me to share config between multiple wsh panel mod.
Maybe asking for some kind of inter-script communication method instead of the .ini file kludge in the first place would be a better solution?

No i dont think so. In fact we already have the inter script communication and i know use it quite heavily. I want ini file because it s easy when you share config. Then i use inter com between panels to tell everyone that the config has changed. Works like a charm


WSH Panel Mod

Reply #636
@TP Wang: do you see a way to create a "fake" mp3? The idea is to get a IFbMetadbHandle on which i could do a UpdateFileInfoSimple("ARTIST"... and then i could do a context menu on that item to get action related to that artist.

I tried to create a new IFbMetadbHandle  but i got the error that IFbMetadbHandle  is unknown. THe reason i want to do that is because i need to have a contextual menu entry for an artist for which i dont have a realted file!

I also wanted to thank you a lot for th latest versions. I really did manage to create something new thanks to you.
By the way i dont think you answered me on the "lauching code in a thread" thing. I know it might be impossible but i still would love to have your opinion.

THanks



WSH Panel Mod

Reply #639
WOW at this pace WSH panel mod will be a complete wrapper of the fb2k API in one year 

(imo y'll should be writing native components instead... or working in an OSS UI for fb2k)
<insert signature here>

WSH Panel Mod

Reply #640
WOW at this pace WSH panel mod will be a complete wrapper of the fb2k API in one year 

(imo y'll should be writing native components instead... or working in an OSS UI for fb2k)

I actually start to think that being able to write all panels with wsh coulb the best solution. I see enormous potential there.

WSH Panel Mod

Reply #641
I'd agree with you if WSHP had a GUI interface to create controls (i.e. myButton = UI.button)

(That's why I suggest using the CUI API and C++)
<insert signature here>

WSH Panel Mod

Reply #642
is it possible to determine the height needed to display some text if i know the

width
font/size (using the DUI/CUI get font functions)
text

the reason i ask is because i have scrolling setup when there is too much to fit in the panel - but i'd like to disable scrolling downwards when at the end of text.

WSH Panel Mod

Reply #643
is it possible to determine the height needed to display some text if i know the

width
font/size (using the DUI/CUI get font functions)
text

the reason i ask is because i have scrolling setup when there is too much to fit in the panel - but i'd like to disable scrolling downwards when at the end of text.


SAme problem as you. I didnt find a way to do it. WE would need a function that given a rect would increase height or width for the text to fit. That s how it works most of the time.

WSH Panel Mod

Reply #644
fontObj.height
<insert signature here>


WSH Panel Mod

Reply #646
Try this:
Code: [Select]
textheight = gr.MeasureString(text, font, 0, 0, textwidth, 9999999999).Height;

textwidth and 9999999999 are just the maximum possible width and height, and the text is drawn inside a box that big. Then when you do DrawString, make it the same width, and set the height to textheight, then set its y coord as a variable that changes when you scroll.

WSH Panel Mod

Reply #647
Quote
But you dont know how many lines your text will take ... so that s not enough

or GdiDrawText(), the return value is an VBArray.


Quote
do you see a way to create a "fake" mp3?

Yes but I won't add it for end-user to use, it's really tricky and ugly, these thing should only be seen in the WSH Panel Mod source, with limited.

Quote
By the way i dont think you answered me on the "lauching code in a thread" thing. I know it might be impossible but i still would love to have your opinion.

JScript/VBScript doesn't support threads.



WSH Panel Mod

Reply #648
Quote
But you dont know how many lines your text will take ... so that s not enough

or GdiDrawText(), the return value is an VBArray.

gr.MeasureString was the solution.

Quote
Quote
do you see a way to create a "fake" mp3?

Yes but I won't add it for end-user to use, it's really tricky and ugly, these thing should only be seen in the WSH Panel Mod source, with limited.

Oh no, now you told me there is a way to do it :s. Please maybe there is a way to do it safely.... that s almost the only thing i am missing. IT would allow me to create a crazy panel!!!!

Quote
Quote
By the way i dont think you answered me on the "lauching code in a thread" thing. I know it might be impossible but i still would love to have your opinion.

JScript/VBScript doesn't support threads.

OK no problem. I ll look at another solution.

WSH Panel Mod

Reply #649
i am drawing lastfm bios with gdiDrawText.  In some cases the bio contains 11747 chars. Which makes it very long to redraw.
Is there some kind of cliprect function in gr that would make gdidratext stop when he draws outside the window?

EDIT: found it in the Graphics. COuld you give us access to setClip TPWang?