import binary file

I am geocoding a list of addresses and would like to write them directly to a ov2 file. I have a php script that does the job, but have no idea how to convert it to applescript.

$csv=file(“File.csv”);
$nbcsv=count($csv);
$file=“POI.ov2”;
$fp = fopen($file, “w”);
for ($i = 0; $i < $nbcsv; $i++) {
$table = split(“,”,chop($csv[$i])); // Every ligne in this type: longitude,latitude,description
$lon = $table[0];
$lat = $table[1];
$des = $table[2];
$TT = chr(0x02).pack(“V”,strlen($des)+14).pack(“V”,round($lon100000)).pack(“V”,round($lat100000)).$des.chr(0x00);
@fwrite ($fp, “$TT”);
}
fclose($fp);

Many thanks and Happy new year!

Todd

update: I mistyped the title of this thread it should be exporting to binary

I don’t know how to do it with AppleScript. But you could do something like:

do shell script "php .........."

Open your terminal en try to get the right syntax by typing this into the shell:

Hope it helps,
ief2

Thank you, that works great. And being a php developer that is super easy to do. I did not know I could access php without having the php server fired up. Sweet!

Todd