IPB

Welcome Guest ( Log In | Register )

60 Pages V  « < 25 26 27 28 29 > »   
Reply to this topicStart new topic
WSH Panel Mod, foo_uie_wsh_panel_mod
marc2003
post Jan 19 2010, 17:31
Post #651





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



if you're using the script i posted the other day, it's my fault. crying.gif i'm reading the cached text file during window.repaint() rolleyes.gif 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. dry.gif

or maybe you figured that out already. tongue.gif

This post has been edited by marc2003: Jan 19 2010, 17:32
Go to the top of the page
+Quote Post
carmenm
post Jan 19 2010, 17:34
Post #652





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (marc2003 @ Jan 19 2010, 17:31) *
if you're using the script i posted the other day, it's my fault. crying.gif i'm reading the cached text file during window.repaint() rolleyes.gif 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. dry.gif

or maybe you figured that out already. tongue.gif

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
Go to the top of the page
+Quote Post
marc2003
post Jan 19 2010, 17:41
Post #653





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



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

CODE
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.

This post has been edited by marc2003: Jan 19 2010, 18:17
Go to the top of the page
+Quote Post
carmenm
post Jan 19 2010, 22:50
Post #654





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



i need help with WshShell.run
i have that command
CODE
"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
Go to the top of the page
+Quote Post
marc2003
post Jan 19 2010, 23:01
Post #655





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



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.
Go to the top of the page
+Quote Post
carmenm
post Jan 19 2010, 23:15
Post #656





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



ok something is really wrong, it doesnt open the command line :s
Go to the top of the page
+Quote Post
T.P Wang
post Jan 20 2010, 08:38
Post #657





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



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).

Go to the top of the page
+Quote Post
carmenm
post Jan 20 2010, 09:28
Post #658





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (T.P Wang @ Jan 20 2010, 08:38) *
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!
Go to the top of the page
+Quote Post
T.P Wang
post Jan 20 2010, 10:06
Post #659





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



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


CODE

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;"));
Go to the top of the page
+Quote Post
carmenm
post Jan 20 2010, 11:15
Post #660





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (T.P Wang @ Jan 20 2010, 10:06) *
QUOTE
i cant get it to work. I have difficulties translating the function.


CODE

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
Go to the top of the page
+Quote Post
marc2003
post Jan 20 2010, 14:13
Post #661





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (T.P Wang @ Jan 20 2010, 09:06) *
function decodeXMLEntites(text) {
}


fine with plain text but when you have special characters.....

CODE
fb.trace(xmlDoc.parseError.reason);
Reference to undefined entity 'oacute'


Go to the top of the page
+Quote Post
T.P Wang
post Jan 20 2010, 14:28
Post #662





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



@marc2003:
Then try this:
CODE

function decodeXMLEntites(text) {
var doc = new ActiveXObject("htmlfile");
doc.open();
var div = doc.createElement("div");
div.innerHTML = text;

return div.innerHTML;
}
Go to the top of the page
+Quote Post
carmenm
post Jan 20 2010, 14:49
Post #663





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (T.P Wang @ Jan 20 2010, 14:28) *
@marc2003:
Then try this:
CODE

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"
Go to the top of the page
+Quote Post
T.P Wang
post Jan 20 2010, 14:55
Post #664





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



Yes, because "\n" will be ignored in HTML, use <br/> instead.
Go to the top of the page
+Quote Post
carmenm
post Jan 20 2010, 15:25
Post #665





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (T.P Wang @ Jan 20 2010, 14:55) *
Yes, because "\n" will be ignored in HTML, use <br/> instead.

Thanks, i replace "\n" with <br/>, decode then replace <BR> with "\n" and it works !
Go to the top of the page
+Quote Post
marc2003
post Jan 20 2010, 15:40
Post #666





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



what have you ended up with? this is what i have. ohmy.gif

CODE
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,"&");
Go to the top of the page
+Quote Post
carmenm
post Jan 20 2010, 16:15
Post #667





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (marc2003 @ Jan 20 2010, 15:40) *
what have you ended up with? this is what i have. ohmy.gif

CODE
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
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
Go to the top of the page
+Quote Post
marc2003
post Jan 21 2010, 05:29
Post #668





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



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
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
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
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.

This post has been edited by marc2003: Jan 21 2010, 06:08
Go to the top of the page
+Quote Post
T.P Wang
post Jan 21 2010, 05:56
Post #669





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



@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
var fs = fso.OpenTextFile(filename, 2, true, -1);


That's all.
Go to the top of the page
+Quote Post
marc2003
post Jan 21 2010, 06:08
Post #670





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



cheers. that's sorted it.
Go to the top of the page
+Quote Post
T.P Wang
post Jan 21 2010, 09:06
Post #671





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



WSH Panel Mod 1.3.0 Uploaded.
Go to the top of the page
+Quote Post
carmenm
post Jan 21 2010, 09:20
Post #672





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



@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
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
Go to the top of the page
+Quote Post
T.P Wang
post Jan 21 2010, 09:41
Post #673





Group: Developer
Posts: 486
Joined: 8-June 07
From: Chengdu
Member No.: 44175



I don't think so.
Go to the top of the page
+Quote Post
carmenm
post Jan 21 2010, 10:21
Post #674





Group: Members
Posts: 720
Joined: 24-November 05
From: Grenoble
Member No.: 25981



QUOTE (T.P Wang @ Jan 21 2010, 09:41) *
I don't think so.

OK but still i dont see the error.
Go to the top of the page
+Quote Post
marc2003
post Jan 21 2010, 14:14
Post #675





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



you didn't remove this bit. did you?

CODE
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.
Go to the top of the page
+Quote Post

60 Pages V  « < 25 26 27 28 29 > » 
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th April 2014 - 07:23