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 803654 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #650
if you're using the script i posted the other day, it's my fault.  i'm reading the cached text file during window.repaint()  i originally made the script without knowing how to scroll and my panel is locked in size so it didn't matter at the time. i really should have updated it. 

or maybe you figured that out already.

WSH Panel Mod

Reply #651
if you're using the script i posted the other day, it's my fault.  i'm reading the cached text file during window.repaint()  i originally made the script without knowing how to scroll and my panel is locked in size so it didn't matter at the time. i really should have updated it. 

or maybe you figured that out already.

Yeah i corrected that. I also made sure that i measure the string height only when necessary. The time it takes to repaint is only due to the drawing itself

WSH Panel Mod

Reply #652
whilst on the subject of that, i found this neat activex component to properly decode all special characters. use it like this....

Code: [Select]
ck = new ActiveXObject("CkString.StrFun");

try {
    text = xmlDoc.getElementsByTagName("content")[0].childNodes[0].nodeValue;
    text = ck.StripHtml(text);
    text = ck.HtmlEntityDecode(text);
} catch(e) {
    text = "This artist does not have a biography page on Last.fm.";
}


http://www.chilkatsoft.com/downloads.asp - ckstring, 2nd from the bottom. you need to register the dll using "regsvr32 ckstring.dll" in an administrator command prompt.

EDIT: question about gdi draw text array removed. using measure string instead.

WSH Panel Mod

Reply #653
i need help with WshShell.run
i have that command
Code: [Select]
"C:/Program Files/AlbumArtDownloader/aad.exe" /sources "LastFM Artist" /ar "Bloc Party" /mn 500 /mx 1000 /path "D:/Martin/My Documents/My Music/LastFmData/Bloc Party.jpg"

i am launching it with WshShell.Run(command, 0, true); so that i wait for the result
but i never go to the next line :s
Yet the command works perfeclty in a cmd.

Does anyone have an idea of what might be the problem?
Is there any to get the output of the command in the console?

Thanks

WSH Panel Mod

Reply #654
use "cmd.exe /k c:\program...." to troubleshoot. this spawns a command prompt window and it keeps it open so you can see what happens. it's probably to do with escaping of quotes.

WSH Panel Mod

Reply #655
ok something is really wrong, it doesnt open the command line :s

WSH Panel Mod

Reply #656
Quote
whilst on the subject of that, i found this neat activex component to properly decode all special characters. use it like this....

Another way:
http://www.daniweb.com/forums/post658176.html#post658176

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

It's already used before calling on_paint(gr);
You should stop using DT_CALCRECT in that case (or use with limited).


 

WSH Panel Mod

Reply #657
Quote
whilst on the subject of that, i found this neat activex component to properly decode all special characters. use it like this....

Another way:
http://www.daniweb.com/forums/post658176.html#post658176

i cant get it to work.  I have difficulties translating the function.

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

It's already used before calling on_paint(gr);
You should stop using DT_CALCRECT in that case (or use with limited).

Yes it s a lot better! and i dont need DT_CALCRECT anymore as i know the size so thank you!

WSH Panel Mod

Reply #658
Quote
i cant get it to work. I have difficulties translating the function.

Code: [Select]
function decodeXMLEntites(text) {
    var xmlDoc = new ActiveXObject("MSXML.DOMDocument");
    xmlDoc.async = false;
    xmlDoc.loadXML("<sometext>" + text + "</sometext>");

    if (xmlDoc.parseError.errorCode != 0) {
        return "";
    }
   
    return xmlDoc.text;
}

fb.trace(decodeXMLEntites("&quot;Some text&quot;"));

WSH Panel Mod

Reply #659
Quote
i cant get it to work. I have difficulties translating the function.

Code: [Select]
function decodeXMLEntites(text) {
    var xmlDoc = new ActiveXObject("MSXML.DOMDocument");
    xmlDoc.async = false;
    xmlDoc.loadXML("<sometext>" + text + "</sometext>");

    if (xmlDoc.parseError.errorCode != 0) {
        return "";
    }
   
    return xmlDoc.text;
}

fb.trace(decodeXMLEntites("&quot;Some text&quot;"));
thanks


WSH Panel Mod

Reply #661
@marc2003:
Then try this:
Code: [Select]
function decodeXMLEntites(text) {
    var doc = new ActiveXObject("htmlfile");
    doc.open();
    var div = doc.createElement("div");
    div.innerHTML = text;
   
    return div.innerHTML;
}

