What version of REALbasic are you using?

Charles Yeomans

On Jan 30, 2007, at 12:21 AM, karl arder wrote:

Ok, I was missing something simple. Thanks for the clarification.

But....

Nope, bitches like a wife in overdrive at <UINT32>. I don't see this in the Learning Reference of vartypes I can use in a Soft Declare. I tried to substitute with a simple Integer. Then I got an undefined return type error in the soft declare. Is there a vartype I can substitute to make this work?

Bloodied but not discouraged...

ka_


Message: 18
Subject: Re: Reading iTune XML Music List
From: Charles Yeomans <[EMAIL PROTECTED]>
Date: Mon, 29 Jan 2007 16:50:52 -0500


On Jan 29, 2007, at 4:33 PM, karl arder wrote:

 Thanks Charles,

Before I get down to business, thanks for the convert to B&W =20
formula you also posted. I have just been using BnW=3D(r+g+b)/3, =20
which is a bit dark and the contrast is off. Cool!

Now to iTunes...
I was wondering how Apple handled this problem. Seems they had to =20
figure out a way around this too.

So now I expose my ignorance... I'm not quite sure how to use the =20
declares you provided. I assume I use the raw URL path straight =20
from the iTunes list. I haven't a clue how to pass the two =20
parameters for <charactersToLeaveUnescaped> & =20
<legalURLCharactersToBeEscaped>. Do I have to further parse the =20
file name for specific characters?

No.  Note that the parameters come with default values; just use =20
those (or pass "").


You need to replace the illegal characters with percent codes.  For
MacOS, you can use the following function.

The raw path already has escaped characters - a space is %20 and I =20 again assume this is a 'legal' character. I have a tract by Bjork =20
(with an umlaut over the 'o') that causes an error. Unless I had =20
this tract I would never know this was an issue. How can I use =20
these declares for any/all possible characters in a valid song =20
name? Am I missing something simple???

Yes. Try the function in a test app and see what happens to Bj=F6rk. --


dim escapedURL as String =3D Escape("file://www.bj=F6rk.com").


Thanks again, you and others on this list have been most helpful to =20=

a newcomer, it's nice to feel welcome here.

ka_

Message: 8
Subject: Re: Reading iTune XML Music List
From: Charles Yeomans <[EMAIL PROTECTED]>
Date: Mon, 29 Jan 2007 11:33:35 -0500


On Jan 28, 2007, at 7:39 PM, karl arder wrote:

Ok, I seem to be hitting my head against every low hanging object...

Song names/paths can have a broader scope of characters than
allowed in a URL. How do I now convert the paths correctly so I
don't get errors with these characters.

I guess I'm plowing over ground that is a well trodden path with
regards to this subject. Are there any other 'surprises' I can
look  forward to?


You need to replace the illegal characters with percent codes.  For
MacOS, you can use the following function.

Function Escape(theURL as String, charactersToLeaveUnescaped as
String =3D "", legalURLCharactersToBeEscaped as String =3D "") As =
String
    if Encoding(theURL) is nil then
      // parameter '" + theURL + "' does not have an encoding."
      return theURL
    end if

soft declare function CFURLCreateStringByAddingPercentEscapes lib
"Carbon.framework" (allocator as Integer, originalString as
CFStringRef, charactersToLeaveUnescaped as CFStringRef,
legalURLCharactersToBeEscaped as CFStringRef, encoding as UInt32) as
CFStringRef

    const kCFAllocatorDefault =3D 0
    return CFURLCreateStringByAddingPercentEscapes
(kCFAllocatorDefault, theURL, charactersToLeaveUnescaped,
legalURLCharactersToBeEscaped, Encoding(theURL).Code)
End Function


And here is its inverse.

Function Unescape(theURL as String, charactersToLeaveEscaped as
String =3D "") As String
    if Encoding(theURL) is nil then
      // parameter '" + theURL + "' does not have an encoding."
      return theURL
    end if

    theURL =3D ConvertEncoding(theURL, Encodings.UTF8)

soft declare function CFURLCreateStringByReplacingPercentEscapes
lib "Carbon.framework" (allocator as Integer, originalString as
CFStringRef, charactersToLeaveEscaped as CFStringRef) as CFStringRef

    const kCFAllocatorDefault =3D 0

    return CFURLCreateStringByReplacingPercentEscapes
(kCFAllocatorDefault, theURL, charactersToLeaveEscaped)

End Function




=
Buy Tarps Direct and Save
Secure online ordering site for all your poly-tarp needs. We offer different grades and colors. No minimum order. We sell individual tarps. http://a8-asy.a8ww.net/a8-ads/adftrclick? redirectid=0de1d220db72ca1ce6b43d8aee7a6d7a

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to