• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: odd Numbers's behaviour
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: odd Numbers's behaviour


  • Subject: Re: odd Numbers's behaviour
  • From: Yvan KOENIG <email@hidden>
  • Date: Thu, 18 Dec 2014 18:21:26 +0100


Le 18/12/2014 à 17:17, Deivy Petrescu <email@hidden> a écrit :


On Dec 18, 2014, at 10:14 , Yvan KOENIG <email@hidden> wrote:


Oops, I must apologize, I posted this message to Christopher's mailbox.

Yvan KOENIG (VALLAURIS, France) jeudi 18 décembre 2014 16:14:02


Le 18/12/2014 à 10:37, Christopher Stone <email@hidden> a écrit :

On Dec 18, 2014, at 03:15, Yvan KOENIG <email@hidden> wrote:
Here, with the System and the app running in French, the cell is not filled with the string but with the duration 12h 3m 25s.
______________________________________________________________________

Hey Yvan,

Still on 10.9.5 with Numbers 3.2.2.

I get the same thing.

I was able to work around it by:

tell application "Numbers"
tell document 1 to tell active sheet to tell table 1
set value of cell "B2" to ("'TEMP!'")
set value of cell "B2" to ("12Chicago3:25")
end tell
end tell

--
Take Care,
Chris


Thanks to you and Thomas Fischer

I knew that we may get the correct value if the cell format is set to text, as you did or using the set format instruction.
It's just annoying because to use that, we must know what we are trying to insert.
I asked with a script pasting a value but I discovered the problem when I opened a TAB separated values text file and in this case, the tip doesn't apply.
Now that I know that the problem is not restricted to the French version, I will file a bug report.
Just after posting my question I discovered that Numbers behave the same when I entered such entry by hand.

Yvan KOENIG (VALLAURIS, France) jeudi 18 décembre 2014 12:08:03

Interestingly if you use “TEMP”, before inserting “12Chicago3:25” it gets it right on that particular cell.
However, if you copy and paste the same value to other cell, it becomes  time.

By the way, the same script in JSA:


numbers=Application("Numbers")
cell=numbers.documents[0].activeSheet().tables[0].cells.byName("B4")
cell.value= "12Chicago:3:24”



And, I found out that cells are counted linearly, that is it is an array instead of a double array, so cells[24] depends on the size of the table.
I’d have preferred a cell as a double array so  cells[1][3] would be  cell “B4”



Deivy Petrescu
email@hidden

At this time, if we don't know for sure what is passed, there is only one way to transfer datas from a TAB selected values file (same problem with csv but more difficult to decipher) is to :
-> read the source file, examine the values cell by cell. If they are numbers or dates, set the cell's value to the value.
-> If they are text objects, set the format of the cell to text then set the value of the cell to the wanted value.

If we know the kind of the passed datas we may accept to change the format after the import process. So we may set the format of every cell to text then use GUI Scripting to paste the values as a block of text and at last apply the correct format.
I checked that it works with :
tell application "Numbers"
tell document 1 to tell active sheet to tell table 1
set format of range "B2:I22" to text
set selection range to range "B2"
my pasteTheValues("aaa 1234 31/12/1943 1Chicago:23:45
azerty 12345 B1/12/1950 10Vallauris:23:45
ab cd 31/12/1950 10Arpajon:23:45")
# No problem to force number format when the value is really not a number
set format of range "C2:C22" to number
try
# Required here because we get an error if some value (including empty cells) can't be treated as date
set format of range "D2:D22" to date
end try
end tell
end tell

on pasteTheValues(theValues)
set the clipboard to theValues
delay 0.2 # Required
tell application "System Events" to tell process "Numbers"
set frontmost to true
keystroke "v" using {command down}
end tell
end pasteTheValues

Yvan KOENIG (VALLAURIS, France) jeudi 18 décembre 2014 18:21:06



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Rép: odd Numbers's behaviour (From: Yvan KOENIG <email@hidden>)
 >Re: odd Numbers's behaviour (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: Re: JSA -- now I believe this is a bug (JSA or AS)
  • Next by Date: Re: Javascript for automation quastions
  • Previous by thread: Re: odd Numbers's behaviour
  • Next by thread: Cannot make new Mail rule
  • Index(es):
    • Date
    • Thread