URL class not work with ASStudio

Hi all :slight_smile:

Here my small problem…

I tests to convert a small script in ASStudio application, but I find an annoying incompatibility…

In this case, I seek to convert a simple string as the URL class (see the “StandardAdditions” Osax), just to check if it is valid, by simple following script:


set MyUrl to "http://www.apple.com/" as URL

set MyHost to host of MyUrl

set MyDns to dotted decimal form of MyHost
-->"17.112.152.32"

That work perfectly with the “Scripting Editor” and as an applet, but, the same instructions in a ASStudio project, turn over an error:

“-1700 : Can’t make "http://www.apple.com/\” into a «class url »."

Why ?
Could somebody know how to use the URL class (from StandardsAddition Osax) in a ASStudio project?

Thank-you :slight_smile:

Model: eMac
AppleScript: 1.9.3, XCode : 1.1
Browser: Internet Explorer 5.17
Operating System: Mac OS X (10.3.8)

Hi all :slight_smile:

Here a possible solution to solve the problem raised by URL class…

Actually, the concern comes from the encoding of the text to the Unicode format, which is not recognized directly by the URL class, and it is necessary then, as a preliminary, to convert the Unicode text to the “plain text” format to use it with the URL class.

Here the code (found at “Discussion” part in this page) which functions well in my ASStudio project:

on getPlainText(fromUnicodeString)
  set styledText to fromUnicodeString as string
  set styledRecord to styledText as record
  return «class ktxt» of styledRecord
end getPlainText

:wink:

Model: eMac
AppleScript: 1.9.3, XCode : 1.5
Operating System: Mac OS X (10.3.8)