Can't set string to number

Hi there !

I want to read text from a file and turn the result into a number. However I am getting strange characters from the result.

eg.

set x to “1” as number

–result → 1

Instead I am getting

–result → “1” (The quotes are upside down question marks) If I try to replicate them here the text disappears in this post !!! Weird !

What’s going on? Is it a formatting issue?

Kind regards

EM

WOW just copied all the text from the file into MS word… Every character is seperated by some weird character type…

I’m not sure what’s happening to my text file. Sorry I can’t paste any examples but it becomes invisible when I try to post it ???

Any ideas ???

Ok, so here’s where I 've lost it. I am convinced it is some form of formating taking place somewhere. Here’s the process.

I read a GPX file genereted by a Garmin Nuvi 200. It uses a form of XML to store the data. (Favorite locations)

I am able to extract all the fields succesfully and load them into a table.

I then edit the table and try to regenerate a new GPX file which will be loaded back onto the Garmin.

I use all the conventional applescript ways to read & write yet when I open the new GPX (text) file with text editor things get completely messed up.

My last try showed all my text in Chinese , I think … I really don’t know what to do to fix my problem.

I’ve tried writing as text , as Unicode text , as string but still CHAOS !!!

Please help !

Hey There,

You’ll probably get more responses if you post the Applescript code you are using for others to look at. Also if you have access to a web server zip the text file up and post a link to it. It could be in the coercion to a number you mention.

Good luck

Hi thanks for the reply.

I basically trashed ALL the original files I was using to test and read/write with. I generated new files with the Garmin and everything seems to be working now. I still have to test it at home where it all started but it all looks good so far.

I think I actually busted one of the files during a particular test phase and that caused my whole test chain to break. Go figure…

Thanks for the suggestions. I’ll keep them in mind for future issues.

Will report back if I figure out something !

Cheers
EM

(Sometimes it’s good to wrestle a problem on your own for a while. That’s how you learn to deal with problems and NEVER forget how to solve 'em !)
–My old man