degraham wrote:
I
did search the forums. Unfortunately searching on "pad" and "numbers" comes up with virtually every reference in the forum. "Pad" alone comes up with a lot of stuff about the number pad... 8(
If you can suggest a set of better search terms, I would be most grateful.
Also, your (otherwise excellent) solution will not work for me - I am pulling up data from a database and have no control over the numbers' spacing or format of the zeros. I need a more direct solution, unfortunately.
I apologize but on this forum you are meeting users trying to help other users.
We can't change the behaviour of an application.
_Go to "Provide Numbers Feedback" in the "Numbers" menu_, describe what you wish.
Then, cross your fingers, and wait _at least_ for iWork'09 😉
You may also use this script.
(*
Enregistrer le script en tant qu'Application ou Progiciel : padWithZeroSlashed.app
déplacer l'application créée 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.
Copier les nombres à formater dans le presse-papiers
Avec la version étendue, vous pouvez travailler sur plusieurs colonnes.
Placez le curseur où ça vous chante dans Numbers
menu Scripts > padWithZeroSlashed
Le script collera les nombres formatés selon le masque ØØØØØØØ.
+++++++
Save the script as an Application or an Application Bundle: padWithZeroSlashed.app
Move the newly created application 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.
Copy the numbers to format in the clipboard
With the enhanced version you may work on several colums.
Put the cursor where you wish in Numbers
menu Scripts > padWithZeroSlashed
The script will paste the numbers formatted with the mask ØØØØØØØ.
Yvan KOENIG le 18 mars 2008
*)
--(SCRIPT padWithZeroSlashed.app]
property lignesAvant : missing value
property lignesApres : missing value
property listeCells : missing value
property mask : missing value
property nbChars : 5
on run
set theApp to "Numbers"
my nettoie()
try
set txtDatas to the clipboard as Unicode text
on error (*
The clipboard was empty *)
return
end try
set my lignesAvant to paragraphs of txtDatas
if my parleAnglais() is false then
set msg to "Nombre de caractères souhaité ?"
else
set msg to "Pad to how many digits ?"
end if
tell application (path to frontmost application as string) to set len to choose from list {"4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "15"} default items {nbChars as text} with prompt msg
if len is false then return (* click on "Cancel" *)
set nbChars to len as integer
repeat nbChars times
set mask to mask & "Ø"
end repeat
if txtDatas contains tab then
repeat with n in my lignesAvant
set my listeCells to my decoupe(n, tab)
set r to ""
repeat with i from 1 to count of my listeCells
if i < (count of my lignesAvant) then
set r to r & my applyMask(item i of my listeCells) & tab
else
set r to r & my applyMask(item i of my listeCells)
end if
end repeat
copy r to end of my lignesApres
end repeat
else
repeat with n in my lignesAvant
copy my applyMask(n) to end of my lignesApres
end repeat
end if
set the clipboard to my recolle(my lignesApres, return)
tell application theApp to activate
tell application "System Events" to tell application process (my whichProcess(theApp)) to keystroke "v" using {command down}
my nettoie()
end run
--=============
on applyMask(nn)
local s
copy nn to s
if s is not "" then
set s to text -nbChars thru -1 of (mask & nn)
end if
return s
end applyMask
--=============
on decoupe(t, d)
local L
set AppleScript's text item delimiters to d
set L to text items of t
set AppleScript's text item delimiters to ""
return L
end decoupe
--=============
on recolle(L, d)
local t
set AppleScript's text item delimiters to d
set t to L as text
set AppleScript's text item delimiters to ""
return t
end recolle
--=============
on nettoie()
set my lignesAvant to {}
set my lignesApres to {}
set my listeCells to {}
set mask to ""
end nettoie
(* =============
An application named "NumbersAnglais.app" may be already running,
the script has activated "Numbers.app"
but the two apps named their process "Numbers".
We must check the "displayed name" to identity the correct one
*)
on whichProcess(the_App)
local listProcess, running, i
tell application "System Events"
set listProcess to (displayed name of processes)
repeat with i from 1 to count of listProcess
set running to 0
if item i of listProcess is (the_App & ".app") then
set running to i
exit repeat
end if
end repeat
end tell -- to System Events
return running
end whichProcess
--==================
on parleAnglais()
local z
try
tell application "Pages" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z = "Cancel")
end parleAnglais
--==================
--[/SCRIPT]
Yvan KOENIG (from FRANCE mardi 18 mars 2008 19:38:22)