The code I provided is an example of how to declare and call MacOS functions.

The reason this code does not work for you is that your version of REALbasic does not have the CFStringRef or Uint32 datatypes. The current version does, which is why moving to the current version would solve your problem. It is certainly possible to rewrite this code using only language features in your version to get code that would work for you.

Charles Yeomans

On Jan 31, 2007, at 7:31 PM, karl arder wrote:

Hi Charles,

Thanks for sticking with me this far, I fear to help-meter is on empty though!

Your reply is a bit cryptic and also very confusing... I don't understand what would need rewriting??? It's a toolbox call???

If you will, please explain to me why I can't just use declares instead of soft declares? It's just calling an Apple Toolbox function. Is there a reason this is not possible? Is there an example on how to call this in a declare?

Sorry for running this into the ground, but this is the last chink in getting this project done.

ka_

Message: 4
Subject: Re: Reading iTune XML Music List
From: Charles Yeomans <[EMAIL PROTECTED]>
Date: Wed, 31 Jan 2007 11:22:07 -0500

The easy solution is to use a more current version.  A harder
solution, certainly possible, would be to rewrite the code to support
older versions of REALbasic.

Charles Yeomans

On Jan 30, 2007, at 11:41 PM, karl arder wrote:

Sorry about that, I did state at the first post, but that was way
 back then...

OSX 10.4.8 & RB2005r2 Pro

Please have a solution for this!

Thanks,

ka_


Message: 11
Subject: Re: Reading iTune XML Music List
From: Charles Yeomans <[EMAIL PROTECTED]>
Date: Tue, 30 Jan 2007 10:58:22 -0500

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




=


=
Florida Realtor Flat Fee MLS from 249.00
Discount Florida realtor brokerage services. List your property in the (MLS) Multiple Listing Service for a flat fee from $249.00 in most areas of Florida. http://a8-asy.a8ww.net/a8-ads/adftrclick? redirectid=44b004dd6596ec2c059edb0a98dd88c3

_______________________________________________
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