Set row as header using applescript
I am new to AppleScript and I am writing my first script to crunch some data in numbers. I am trying to figure out how to set row one as the header row in sheet 1 using the script. Can anyone help?
Here is a script a bit more powerful that what you asked for but it's of more general use.
--{code}
--[SCRIPT set_count_of_Xers]
Enregistrer le script en tant que Script : set_count_of_Xers.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 “set_count_of_Xers”
En fonction des paramètres passés, le script fixera le nombre de Rangs d’en-tête, Colonnes d’en-tête ou Rangs de bas de tableau dans le tableau table_name de la feuille sheet_name du document doc_name.
--=====
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: set_count_of_Xers.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 “set_count_of_Xers”
According to the defined parameters, the script will set the count of HEADer ROWs, HEADer COLUMNs or FOOTer ROWS in the table table_name of the sheet sheet_name in the document doc_name.
--=====
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/09/21
--=====
property forTests : false
true may be useful for tests. It triggers the handler select_SubMenu which list the UI elements.
false is the setting to apply when the script is finished because it runs faster.
--=====
on run
my activateGUIscripting()
This script is a general one allowing to treat the defined table
set doc_name to 1
set sheet_name to "Feuille 2"
set table_name to "Tableau 1"
set which_item to 10
set nb_Xers to 1
my setNbXers(doc_name, sheet_name, table_name, which_item, nb_Xers) (* to set 1 HEADer ROW *)
end run
--=====
which = 10 --> set count of HEADer ROWs
my setNbXers(1, "Feuille 2", "Tableau 1", 10, 1) (* to set 1 HEADer ROW *)
which = 11 --> set count of HEADer COLUMNs
my setNbXers("my doc.numbers", "Sheet 5", "Table aux", 11, 4) (* to set 4 HEADer COLUMNs *)
which = 14 --> set count of FOOTer ROWs
my setNbXers("ASCII.numbers", "Sheet of paper", "TableTop", 14, 3) (* to set 3 FOOTer ROWs *)
on setNbXers(docName, sheetName, tableName, whichItem, nbXers)
my selectTable(docName, sheetName, tableName)
if forTests then
my select_SubMenu("Numbers", 6, whichItem, nbXers + 1)
else
my selectSubMenu("Numbers", 6, whichItem, nbXers + 1)
end if
end setNbXers
--=====
set { dName, sName, tName, rowNum1, colNum1, rowNum2, colNum2} to my get_SelParams()
tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
on get_SelParams()
local d_name, s_name, t_name, row_num1, col_num1, row_num2, col_num2
tell application "Numbers" to tell document 1
set d_name to its name
set s_name to ""
repeat with i from 1 to the count of sheets
tell sheet i to set maybe to the count of (tables whose selection range is not missing value)
if maybe is not 0 then
set s_name to name of sheet i
exit repeat
end if -- maybe is not 0
end repeat
if s_name is "" then
if my parleAnglais() then
error "No sheet has a selected table embedding at least one selected cell !"
else
error "Aucune feuille ne contient une table ayant au moins une cellule sélectionnée !"
end if
end if
tell sheet s_name to tell (first table where selection range is not missing value)
tell selection range
set {top_left, bottom_right} to {name of first cell, name of last cell}
end tell
set t_name to its name
tell cell top_left to set {row_num1, col_num1} to {address of its row, address of its column}
if top_left is bottom_right then
set {row_num2, col_num2} to {row_num1, col_num1}
else
tell cell bottom_right to set {row_num2, col_num2} to {address of its row, address of its column}
end if
end tell -- sheet…
return {d_name, s_name, t_name, row_num1, col_num1, row_num2, col_num2}
end tell -- Numbers
end get_SelParams
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
on decoupe(t, d)
local oTIDs, l
set oTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to d
set l to text items of t
set AppleScript's text item delimiters to oTIDs
return l
end decoupe
--=====
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 ====
on selectTable(theDoc, theSheet, theTable)
local maybe, targetSheetRow, rowIndex, r
try
tell application "Numbers"
activate
set theDoc to name of document theDoc (* useful if the passed value is a number. Checks also that we passed the name of an open doc *)
end tell -- Numbers
on error
if my parleAnglais() then
error "The spreadsheet “" & theDoc & "” is not open !"
else
error "Le tableur « " & theDoc & " » n’est pas ouvert ! "
end if -- my parleAnglais
end try
try
tell application "Numbers" to tell document theDoc
set theSheet to name of sheet theSheet (* useful if the passed value is a number and check the availability of theSheet if it’s a string *)
end tell -- Numbers
on error
if my parleAnglais() then
error "The sheet “" & theSheet & "” is unavailable in the spreadsheet “" & theDoc & "” !"
else
error "La feuille « " & theSheet & " » n’existe pas dans le tableur « " & theDoc & " » ! "
end if -- my parleAnglais
end try
try
tell application "Numbers" to tell document theDoc to tell sheet theSheet
set theTable to name of table theTable (* useful if the passed value is a number and check the availability of theSheet if it’s a string *)
end tell -- Numbers
on error
if my parleAnglais() then
error "The table “" & theTable & "” is unavailable in the sheet “" & theSheet & "” of the spreadsheet “" & d & "” !"
else
error "La table « " & theTable & " » n’existe pas dans la feuille « " & theSheet & " » du tableur « " & d & " » ! "
end if -- my parleAnglais
end try
set maybe to 5 > (system attribute "sys2")
tell application "System Events" to tell application process "Numbers"
tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window theDoc
if maybe then (* macOS X 10.4.x
'(value of attributes contains 0)': '(value of attribute "AXDisclosureLevel" is 0)' sometimes works in Tiger, sometimes not.
The only possible instances of 0 amongst the attributes are the disclosure level of a sheet row and the index of the first row, which represents a sheet anyway.
Another possibility is '(value of attribute -1 is 0)', which makes me uneasy. *)
set targetSheetRow to first row where ((value of attributes contains 0) and (value of first static text is theSheet))
else (* macOS X 10.5.x or higher *)
set targetSheetRow to first row where ((value of attribute "AXDisclosureLevel" is 0) and ((groups is {}) and (value of first static text is theSheet)) or (value of first group's first static text is theSheet))
end if -- maybe
tell targetSheetRow to set {value of attribute "AXSelected", value of attribute "AXDisclosing"} to {true, true}
-- Get the sheet row's 0-based index + 2 for the following row's 1-based index.
set r to (value of attribute "AXIndex" of targetSheetRow) + 2
repeat until (value of first static text of row r is theTable)
set r to r + 1
end repeat
set value of attribute "AXSelected" of row r to true
end tell -- outline 1 …
end tell -- System Events
end selectTable
--=====
my selectSubMenu("Pages",6, 4, 26)
==== Uses GUIscripting ====
on selectSubMenu(theApp, mt, mi, ms)
tell application theApp
activate
tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
tell menu bar item mt to tell menu 1 to tell menu item mi to tell menu 1 to click menu item ms
end tell -- application theApp
end selectSubMenu
--=====
useful to get the indexs of the triggered item
my select_SubMenu("Numbers", 6, 10, 1+1) (* Table > Header rows > 1 *)
on select_SubMenu(theApp, mt, mi, ms)
tell application theApp
activate
tell application "System Events" to tell process theApp to tell menu bar 1
get name of menu bar items
01 - "Apple",
02 - "Numbers",
03 - "Fichier",
04 - "Édition",
05 - "Insertion",
06 - "Tableau",
07 - "Format",
08 - "Disposition",
09 - "Présentation",
10 - "Fenêtre",
11 - "Partage",
12 - "Aide"}
get name of menu bar item mt
-- {"Tableau"}
tell menu bar item mt to tell menu 1
get name of menu items
01 - "Insérer un rang d’en-tête au-dessus"
02 - "Insérer un rang d’en-tête en dessous"
03 - missing value
04 - "Insérer une colonne d’en-tête avant"
05 - "Insérer une colonne d’en-tête après"
06 - missing value
07 - "Supprimer le rang"
08 - "Supprimer la colonne"
09 - missing value
10 - "Rangs d’en-tête"
11 - "Colonnes d’en-tête"
12 - "Bloquer les rangs d’en-tête"
13 - "Bloquer les colonnes d’en-tête"
14 - "Rangs de bas de tableau"
15 - missing value
16 - "Ajuster les rangs au contenu"
17 - "Ajuster les colonnes au contenu"
18 - missing value
19 - "Afficher tous les rangs"
20 - "Afficher toutes les colonnes"
21 - "Activer toutes les catégories"
22 - missing value
23 - "Fusionner les cellules"
24 - "Diviser en rangs"
25 - "Diviser en colonnes"
26 - missing value
27 - "Répartir les rangs uniformément"
28 - "Répartir les colonnes uniformément"
29 - missing value
Similar Messages
-
How to set stationery in Mail, using AppleScript
Is there a way to automatically use specific stationery with Mail, from an AppleScript script?
To the script below I would like to add an instruction which asigns stationery to the mail message, and so far I have not yet found a working way of doing it.
on run {theSubject, theBody, theAttachment}
tell application "Mail"
set newMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theBody & return & return}
tell content of newMessage
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
activate
end tell
end run
I found an Automator example which requires the installation of an action, but once installed, it does not work. (It must have worked in OSX 10.6, but it does not on Mountain Lion) Here: Automator: Examples
Any ideas, anyone?
Thanks, Olivertry this:
tell application "Numbers"
tell table 1 of sheet 1 of document 1
repeat with i from 1 to row count
if value of cell 14 of row i is equal to renew_month then
set address_to to value of cells of row i
end if
end repeat
end tell
end tell -
How can I set "SOAPAction" http header using SAAJ
When I send soap request, http header's like below
SOAPAction: ""
But, I'd like to send like this
SOAPAction: "http://tempuri.org/HelloWorld"
How can I that using SAAJ ?
My code is
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
" <soap:Body>\n" +
" <HelloWorld xmlns=\"http://tempuri.org/\" />\n" +
" </soap:Body>\n" +
"</soap:Envelope>";
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(xml.getBytes()));
DOMSource domSource = new DOMSource(doc);
SOAPMessage message = MessageFactory.newInstance().createMessage();
message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "utf-8");
message.setProperty(SOAPMessage.WRITE_XML_DECLARATION, "true");
message.getSOAPPart().setContent(domSource);
message.writeTo(System.out);
SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection();
SOAPMessage response = connection.call(message, helloURL);
connection.close();
SOAPBody body = response.getSOAPBody();
if ( body.hasFault() )
SOAPFault newFault = body.getFault();
System.out.println("SoapBody has fault.");
System.out.println("code=" + newFault.getFaultCodeAsName());
System.out.println("message=" + newFault.getFaultString());
System.out.println("actor=" + newFault.getFaultActor());
else
System.out.println("Call Successed.");
System.out.println(body);
}message.getMimeHeaders().addHeader("SOAPAction", "http://tempuri.org/HelloWorld");
-
Set level for bookmarks using applescript or javascript
hi everyone!
In my indesign document having 3 paragraphs. And set bookmarks of level one by one to these paragraphs.
Please anyone can help me?
tell application "adobe indesign cc 2014"
tell active document
set selectItem to item 1 of selection
set textdestinate to make hyperlink text destination with properties {name: selectItem, destination text:item 1 of selection}
set BknameInnerItem to make new bookmark with properties {destination:textdestinate}
end tell
end tell
--Then, how to set bookmark level in the hyperlink text destination properties? Is it possible?To add a new level, add a bookmark to another bookmark; that will automatically indent it.
-
OSB - Setting http Authorization header with Proxy Service
Hi,
I have the following scenario:
PS1 -> PS2 -> BS (with a SA configured to pass through)
I need to set the Authorization http header based on some information in payload, so:
PS1 receives the payload and route to PS2, where username/password are extracted and using a java call out the base64 hash is generated.
In the PS2 route i'm trying to set the Authorization header using the set Transport Headers option.
When i do a request to test this operation, osb show me a beautiful CredentialNotFound exception.
I have tryied to set the Authorization header in the route on the PS1, without success.
Someone can help me ?I can't set the Proxy Service to do the authentication. I will try to explain better:
I have a Business Service which have a Service Account associated to pass through the Authorization header to the service provider do the validation.
I front of this business service i have a Proxy Service which route the requests to the BS.
All partners send this Authorization header, but now, i have one that will not send no matter what.
The username and passwrod will come into the payload (and will be variable).
In some point before the proccess i need to extract the information from payload and set the Authorization header.
Ty for you time.
Edited by: GSanches on 09/07/2010 09:59 -
How to use AppleScript to set "character fill color" in Pages 5.2?
For Pages 5.2 on OSX 10.9.3, what is the correct applescript for changing the "character fill" of text in pages.
If you highlight text, you do this via your mouse in the inspector by clicking "style," "advanced option (the gear wheel to the right of bold, italics, and underline), "character fill color (clicking on the multi-color circle, not the dropdown menu), and then choosing a color that comes up in the "colors" dialogue box.
I've looked all over and cannot find how to use applescript to set the character fill color in pages.
In some examples (not directly related) I see "character fill" used.
In others, I see "colorfill."
Basically, I want to use applescript, embedded in a keyboard maestro macro, to change the background color of the text (not the text color itself) to particular colors.
Given the changes and updates to Pages this year, and to applescript, what's the easy way to do this?
Thanks!
ChuckPages v5.2 still does not include selection-object, or character background color entries in its AppleScript dictionary, as does Pages ’09. Indirectly, using System Events, you can get the text selection in Pages v5.2, but then you can do nothing to change the selection. No assurances as to if or when Apple will mature the AppleScript dictionary support for Pages v5 series.
-
Problem setting Unicode (utf-8) in http header using tomcat
Hi:
I am trying to set a file name in utf-8 to http header using the following code:
response.setContentType("text/html; charset=utf-8");
response.setHeader("Content-disposition", "attachment; filename=解決.zip");
// I actually has file name in utf-8 here to set to the header, and I know that the name is correctly
// and I also looked into the response object MimeHeaders object and saw the head is correctly there
then write the content of zip file using ServletOutputStream.
The problem I have is that the file name is not displayed correctly when prompted to save or open in the pop up window next. I found out using Fiddler that the request header is wrong:
Content-disposition: attachment; filename=�zn��.zip
I am using Tomcat 5.0.28. Any idea how to get this working?
Thanks in advance!You are setting the charset for the content to be UTF-8. (That is why the method is called setContentType.) But HTTP headers are not part of the content and so that has no effect on the header.
The original specification for HTTP only allowed US-ASCII characters in headers. It is possible that more recent versions have features that allow for non-ASCII header data, but I don't know if that is the case or how you would use those features if they exist. -
Using applescript how do I set the angle of a gradient
Using Applescript I need to set the angle of the gradient to 90 degrees. I've tried everything I can see in the scripting guide.
This is a sample of the script I'm using to set the gradient all I need to know is where and how to set the gradient to horizontal. Please forgive me as I'm a real newbie at this!!!
tell application "Adobe Illustrator"
activate
make new document
set ellipseRect to {100, 100, 500, 500}
set ellipseColor to {cyan:0.0, magenta:100.0, yellow:100.0, black:0.0}
set myellipse to make new ellipse at beginning of current document with properties {bounds:ellipseRect, inscribed:true, reversed:false, stroke color:ellipseColor, fill color:ellipseColor}
set Doc_Ref to the current document
tell Doc_Ref
if not (exists gradient "My Gradient") then
set This_Gradient to make new gradient at end with properties ¬
{name:"My Gradient", gradient type:linear}
set properties of gradient stop 1 of This_Gradient to ¬
{midpoint:50, ramp point:0.0, color:{cyan:0, magenta:50, yellow:100, black:0}}
set properties of gradient stop 2 of This_Gradient to ¬
{midpoint:50, ramp point:100.0, color:{cyan:10, magenta:100, yellow:100, black:0}}
end if
if exists path item 1 then
set fill color of every path item to {gradient:gradient "My Gradient"}
end if
end tell
end tellI think I the gradient angle property is broken, try rotating the object setting all the "change" properties to false, except changeFillGradients.
rotate
(angle
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,rotateAbout]) -
Setting options in "Printer" section using Applescript InDesign CS
How can i set define supplementary options found in the "Printer" section of the InDesign dialog box in a print preset using Applescript?
I would like my script to set duplex option with the proper binding, according to the page orientation.
When creating print presets manually, these extra options are stored in the print preset, but I can't find how to access them thru Applescript.
Thanks,
PeterShane,
Thanks for your reply, but it is not yet clear to me.
I know you can set some print properties in the Apple Print event, such as copies, collating, target printer ...but how can I adress the printer-specific options, such as duplex printing? Could you give me a sample line of code?
And next step, how can I include this "Apple -print" setting in an InDesign Print preset using Applescript? I suppose I have to set the apple printer prefs before creating the InDesign preset. Right?
Thanks in advance,
Peter -
How to set xml tag to nothing in indesign using applescript?
Hi guys,
I need set xml tag to nothing(for tables) in indesign using applescript.
Please help me.Hi,
tell application "Adobe InDesign CC 2014"
tell active document
if (count of story) > 0 then
tell story 1
if (count of tables) > 0 then
tell table 1
set tag_name to associated XML element ----------------> i can't get xml tag, i am receiving the xml tag is nothing.
if (tag_name = nothing) then
display dialog ("This table has no tag")
else
set markup_tag to markup tag of tag_name
set n to name of markup_tag
display dialog ("Tag name is " & n)
end if
end tell
end if
end tell
end if
end tell
end tell
I can't get xml tag for table, i am received nothing -
Opening Front Row Using Applescript
I have created a sleep timer for Front Row but I would like if Front Row would open when I run the sleep timer. I have tried the normal activate command as well as open and launch but none of these open front row.
Can anyone show me some code that will open Front Row automatically?
Thanks for the help.That still didnt open Front Row.
I was wondering if it was possibly to use the keyboard shortcut to activate front row. the command escape keys pressed together open front row. I dont know how to do that using applescript though.
Thanks for the effort though. -
How to show the VALUE as the Column Header using SQL query?
Hi
I have a requirement to show the picked value as the column header using SQL query.
Example:
======
SELECT EMPNO FROM EMP
WHERE EMPNO=7934;
Result Should be:
7934
7934I have a requirement to show the picked value as the column header using SQL query.In sql*plus you can do
SQL> set verify on
SQL> def e = 7934
old: SELECT empno "&&e" FROM emp WHERE empno = &&e
new: SELECT empno "7934" FROM emp WHERE empno = 7934
SQL> SELECT empno "7934" FROM emp WHERE empno = 7934
7934
7934
1 row selected. -
Using Applescript to Copy a Table Across Sheets
Hi,
I am learning to use Applescript and I am not sure how to do the following:
Copy a cell value from one table in one sheet to another table in another sheet.
I tried the following:
tell sheet “B”
set value of cell 1 of row 1 of table “X” to (value of cell 1 of row 1 of table “X” of sheet “A”)
end tell
But that does not work.I forgot to write that you must ALWAYS coerce values to strings.
set value of cell 1 of row 1 of table “X” of sheet “B” to (value of cell 1 of row 1 of table “X” of sheet “A”) as text
or
set a_val to value of cell 1 of row 1 of table “X” of sheet “A”
if class of a_val is date then set a_val to a_val - (time to GMT)
set value of cell 1 of row 1 of table “X” of sheet “B” to a_val as text
or
tell sheet "A" to tell table "X"
set a_val to value of cell 1 of row 1
end tell
tell sheet "B" to tell table "X"
if class of a_val is date then set a_val to a_val - (time to GMT)
set value of cell 1 of row 1 to a_val as text
end tell
It's necessary for :
(1) decimal numbers because an Applescript's decimal number use always the period character as decimal separator. Coercing to string replace this standard character by the localized one which is the comma in several countries.
(2) Numbers doesn't know the object date_time of Ap^pleScript. This is why you got the error : "Numbers got an error: AppleEvent handler failed.”
Coercing the date to string (or text which is exactly the same task), you send to Numbers a known structure. As you saw, in the 2nd and 3rd pieces of code, I substract the value (time to GMT) when a value is a date_time one. It's required to take care of the Numbers internal behavior.
Yvan KOENIG (VALLAURIS, France) mercredi 30 mars 2011 20:29:40 -
Can I chart in Numbers using AppleScript
I have just started learning AppleScript so that I can automate some business processes and save myself some time. Because of better design and ease of use I use the latest version of iWork and don't even have Office installed on my Mac, nor do I want to install it. However, one area I cannot work out is how to automate the creation of a chart in Numbers using AppleScript.
Is this possible? If so, how, and if not, why not?Answering questions like : how may we do this or that, is what we are supposed to try to achieve in this forum.
Answering questions like yours : why this or that, can't be seriously done here.
Here you ask to end users like you. We don't belong to the teams designing the apps.
We just may try to guess.
To build tables and charts Pages and Numbers share the same pieces of code so there is no technical reasons able to explain the omission.
So I guess that, as Pages is in its 4th version, designers had more time available to embed features in the AppleScript support than those working upon Numbers.
What's funny is that there is a minimal support for charts in Pages (as well as a microscopic support for tables) but there is a correct support for tables (which may be enhanced) in Numbers but nothing for charts.
Honestly, I really don't think that the difference is huge.
I posted my script too fast.
I forgot to insert the handler allowing us to bring a sheet at front which is required to apply GUIScripting.
It's probably the main drawback of the need to use GUIScripting here.
I don't waste time trying to apply some edit tasks to the charts.
I just wanted to fill the gap between Pages and Numbers about scripting charts.
Here is an enhanced version.
--{code}
--[SCRIPT add_charts]
Yvan KOENIG (VALLAURIS, France)
2011/08/27
on run
my activateGUIscripting()
tell application "Numbers" to tell document 1
set dName to its name
set sName1 to name of sheet 1
set sName2 to name of sheet 2
Select sheet 1 of document 1
The doc name may be passed by a number but the sheet must be identified by its name .
As it's just a sample, in the first call I reference the doc by its index *)
my selectSheet(1, sName1)
tell sheet sName1 to tell table 1
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 9) -- Scatter chart
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 3) -- Bars
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 4) -- Stacked Bars
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 3 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 20) -- 3D Pie
end tell
Select sheet 2 of document 1
This time, I reference the document by its name *)
my selectSheet(dName, sName2)
tell sheet sName2 to tell table 1
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 9) -- Scatter chart
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 3) -- Bars
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 4) -- Stacked Bars
Always define the selection before creating a chart *)
set selection range to range (name of cell 4 of column 3 & " : " & name of cell 8 of column 3)
my selectSubMenu("Numbers", 5, 4, 20) -- 3D Pie
end tell --sheet 2…
end tell -- Numbers…
end run
--=====
on parleAnglais()
local z
try
tell application "Numbers" to set z to localized string "Cancel"
on error
set z to "Cancel"
end try
return (z is not "Annuler")
end parleAnglais
--=====
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 ====
on selectSheet(theDoc, theSheet)
script myScript
property listeObjets : {}
local maybe, targetSheetRow
tell application "Numbers"
activate
set theDoc to name of document theDoc (* useful if the passed value is a number *)
tell document theDoc to set my listeObjets to name of sheets
end tell -- "Numbers"…
set maybe to theSheet is in my listeObjets
set my listeObjets to {} -- So it will not be saved in the script *)
if not maybe then
if my parleAnglais() then
error "The sheet “" & theSheet & "” is unavailable in the spreadsheet “" & theDoc & "” !"
else
error "La feuille « " & theSheet & " » n’existe pas dans le tableur « " & theDoc & " » ! "
end if -- my parleAnglais
end if -- not maybe
set maybe to 5 > (system attribute "sys2")
tell application "System Events" to tell application process "Numbers"
tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window theDoc
if maybe then (* macOS X 10.4.x
'(value of attributes contains 0)': '(value of attribute "AXDisclosureLevel" is 0)' sometimes works in Tiger, sometimes not.
The only possible instances of 0 amongst the attributes are the disclosure level of a sheet row and the index of the first row, which represents a sheet anyway.
Another possibility is '(value of attribute -1 is 0)', which makes me uneasy. *)
set targetSheetRow to first row where ((value of attributes contains 0) and (value of first static text is theSheet))
else (* macOS X 10.5.x or higher *)
set targetSheetRow to first row where ((value of attribute "AXDisclosureLevel" is 0) and ((groups is {}) and (value of first static text is theSheet)) or (value of first group's first static text is theSheet))
end if -- maybe…
Handler modified to accomodate sheets requiring a lot of time to get the focus
tell targetSheetRow to set value of attribute "AXSelected" to true
set cnt to 0
repeat (*
Must way that Numbers becomes ready to receive the value *)
try
tell targetSheetRow to set value of attribute "AXDisclosing" to true
exit repeat
on error
set cnt to cnt + 1
delay 0.5 -- half a second
end try
end repeat
end tell -- outline…
end tell -- "System Events"…
tell application "Numbers" to tell document theDoc to tell sheet theSheet to tell table 1
with timeout of 20 * 60 seconds (*
WITH this setting, the script will be able to wait 20 minutes for the asked value.
I hope that the document will not be so huge that this delay prove to be too short. *)
value of cell "A1"
end timeout
end tell -- "Numbers"…
tell application "System Events" to tell application process "Numbers" (*
Do the trick one more time to be sure that the sheet is open *)
tell targetSheetRow to set value of attribute "AXDisclosing" to true
end tell -- "System Events"…
End of the modified piece of code
end script
run myScript
end selectSheet
--=====
my selectSubMenu("Pages",6, 4, 26)
==== Uses GUIscripting ====
on selectSubMenu(theApp, mt, mi, ms)
tell application theApp
activate
tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
tell menu bar item mt to tell menu 1 to tell menu item mi to tell menu 1 to click menu item ms
end tell -- application theApp
end selectSubMenu
--=====
useful to get the indexs of the triggered item
my select_SubMenu("Numbers", 6, 4, 3) (* Table > Chart> Bars *)
on select_SubMenu(theApp, mt, mi, ms)
tell application theApp
activate
tell application "System Events" to tell process theApp to tell menu bar 1
get name of menu bar items
01 - "Apple",
02 - "Numbers",
03 - "Fichier",
04 - "Édition",
05 - "Insertion",
06 - "Tableau",
07 - "Format",
08 - "Disposition",
09 - "Présentation",
10 - "Fenêtre",
11 - "Partage",
12 - "Aide"}
get name of menu bar item mt
-- {"Tableau"}
tell menu bar item mt to tell menu 1
get name of menu items
01 - "Feuille",
02 - missing value,
03 - "Tableau",
04 - "Graphique",
05 - "Figure",
06 - "Zone de texte",
07 - "Fonction",
08 - "Ligne de connexion",
09 - missing value,
10 - "Remplissage",
11 - missing value,
12 - "Rangs copiés",
13 - "Colonnes copiées",
14 - missing value,
15 - "Date et heure",
16 - "Nom du fichier",
17 - "Numéro de page",
18 - "Nombre de pages",
19 - missing value,
20 - "Commentaire",
21 - "Lien",
22 - "Saut de colonne",
23 - "Équation MathType",
24 - missing value,
25 - "Choisir…"}
get name of menu item mi
--> "Graphique"
tell menu item mi to tell menu 1
get name of menu items
01 - "Colonnes",
02 - "Colonnes empilées",
03 - "Barres",
04 - "Barres empilées",
05 - "Ligne",
06 - "Couches",
07 - "Couches empilées",
08 - "Diagramme circulaire",
09 - "Nuage de points",
10 - "Mixte",
11 - "2 axes",
12 - missing value,
13 - "Colonnes 3D",
14 - "Colonnes 3D empilées",
15 - "Barres 3D",
16 - "Barres 3D empilées",
17 - "Linéaire 3D",
18 - "Couches 3D",
19 - "Couches 3D empilées",
20 - "Circulaire 3D"}
get name of menu item ms
--> "Barres"
click menu item ms
end tell
end tell
end tell
end tell -- application theApp
end select_SubMenu
--=====
--[/SCRIPT]
--{code}
Yvan KOENIG (VALLAURIS, France) samedi 27 août 2011 15:19:15
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 ! -
Use Applescript to list duplicates in Mac Office Excel 2011
Hello Apple scripters!
I was thinking if it's possible to use Applescript in Excel to find duplicates using conditional formating then export it on a new list.
Compare 2 columns>highlight duplicates>add result in a new csv file together with either the whole row or column line.
Thanks!
ErnestoYou might try looking/posting here.
Microsoft Support – Office for Mac
Microsoft Support – Office for Mac (2)
https://discussions.apple.com/thread/4847068?tstart=0
Try a restart.
Put a copy of the file in the hard drive level Users/Shared folder.
Do a backup, using either Time Machine or a cloning program, to ensure files/data can be recovered. Two backups are better than one.
Try setting up another admin user account to see if the same problem continues. If Back-to-My Mac is selected in System Preferences, the Guest account will not work. The intent is to see if it is specific to one account or a system wide problem. This account can be deleted later.
Isolating an issue by using another user account
If the problem is still there, try booting into the Safe Mode using your normal account. Disconnect all peripherals except those needed for the test. Shut down the computer and then power it back up after waiting 10 seconds. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. When you reboot normally, the initial reboot may be slower than normal. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application un-installer. For each disable/delete, you will need to restart if you don't do them all at once.
Safe Mode
Safe Mode - About
Maybe you are looking for
-
Discrepancies in MRP Available Inventory between SC and BW
We're seeing a discrepancy in a BW report and the data shown in md05/md05. There's a difference in the MRP Available Inventory. What are other possible sources of this difference? We know Safety Stock, SafeReq and MatRes, but for this particular issu
-
How to insert a file in a table field
hi there i want to insert file into table field i am using plain JSP and oracle 9i is my backend what i would required to do the file may be of any format most probably PDF,WORD, or an Image which datatype is preferable for field regards sweety
-
This is an issue that I've had for a few months now, I don't know exactly when it started. Issue: I will be on computer, doing whatever, and the display will randomly go to sleep. Rest of computer seems to be running fine (ie - audio from browser or
-
Cost accrual billing extension
Hello Gurus, Iam trying to implement cost accrual billing extension for projects. For setting up this, we have to update a package pa_rev_ca. Should we also update pls files PAXICOSB.pls and PAXICOSS.pls at $PA_TOP/admin/sql. Any help is highly appre
-
BPM training and certification
Hi experts, I´m new to SAP BPM and I´d like to know if there´s any SAP official training courses, like BW360, TBW41, etc and certification program. Is there any SAP roadmap for BPM? Thanks in advance, TP