WSH Panel Mod

Reply #662
@marc2003:
Then try this:
Code: [Select]
function decodeXMLEntites(text) {
    var doc = new ActiveXObject("htmlfile");
    doc.open();
    var div = doc.createElement("div");
    div.innerHTML = text;
   
    return div.innerHTML;
}
WIth the latest version i loose all the  "\n"

WSH Panel Mod

Reply #663
Yes, because "\n" will be ignored in HTML, use <br/> instead.


WSH Panel Mod

Reply #665
what have you ended up with? this is what i have. 

Code: [Select]
text = text.replace(/&(lt|gt);/g, function (strMatch, p1){
    return (p1 == "lt")? "<" : ">";
});
text = text.replace(/<\/?[^>]+(>|$)/g, "");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = text.replace(/\n/g, "<br>");
text = div.innerHTML;
text = text.replace(/<BR>/g,"\n");
text = text.replace(/&amp;/g,"&");

WSH Panel Mod

Reply #666
what have you ended up with? this is what i have. 

Code: [Select]
text = text.replace(/&(lt|gt);/g, function (strMatch, p1){
    return (p1 == "lt")? "<" : ">";
});
text = text.replace(/<\/?[^>]+(>|$)/g, "");
doc = new ActiveXObject("htmlfile");
doc.open();
div = doc.createElement("div");
div.innerHTML = text.replace(/\n/g, "<br>");
text = div.innerHTML;
text = text.replace(/<BR>/g,"\n");
text = text.replace(/&amp;/g,"&");


Code: [Select]
text = strInputCode.replace(/<\/?[^>]+(>|$)/g, "");
                            text = text.replace(/\n/g, "<br/>");
                            text = decodeXMLEntites(text);
                            text = text.replace(/<BR>/g, "\n");
                            text = text.replace(/&quot;/g, '"');
                            artistbio = text.replace(/&amp;/g,"&");

i use that directly from lastfm api input

WSH Panel Mod

Reply #667
i've stumbled across a really odd problem. i'm fetching data from last.fm and and am using this to save the results to text files.

Code: [Select]
ts = fso.FileExists(filename) ? fso.OpenTextFile(filename, 2) : fso.CreateTextFile(filename, 2);
ts.WriteLine(text);
ts.close();


but i've found a couple of artists that are causing this error...

Code: [Select]
WSH Panel Mod (GUID: 61276294-C90D-48B6-BE13-0C2328792088): Microsoft JScript runtime error:
Invalid procedure call or argument
Ln: 42, Col: 9
<source text only available in compile time>


line 42 is simply

Code: [Select]
ts.WriteLine(text);


how can the contents of "text" cause the function to fail? this is one example of some problematic text...

edit: sample removed. T.P has provided the solution.

WSH Panel Mod

Reply #668
@marc2003:
First you make wrong use of CreateTextFile() (but it's not important), and acutally OpenTextFile() can be used to create a file if file doesn't exist.

This most important thing is:
You try to write unicode chars (there are some korean chars in your sample) in ANSI files, so, open a text file in Unicode mode using:

Code: [Select]
var fs = fso.OpenTextFile(filename, 2, true, -1);


That's all.

WSH Panel Mod

Reply #669
cheers. that's sorted it.

WSH Panel Mod

Reply #670
WSH Panel Mod 1.3.0 Uploaded.

WSH Panel Mod

Reply #671
@TPWang: I think i found a bug.
I use the on_playback_time(time)  to provoke media downloading.
If time ==3 i do the download.
If i do WshShell.run just there in the on_playback_time(time), i get the error that WshShell doesnt exist which i really good as it doesnt !
But if i do it the way i do it which is
Code: [Select]
function on_playback_time(time) 
{
    if(time == 3)
    {
        
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.open("GET", url + "&s=" + Math.random(), true);
    xmlhttp.setRequestHeader('User-Agent','foo_lastfm_playcount_sync');
    xmlhttp.send();
    xmlhttp.onreadystatechange = function()
    {
             WshShell.run
        }
     }
}

I dont see the error. (i remove most of the code).
I suppose the stdout from xmlhttp isnt redirected to the console

WSH Panel Mod

Reply #672
I don't think so.


WSH Panel Mod

Reply #674
you didn't remove this bit. did you?

Code: [Select]
xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            //on success do something
        } else {
            fb.trace(xmlhttp.responsetext);
        }
    }
}


you have to wait for it to complete and this can take a few seconds if the remote server is being slow.