As you didn't sent a true file, I decided to treat the most general case which slows the execution.
--{code}
--[SCRIPT links_from_csv]
(*
Enregistrer le script en tant que Script : links_from_csv.scpt
déplacer le fichier ainsi créé dans le dossier
<VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Numbers:
Il vous faudra peut-être créer le dossier Numbers et peut-être même le dossier Applications.
Aller au menu Scripts , choisir Numbers puis choisir “links_from_csv”
On peut aussi enregistrer le script en tant qu’application
et double cliquer son icône ou glisser déposer une icône de CSV sur son icône.
--=====
L’aide du Finder explique:
L’Utilitaire AppleScript permet d’activer le Menu des scripts :
Ouvrez l’Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
Cochez la case “Afficher le menu des scripts dans la barre de menus”.
Sous 10.6.x,
aller dans le panneau “Général” du dialogue Préférences de l’Éditeur Applescript
puis cocher la case “Afficher le menu des scripts dans la barre des menus”.
--=====
Save the script as a Script: links_from_csv.scpt
Move the newly created file into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Go to the Scripts Menu, choose Numbers, then choose “links_from_csv”
We may also save it as an application,
double click it or drag and drop a CSV's icon on its icon.
--=====
The Finder’s Help explains:
To make the Script menu appear:
Open the AppleScript utility located in Applications/AppleScript.
Select the “Show Script Menu in menu bar” checkbox.
Under 10.6.x,
go to the General panel of AppleScript Editor’s Preferences dialog box
and check the “Show Script menu in menu bar” option.
--=====
Yvan KOENIG (VALLAURIS, France)
2011/08/25
*)
--=====
property le_fichier : ""
--=====
on run
set le_fichier to choose file with prompt "Choose a csv file" of type {"public.comma-separated-values-text"}
--set le_fichier to "Macintosh HD:Users:yvankoenig:Desktop:Sans titre.csv" as alias
run scriptmain
end run
--=====
script main
my activateGUIscripting()
tell application "Numbers"
openle_fichier
set le_fichier to ""
tell document 1 to tell sheet 1 to tell table 1
repeat with r from 1 to row count
set les_valeurs to (get value of cells of row r)
repeat with c from 1 to count of les_valeurs
if item c of les_valeurs contains "//www" then
set nom_cell to name of cell c of row r
clearcellnom_cell
set selection range to range nom_cell
repeat with un_carac in item c of les_valeurs
my raccourci("Numbers", un_carac, "")
end repeat -- with un_carac
end if -- item c
end repeat -- item c
end repeat -- with r
set selection range to range "A1"
end tell -- document
end tell -- Numbers
end script
--=====
on open sel
set le_chemin to sel's item 1
tell application "System Events" to tell disk item (le_chemin as text)
set maybe to (get type identifier is "public.comma-separated-values-text")
end tell
if maybe then
set le_fichier to le_chemin
run scriptmain
else
if my parle_anglais() then
display alert "" & le_chemin & return & "isn’t a CSV one !" buttons " OK " default button 1
else
display alert "" & le_chemin & return & "n’est pas un fichier CSV !" buttons " Vu " default button 1
end if
end if
end open
--=====
on parle_anglais()
return (do shell script "defaults read 'Apple Global Domain' AppleLocale") does not start with "fr_"
end parle_anglais
--=====
on activateGUIscripting()
(* to be sure than GUI scripting will be active *)
tell application "System Events"
if not (UI elements enabled) then set (UI elements enabled) to true
end tell
end activateGUIscripting
--=====
(*
==== Uses GUIscripting ====
*)
(*
This handler may be used to 'type' text, invisible characters if the third parameter is an empty string.
It may be used to 'type' keyboard raccourcis if the third parameter describe the required modifier keys.
I changed its name « shortcut » to « raccourci » to get rid of a name conflict in Smile.
*)
on raccourci(a, t, d)
local k
tell applicationa to activate
tell application "System Events" to tell application process a
set frontmost to true
try
t * 1
if d is "" then
key codet
else if d is "c" then
key codetusing {command down}
else if d is "a" then
key codetusing {option down}
else if d is "k" then
key codetusing {control down}
else if d is "s" then
key codetusing {shift down}
else if d is in {"ac", "ca"} then
key codetusing {command down, option down}
else if d is in {"as", "sa"} then
key codetusing {shift down, option down}
else if d is in {"sc", "cs"} then
key codetusing {command down, shift down}
else if d is in {"kc", "ck"} then
key codetusing {command down, control down}
else if d is in {"ks", "sk"} then
key codetusing {shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
key codetusing {command down, shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "a" then
key codetusing {command down, shift down, option down}
end if
on error
repeat with k in t
if d is "" then
keystroke (k as text)
else if d is "c" then
keystroke (k as text) using {command down}
else if d is "a" then
keystrokekusing {option down}
else if d is "k" then
keystroke (k as text) using {control down}
else if d is "s" then
keystrokekusing {shift down}
else if d is in {"ac", "ca"} then
keystroke (k as text) using {command down, option down}
else if d is in {"as", "sa"} then
keystroke (k as text) using {shift down, option down}
else if d is in {"sc", "cs"} then
keystroke (k as text) using {command down, shift down}
else if d is in {"kc", "ck"} then
keystroke (k as text) using {command down, control down}
else if d is in {"ks", "sk"} then
keystroke (k as text) using {shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "k" then
keystroke (k as text) using {command down, shift down, control down}
else if (d contains "c") and (d contains "s") and d contains "a" then
keystroke (k as text) using {command down, shift down, option down}
end if
end repeat
end try
end tell
end raccourci
--=====
--[/SCRIPT]
--{code}
Yvan KOENIG (VALLAURIS, France) jeudi 25 août 2011 12:09:58
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !