Apple Script for indesign
Hai all,
i am trying to insert footnote and its contents for a particular xml element in "Adobe Indesign cs2" thru apple script. But i'm facing some problem. I'm able to select the xml element and its contents and i can insert footnote for that element and i can cut that contents but i couldn't paste this contents in footnote. I have tried with the following code:
tell application "Adobe InDesign CS2"
tell active document
set theRoot to (item 1 of XML elements)
end tell
end tell
myLoopLoop(theRoot)
property myLoLoV : {}
property myHoHoV : {}
on myLoopLoop(myElement)
tell application "Adobe InDesign CS2"
tell active document
set moreElement to every XML element of myElement
repeat with x from 1 to (count of moreElement)
set em1 to item x of moreElement
select em1
if (name of markup tag of em1 is "informalexample") then
set em2 to em1
select text of em2
tell insertion point 1 of em1
set myfootnote to make footnote
end tell
tell application "Adobe InDesign CS2"
set myselection to selection
cut (selection of active document)
end tell
tell application "Adobe InDesign CS2"
tell insertion point 1 of myfootnote
paste into myfootnote
set text of em2 to myfootnote
end tell
end tell
end if
tell me to myLoopLoop(item x of moreElement)
end repeat
end tell
end tell
end myLoopLoop
Can anyone help me out to sort this problem?
Thanks
anbu
I Mac Mac OS X (10.4.8) Intel based Mac
hi all
any help
thanks
anbu
Similar Messages
-
Apple script for Message box when Mail app Compose Window Opens
Hi there
I'm trying to make mail app remind me to choose the right emaill address to send from since I have several email addresses. Is there a way I can make or write an apple script for a message box to pop up whenever mail app's compose window opens up.
I can do for the case when I actally click the compose button when I'm on mail app by using UI scripting. But when it comes to hyperlinks which opens up the compose window, it fails.
I just want a script to see whether the compose window is open and if open pop up a message box.
Thanks
Best regards
Zam Shabeer ThahirTaoChitpol wrote:
By the way, the problem happens with the account of MS Exchange service, I don't know if this is the cause of the problem.
I think yes. The encoding is being corrupted somewhere, probably Exchange. There is nothing you can change on the iPad other than the OS languagel, to see if that helps. You can also tell Apple at
http://www.apple.com/feedback/ -
Apple Script for deleting podcasts
I subscribe to a lot of podcasts, but I don't want to keep them in my iTunes library after I'm done listening to them. Is there an Apple Script for automatically deleting podcasts? Thanks.
Thanks - once I'm in Automator and select Music, I don't see any options for finding Podcasts. Any suggestions which item/step I should select next in Automator? Thanks.
-
Apple Script For Opening External EML File With Apple Mail
Hi folks,
I am working with Apple Script for implementing numerous function related to Mail App.
I am using the following Apple Script lines for opening the mails which are in Mail app for each modes.
View Mode : open theMsg
Reply View Mode : reply theMsg opening window yes
Reply All Mode : reply theMsg opening window yes reply to all yes
Forward Mode : forward theMsg opening window yes
I want to know how we can open external eml file in different view modes (View, Reply, Reply All and Forward) using Apple Script or Apple Event programmatically with a similar mechanism available through script in Mail App.
Thanks in advance. Regards
NisarI'm not sure what you're doing here, but this isn't anything I recognize as compilable applescript. what is this 'mode' thing you're talking about.
at any rate, if you have a loose emlx file sitting around somewhere you can simply open it in mail (use the 'open' command and the file specification for the emlx file) and work with it appropriately. if you're talking about an actual eml file (e.g. from Outlook Express) you'd have to GUI script Mail's 'import mailbox' command (the applescript handler for importing mail only works with Mail.app mailboxes) -
How Can I write Script for Indesign set left indent
I really need two scripts for indesign set left indent:
1. If the left indent is: 8, 16, 24, 32, 40, 48, 56mm... set the first -8mm; if the left indent is 0, set the left indent 8mm, first -8mm.
2. Whatever the first indent is, set the first 8mm.
Can someone help me?Hi, Trevor
I use change by list as below:
grep {leftIndent:48mm} {leftIndent:56mm}
grep {leftIndent:40mm} {leftIndent:48mm}
grep {leftIndent:32mm} {leftIndent:40mm}
grep {leftIndent:24mm} {leftIndent:32mm}
grep {leftIndent:16mm} {leftIndent:24mm}
grep {leftIndent:8mm} {leftIndent:16mm}
grep {firstLineIndent:8mm, leftIndent:48mm} {firstLineIndent:8mm, leftIndent:56mm}
grep {firstLineIndent:8mm, leftIndent:32mm} {firstLineIndent:8mm, leftIndent:48mm}
grep {firstLineIndent:8mm, leftIndent:24mm} {firstLineIndent:8mm, leftIndent:32mm}
grep {firstLineIndent:8mm, leftIndent:16mm} {firstLineIndent:8mm, leftIndent:24mm}
grep {firstLineIndent:8mm, leftIndent:8mm} {firstLineIndent:8mm, leftIndent:16mm}
grep {firstLineIndent:-8mm, leftIndent:48mm} {firstLineIndent:-8mm, leftIndent:56mm}
grep {firstLineIndent:-8mm, leftIndent:32mm} {firstLineIndent:-8mm, leftIndent:48mm}
grep {firstLineIndent:-8mm, leftIndent:24mm} {firstLineIndent:-8mm, leftIndent:32mm}
grep {firstLineIndent:-8mm, leftIndent:16mm} {firstLineIndent:-8mm, leftIndent:24mm}
grep {firstLineIndent:-8mm, leftIndent:8mm} {firstLineIndent:-8mm, leftIndent:16mm}
but not that perfect,
I want to useing jave "if{}" or "for{}" to write this script, but I don't kown the syntext. -
Script for InDesign CS6 - create multiple, prenamed layers
I created a script for Illustrator CS6, in ExtendScript Toolkit, that will create multiple, prenamed layers...see below...
//Apply to myDoc the active document
var layerName = LayerOrderType;
var myDoc = app.activeDocument;
//define first character and how many layers do you need
var layerName
var numberOfLayers=0;
//Create the layers
for(var i=0; i<=numberOfLayers; i++)
{ var layerName = ":: GRADIENT"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: STRIPES"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: LEGAL"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: BLK BAR"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: FLAME"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: LOGO/TYPE"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: TRIM,ETC"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: LOEC INFO"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
// Moves the bottom layer to become the topmost layer
if (documents.length > 0) {
countOfLayers = activeDocument.layers.length;
if (countOfLayers > 1) {
bottomLayer = activeDocument.layers[countOfLayers-1];
bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
else {
alert("The active document only has only 1 layer")
I tried to use this exact code to replicate the same scenario in InDesign but it doesn't work.
Can anybody help me out!?
Thanks in advanceMarijan Tompa's scripts are very nice and useful, however, for this simple task you can try create your own wiht this code:
app.activeDocument.layers.add ({name: "GRADIENT", layerColor: UIColors.red});
app.activeDocument.layers.add ({name: "STRIPES", layerColor: UIColors.lightBlue});
app.activeDocument.layers.add ({name: "LEGAL", layerColor: UIColors.gray});
//merge existing document layer to bottom layer (in this case original layer will be merged to 'GRADIENT')
var myDocument = app.documents.item(0);
var myLayerA = myDocument.layers.item(2);
var myLayerB = myDocument.layers.item(3);
myLayerA.merge(myLayerB);
alert("Layers created!");
assume, your document has one layer.
Script creates three new layers, they appear in Scripts palette in this order:
LEGAL
STRIPES
GRADIENT
and merges 'old' layer to bottom layer of newly created set (GRADIENT).
sure, you can add as much layers as you need, just don't forget modify LayerA and LayerB numbers accordingly.
Or disable second part of the script at all, if you don't want anything to be merged. -
Is there an updatedcrossrefs script for InDesign CS6
Running Mac Pro/2.66 GHz—Quad-Core Intel Xeon/Snow Leopard/
OS/Mac OS X Version 10.6.2/2.66 GHz
I converted a CS3 InDesign that uses the script "updatedcrossrefs.js", to CS6 InDesign. This file uses hyperlinks on the TOC and Index.
I tried using the same script for CS3 InDesign in CS6 InDesign but it does not work.
This is the error message "Could not catch page. Check destination names and existence."
Is there an updated script for CS6?Sorry did not know I was using bold. My co-worker found this script however, she does not work here anymore. But here is the script. I know nothing about scripts except how to use them. Sorry.
// Updatecrossrefs.js
// Updates cross references made with hyperlinks
// the hyperlink destination is where the reference refers to
// the hyperlink sourcetext is the text that will be updated (like see xx)
// If a book is open, the book will be handled,
// if no book is open, the active document will be handled.
// Made by Teus de Jong, last version April 10, 2006
// Revisions by Dave Saunders January 22, 2006 and March 20, 2006
// Thanks Dave!
// Added unique naming mechanism for sources -- October, 2008
if (app.books.length == 0){
if (app.documents.length == 0){
errorExit('No documents are open');
} else {
nrofdocs = 1;
doc = app.activeDocument;
} else {
nrofdocs = app.books[0].bookContents.length;
for (i = nrofdocs - 1; i > -1; i--) {
if (app.books[0].bookContents[i].status != BookContentStatus.documentIsOpen)
app.open(File(app.books[0].bookContents[i].fullName));
doc = app.open(app.books[0].bookContents[0].fullName);
for (d = 1; d <= nrofdocs; d++){
for (i = 0; i < doc.hyperlinks.length; i++){
hyper = doc.hyperlinks[i];
// leave ID's own internal markers alone
if (hyper.name.substring(0, 1) == '.'){continue}
// leave hyperlinks to URLs alone
try {
if (hyper.destination.constructor.name == 'HyperlinkURLDestination'){continue}
} catch (e) {
hyper.showSource();
errorExit('Selected hyperlink has undefined destination');
s = hyper.source.name;
// added October, 2008
// sometimes ID's unique name mechanism for sources fails; make sure the source has
// the same name as the hyperlink + '_src'
if (s != hyper.name + '_src')
hyper.source.name = hyper.name + '_src';
if (hyper.destination.constructor.name == 'HyperlinkTextDestination'){
s = getParentPageName(hyper.destination.destinationText);
} else {
// try/catch added to allow for hyperlinks that have lost their destination -- Dave
try {
s = hyper.destination.destinationPage.name;
} catch (e) { continue }
if (s != ''){
// Check to see if update needed; saves a lot of time when processing large books -- Dave
if (hyper.source.sourceText.contents != s) {
hyper.source.sourceText.contents = s;
if (d >= nrofdocs){
break;
doc = app.open(app.books[0].bookContents[d].fullName);
function getParentPageName(txt){
try {
var myFrame = getParentTextFrame(txt);
var pag = myFrame.parent;
while (pag.constructor.name != 'Page'){
// in case the reference is in an inline, the parent of the frame is a character
if (pag.constructor.name == 'Character'){
pag = getParentTextFrame(pag);
// in case the chain goes sour, back out
if (pag.constructor.name == 'Application'){
throw 'Error';
pag = pag.parent;
return(pag.name);
catch (e) {
alert('Could not catch page.\nCheck destination names and existence.');
return('');
function getParentTextFrame(x){
if(app.version == 3){
return(x.parentTextFrame);
else {
return(x.parentTextFrames[0]);
function errorExit(s){
alert(s);
exit(); -
Hi all!!
I've never truly experimented with the scripting process for indesign but have seen some interesting posts on here that allow for multistates within multistates
Has anyone written one that would go through a folio and update each layout systematically - it's a bit of a ball ache updating one stack at a time and I can't script!!
If anyone knows where to start with writing one/or has written one
Could you please lend me your ever sought after expertise
Thanks SO much
TimAh brilliant, I'll do that Bob, thanks for the suggestion!
I've just found a brilliant tutorial that's actually from adobe that I might try and make a bit of headway with - but I'll check with the guys that know what they're doing
Cheers!
Tim -
In FCP you can scrub though a video in the viewer by 1 second intervals by holding shift + arrow key (left=back, right=forward). I really like this shortcut.
Anyone have any script for QT to make it do the same thing?
Apple should add it on the next version. It will be super helpful and better integrated with FCP.
BlakeYes, but in FCP when you hit shift+arrow every time you hit the arrow it scrubs either 1 second forward or 1 backward. This is very helpful if I know I want a clip to start at and exact point and go for exactly 5 (6,9,25) seconds. I have to do this a lot in my work. In QuickTime it just moves you frame by frame, which is perfect for certain situations but I would really like to be able to do what I can do in FCP also.
Blake -
Apple Scripting for Microsfot Power Point 2011
Hi,
I am having problem with following apple script. This is working fine with Office 2004 but when i am using office 2011 then on action is changing to «class BCOa». Can any one please help me in this. I will be very thankful
tell application "Microsoft PowerPoint"
set btnAbout to make new command bar control at command bar ¬
"CPS" with properties {control type:control button, button style:button caption}
-- Set button style in "with properties" block
set width of btnAbout to 60
set name of btnAbout to "About"
set *on action* of btnAbout to "cpsHandleAbout"
set tooltip text of btnAbout to "About CPS for PowerPoint"
end tellHm, not sure if this helps, but perhaps... first create this command button by hand...
then run
tell application "Microsoft PowerPoint"
get properties of command bar control "About" of command bar "CPS"
end tell
this returns the properties of this button...
something like:
{class:command bar button, begin group:false, built in:true, name:"About", description text:"", enabled:true, height:22, help context ID: 0, help file:"", id:2520, entry_index:1, left position:674, parameter:"", priority:3, tag:"", tooltip text:"&About", top:324, control type:control button, visible:true, width:28, button face is default:false, face id:23, button state:button state up, button style:button automatic}
If the button uses a build in command you will get to know the id of this command...
e.g. the ID is 23 (open file)
make new command bar control at command bar ¬
"CPS" with properties {id:23}
and this would create such a new button...
But I am not sure who to get a list of all action ids... -
Can anyone make an Apple Script for me?
I'm looking for an Apple Script so that when I press cmd+F1 on my Macbook Pro Retina it turns the brightness to 0 instantly. Rather than having to hold F1 down to make the brightness go down to 0.
Is this something that is even possible?
Thank YouThere is evidently no direct way to do this, but there is an indirect way:
Download an app called SleepDisplay: Download SleepDisplay for Mac - Put your display to sleep instantly. MacUpdate.com
put SleepDisplay in your Applications folder
open Automator.
Select service for type of document
at the top, for service receives, select no input, and after in, any application
in the column on the left, select Utilities
in the next column, drag Launch Application over to the right, and select SleepDisplay for the app
close the window with the red circle in the left upper corner, and give the service a name, like Dark.
go to system preferences > keyboard > shortcuts
select services in the box on the left, and scroll down in the box on the right until you find the service you just created. select that service.
when you select it, a white oval should appear that says "add shortcut". Type in the shortcut you want to use. I couldn't get ⌘F1 to work, but control-option-⌘-D did work. It must be a unique shortcut, not already in use. -
Apple script for 10.4 - works in OSX but not older
Hi I have a script which I'm using on my current system 10.9 it runs in excel and it goes something like this:
tell application "Microsoft Excel"
-- put the complete set of data into a list of lists (i.e., 2 dimensions -> columns of rows)
tell active sheet to set myData to value of used range
-- recipient email
set myRow1 to 1
set myCol1 to 1
set Address to item {myCol1} of item {myRow1} of myData
-- recipient name
set myCol4 to 4
set rName to item {myCol4} of item {myRow1} of myData
The above is just a small snippet from the script. However I try running this on apple 10.4 apple script and it does not work. I'm trying to save my computer time from have to this minimal task on an older mac I have but I'm experiencing some problems. Does the active sheet not work in apple mac 10.4? What am I missing? Any help would be greatly appreciated.Hi Ohms238,
I found this Apple developer page that talks about changes made in each version of OSX. It will require some work, but you can go through and see what changes are relevant to your script.
But I would actually recommend running pieces of your code separately to see exactly what parts don't work and then rewrite just those portions. -
Hello there. How do I create an apple script that switches between the default printers? I am using 9.2.2. I am not familar with apple scripts in OS9. Thanks
Try starting with the script posted on this page.
(15380) -
Can anybody fix this apple script for me so all the responses work
iv been working on a jarvis wake up script and iv continued to add on commands to if theResponce parts of the script but now most of them wont work and i get a syntax if i dont have like 8 end if's at the end of the script could somebody please overview it, fix the script and resubmit it to me in the comments. will be so grateful if somebody fixes this pleasee.!!!!
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
say "It is " & getTimeInHoursAndMinutes() using "Tom"
on getTimeInHoursAndMinutes()
set timeStr to time string of (current date)
set Pos to offset of ":" in timeStr
set theHour to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
-- Get the "minute"
set Pos to offset of ":" in timeStr
set theMin to characters 1 thru (Pos - 1) of timeStr as string
set timeStr to characters (Pos + 1) through end of timeStr as string
--Get "AM or PM"
set Pos to offset of " " in timeStr
set theSfx to characters (Pos + 1) through end of timeStr as string
return (theHour & ":" & theMin & " " & theSfx) as string
end getTimeInHoursAndMinutes
set CityCode to 1098081
set t_format to "C"
set v_format to "S"
set a_format to "Y"
set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
set file_content to (do shell script "curl " & IURL)
--looking for the line with actual condition
set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
if t_format is equal to "C" then
set actual_temp to (5 / 9) * (actual_temp - 32) as integer
end if
set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set today_min_temp to word 9 of sub_2
set today_max_temp to word 12 of sub_2
if t_format is equal to "C" then
set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
end if
set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
set today_forecast to text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
set sub_5 to text ((offset of "yweather:forecast" in sub_4) + 1) thru -1 of sub_4
set sub_6 to text ((offset of "\"" in sub_5) + 1) thru -1 of sub_5
set tomorrow_min_temp to word 9 of sub_6
set tomorrow_max_temp to word 12 of sub_6
if t_format is equal to "C" then
set tomorrow_min_temp to (5 / 9) * (tomorrow_min_temp - 32) as integer
set tomorrow_max_temp to (5 / 9) * (tomorrow_max_temp - 32) as integer
end if
set sub_7 to text ((offset of "text" in sub_6) + 1) thru -1 of sub_6
set sub_8 to text ((offset of "\"" in sub_7) + 1) thru -1 of sub_7
set tomorrow_forecast to text 1 thru ((offset of "\"" in sub_8) - 1) of sub_8
if a_format is equal to "Y" then
say "The current conditions in Perth are " & actual_condition & " ,and the current temperture is " & actual_temp & " degrees"
end if
if v_format is equal to "L" then
say "Today it will be : " & today_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees " using "Tom"
else
say "Today it will be : " & today_forecast & ", between " & today_min_temp & " , and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ", between " & tomorrow_min_temp & " ,and " & tomorrow_max_temp & " degrees " using "Tom"
say "will that be all sir?"
tell application "SpeechRecognitionServer" to set theResponse to listen for {"get my mail ", "yes", "notes", "repeat", "Music", "Sleep in"}
if theResponse is "Sleep in" then
delay 6
say "Time to get up sir,or you will be late"
tell application "SpeechRecognitionServer" to set theResponse2 to listen for {"Ok pat im getting up"}
if theResponse2 is "Ok pat im getting up" then
set volume 35
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 40 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
if theResponse is "Music" then
set volume 20
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 60 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
if theResponse is "yes" then
delay 1
set theOptions to {"very good, sir, have a nice day"}
set theChoice to some item of theOptions
say theChoice displaying theChoice with waiting until completion
end if
if theResponse is "get my mail " then
tell application "Mail" to launch
end if
if theResponse is "notes" then
tell application "Stickies" to launch
end if
if theResponse is "repeat" then
set CityCode to 1098081
set t_format to "C"
set v_format to "S"
set a_format to "Y"
set IURL to "http://weather.yahooapis.com/forecastrss?w=" & CityCode
set file_content to (do shell script "curl " & IURL)
--looking for the line with actual condition
set theText to text ((offset of "yweather:condition" in file_content) + 1) thru -1 of file_content
set sub_1 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set actual_condition to text 1 thru ((offset of "\"" in sub_1) - 1) of sub_1
set sub_1a to text ((offset of "temp=" in sub_1)) thru -1 of sub_1
set sub_1b to text ((offset of "\"" in sub_1a) + 1) thru -1 of sub_1a
set actual_temp to text 1 thru ((offset of "\"" in sub_1b) - 1) of sub_1b
if t_format is equal to "C" then
set actual_temp to (5 / 9) * (actual_temp - 32) as integer
end if
set theText to text ((offset of "yweather:forecast" in file_content) + 1) thru -1 of file_content
set sub_2 to text ((offset of "\"" in theText) + 1) thru -1 of theText
set today_min_temp to word 9 of sub_2
set today_max_temp to word 12 of sub_2
if t_format is equal to "C" then
set today_min_temp to (5 / 9) * (today_min_temp - 32) as integer
set today_max_temp to (5 / 9) * (today_max_temp - 32) as integer
end if
set sub_3 to text ((offset of "text" in sub_2) + 1) thru -1 of sub_2
set sub_4 to text ((offset of "\"" in sub_3) + 1) thru -1 of sub_3
set today_forecast to text 1 thru ((offset of "\"" in sub_4) - 1) of sub_4
set sub_5 to text ((offset of "yweather:forecast" in sub_4) + 1) thru -1 of sub_4
set sub_6 to text ((offset of "\"" in sub_5) + 1) thru -1 of sub_5
set tomorrow_min_temp to word 9 of sub_6
set tomorrow_max_temp to word 12 of sub_6
if t_format is equal to "C" then
set tomorrow_min_temp to (5 / 9) * (tomorrow_min_temp - 32) as integer
set tomorrow_max_temp to (5 / 9) * (tomorrow_max_temp - 32) as integer
end if
set sub_7 to text ((offset of "text" in sub_6) + 1) thru -1 of sub_6
set sub_8 to text ((offset of "\"" in sub_7) + 1) thru -1 of sub_7
set tomorrow_forecast to text 1 thru ((offset of "\"" in sub_8) - 1) of sub_8
if a_format is equal to "Y" then
say "The current conditions in Perth are " & actual_condition & " ,and the current temperture is " & actual_temp & " degrees"
end if
if v_format is equal to "L" then
say "Today it will be : " & today_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees .
Tomorrow we are expecting it to be: " & tomorrow_forecast & ". Temperature: between " & today_min_temp & " and " & today_max_temp & " degrees " using "Tom"
else
say "will that be all sir?"
tell application "SpeechRecognitionServer" to set theResponse3 to listen for {"get my mail ", "yes", "notes", "Music"}
if theResponse3 is "Music" then
set volume 20
tell application "iTunes"
set the sound volume to 0
play user playlist "Wake up"
repeat 10 times
if sound volume is less than 60 then
set sound volume to (sound volume + 10)
delay 2
end if
end repeat
end tell
else
if theResponse3 is "get my mail " then
tell application "Mail" to launch
end if
if theResponse3 is "yes" then
delay 1
set theOptions to {"very good, sir, have a nice day"}
set theChoice to some item of theOptionsWhat you do in this situation, is split the file into parts.
Start with:
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
Add in a few lines of code to this file and see what happens.
add the on run, this would be clearer. It is the default on unit to run.
on run
set theHours to hours of the (current date)
if theHours > 18 then
say "good evening sir"
else if theHours > 12 then
say "good afternoon sir"
else if theHours > 6 then
say "good Morning sir"
else if theHours > 0 then
say "get out of bed sir!"
end if
end run
Now, it is time for debugging.
It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on. Here is an example.
Author: rccharles
For testing, run in the Script Editor.
1) Click on the Event Log tab to see the output from the log statement
2) Click on Run
on run
-- Write a message into the event log.
log " --- Starting on " & ((current date) as string) & " --- "
-- debug lines
set desktopPath to (path to desktop) as string
log "desktopPath = " & desktopPath
end run -
Apple script for print que???
I was wondering if anyone knew of an Applescript or third-party software for the print que in OS 10.4 that will allow me to see what application the completed files were printed from.
Thank,
John
733mhz Quicksilver upgraded to 1ghz processor, 40gig Maxtor HD Mac OS X (10.3.8)You may be able to adopt this script:
on open dropped_items
-- Write a message into the event log.
log " --- Starting on " & ((current date) as string) & " --- "
-- set see to alias "Macintosh-HD:Users:mac:Desktop:app.html"
-- set dropped_items to {see}
set the_app to "Safari"
repeat with dropped_item_ref in dropped_items
--set UrlBase to "xzzx FILE://" & POSIX path of dropped_item_ref
--display dialog UrlBase
-- Activate
activate application the_app
-- Open the URL
tell application the_app
open dropped_item_ref
-- print dropped_item_ref
tell application "System Events"
tell process the_app
delay 3
-- click menu item "Print..." of menu "File" of menu bar 1
keystroke "p" using command down
delay 1
keystroke return
delay 10
keystroke "w" using command down
end tell
end tell
--quit
end tell
end repeat
end open
Maybe you are looking for
-
Problem with VPN client on Cisco 1801
Hi, I have configured a new router for a customer. All works fine but i have a strange issue with the VPN client. When i start the VPN the client don't close the connection, ask for password, start to negotiate security policy the show the not connec
-
Why don't additional downloaded lens profiles show up in LR5?
Hi everyone! My name is Kai and this is my first post here. Normaly I find an answer to all my questions by reading already existing discussions. But this time I wasn't lucky... Hopefully this is not a stupid question. I downloaded lens profiles for
-
SIGN UPLOAD DEPENDING ON PURCHASING GROUP
i need to up load sign based on the purchasing group in to a window so i am passing the purchasing group in a table which has per group and name and getting the name of bitmap file in variable V_name in sub routine and then i am creating a constant w
-
Why should I use Web Services?
I am managing an Internet project for my company. We exhaustively use IIS, ASP and SQL 2000 Server and until today we feel very comfortable with those tools. We successfully developed some COMs also to make additional work. As a personal interest in
-
Hi, I am working on an OFTP (Odette File Transfer Protocol) communication application. Is there an API I can use? Thanks.