2 odities I wanted to check with people.

I have just written a script to convert some XML files.

It read the data between 2 tags which look like this:

1234.5 6789.1 1.23

This works perfectly on an English version of OSX using


repeat with stringumber in stringnumbers
set numberlist to numberlist & (stringnumber as number)
end repeat

but not on any other localization of OS X but if I change the middle line to


set numberlist to numberlist & (stringnumber as string)

it works perfectly on ALL versions of OS X

I think I understand why but I’d like someone with more knowledge just to confirm it for me.

The other problem I am having is I have used a progress bar (that I found on this site) in my script. it is found in contents>resources>scripts>progress>progress.app

On my machine this works perfect and on others it seem’s to work fine aswell but some peoples machines just say “cannot find progress.app”

If they show the package contents and navigate to the file and add the .app extension it seem’s to work but it seem’s a little odd that they would have to do this.

does anyone have any idea why?

My code for finding the progress.app is as follows:


set )mepath to path to me as string
set Progress to load script alias (_mepath & "contents:resources:scripts:progress:progress.scpt")

It is actually progress.scpt that calls progress.app but I don’t see why this should make a difference

Dave

Hi Dave,

The localizations on Mac OS X contain different characters for the decimal separator.

For example, here in Germany we use a comma:

10,40

But in the US, a dot is used:

10.40

That is why the following code returns different values:


set num to "0.2" as number
-- returns 2 on a German system
-- returns 0.2 on a US system

Of course you do not run into this problems when you don’t coerce the value into a number, but just use a string value.

You can always check for the current decimal separator with code like follows:


-- I am returning the currently used decimal separator
on getdecseparator()
   set strnum to 0.1 as Unicode text
   set decseparator to character 2 of strnum
   return decseparator
end getdecseparator