Send AppleScript-Users mailing list submissions to
email@hidden
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/applescript-users
or, via email, send a message with subject or body 'help' to
email@hidden
You can reach the person managing the list at
email@hidden
When replying, please edit your Subject line so it is more specific
than "Re: Contents of AppleScript-Users digest..."
Today's Topics:
1. Re: Scope/Context issue? (Skeeve)
2. Re: Evaluating Double Byte (Christopher Nebel)
3. Re: Evaluating Double Byte (has)
4. New sticky with content (Devraj Mukherjee)
5. Re: strings, again and again (Kurt Klamp)
6. Re: Setting the correct linefeed. (Christopher Nebel)
7. Re: Unsubscribe (John C. Welch)
8. Re: New sticky with content (Ed Stockly)
9. Re: Unsubscribe (John Baltutis)
10. Scripting PowerPoint save command (Yves Dussault)
11. RE: Evaluating Double Byte (Scott Babcock)
----------------------------------------------------------------------
Message: 1
Date: Tue, 05 Feb 2008 23:11:51 +0100
From: Skeeve <email@hidden>
Subject: Re: Scope/Context issue?
To: AppleScript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Kurt Klamp wrote:
try this
-- ScriptB.app
property a : 0
property pathtoA : "PathToScriptA"
on run
set a to load script file pathtoA
repeat 3 times
tell a to run
end repeat
store script a in file pathtoA
end run
-- -- -- -- -- -- -- --
Strange. It works. Must have made some stupid typo in my test. It
works
even if I don't make a and pathtoA properties but simple variables
as I
had them in my test.
Thanks for helping!
------------------------------
Message: 2
Date: Tue, 5 Feb 2008 14:30:20 -0800
From: Christopher Nebel <email@hidden>
Subject: Re: Evaluating Double Byte
To: Applescript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
On Feb 5, 2008, at 1:36 PM, email@hidden wrote:
Sure, I am using my main application to pull data to be inserted in
a Word Document.
thus pulling dynamic text in insert into preformed applescript code
i.e.
insert text "pulled text from db here" at text object of selection
This works fine until I come across any Japanese, Chinese, ect.
languages, which I can test if they are and then wrap them in code
such as:
insert text "pulled text " & «data utxt1575» as Unicode text & "from
db here" at text object of selection
however, when the NSApplescript event attempts to pass that to
applescript, it seems to not recognize the chevrons. It will
replace them with what looks like a different character.
not sure if this was what you were looking for (nor if I made a lot
of sense for that matter ;) ), but it seems I need to find a way to
pass the string to applescript without using the chevrons.
No, you just need to tell the truth about what encoding you're using.
If you ever see characters changing, it's a sign that there's a
disagreement between the encoding you're using and the one the system
is using. Leopard is much better about this sort of thing in many
respects. It properly handles non-ASCII characters in @"..." literals
(Tiger doesn't, and it'll warn you about them), and AppleScript itself
is Unicode-aware, so you don't have to muck around with chevrons --
you can just put the literal character in the source text.
Of course, if you're really just doing a one-line command, then you
should check out trying to send the Apple event directly and not using
AppleScript in the first place. You can roll the entire thing
yourself using NSAppleEventDescriptor, but most people find that kind
of painful, so have a look at appscript (third-party, requires Panther
or better) or Scripting Bridge (built into Leopard).
--Chris Nebel
AppleScript Engineering
------------------------------
Message: 3
Date: Tue, 5 Feb 2008 22:42:21 +0000
From: has <email@hidden>
Subject: Re: Evaluating Double Byte
To: Applescript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
On 5 Feb 2008, at 21:36, <email@hidden> <outinreno-
email@hidden
wrote:
Does anybody know of a means to evaluate a double byte character
without using the chevron notation i.e.:
«data utxt1603»
Depends what you mean by "double byte character". Hex string?
unichar?
Sounds like you're trying to do code generation of some sort, which
for most problems is the wrong solution anyway. More information
would
be helpful.
Sure, I am using my main application to pull data to be inserted in
a Word Document.
thus pulling dynamic text in insert into preformed applescript code
i.e.
insert text "pulled text from db here" at text object of selection
This works fine until I come across any Japanese, Chinese, ect.
languages, which I can test if they are and then wrap them in code
such as:
insert text "pulled text " & «data utxt1575» as Unicode text & "from
db here" at text object of selection
however, when the NSApplescript event attempts to pass that to
applescript, it seems to not recognize the chevrons. It will
replace them with what looks like a different character.
Sounds like a text encoding issue, though not sure why without seeing
code. At any rate, code generation isn't a good solution here, and the
best thing would be to redesign your program to avoid it in the first
place.
1. If you need to use AppleScript, pack the "pulled text ... here"
string and any other parameters your code needs to pass into an Apple
event and invoke -[NSAppleScript executeAppleEvent:error:]. There's a
sample project - CallAppleScriptHandler - in the objc-appscript
repository (see below) that shows how to do this, or Google around for
other examples.
2. If AppleScript isn't required - and really, the only time you need
to muck about with NSAppleScript is if your program needs to run user-
supplied scripts - then the simplest thing would be to send all your
Word commands directly from ObjC. There are two high-level ObjC-Apple
event bridges available:
- Leopard's Scripting Bridge; the API's obfuscated and klunky, it's
prone to incompatibility problems with various applications, and I
personally wouldn't recommend it, but I mention it anyway for
completeness (and to put the boot in at the same time, natch). See
Apple's developer docs for details.
- objc-appscript; it's still officially alpha-ware, but already quite
usable (it's based on the very mature, capable Python appscript) and
should work on anything from Panther onwards:
http://appscript.sourceforge.net/objc-appscript.html
Any questions, just ask.
HTH
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
------------------------------
Message: 4
Date: Wed, 6 Feb 2008 09:49:06 +1100
From: "Devraj Mukherjee" <email@hidden>
Subject: New sticky with content
To: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=ISO-8859-1
Hi everyone,
I am trying to write an AppleScript that starts up a new sticky and
writes some new content into it. My script can start Stickies and
paste contents from the clipboard but what I really want to do is to
write the contents from a string (this string will finally be
generated out of my Cocoa app).
Can someone please give me an idea if I can do something like set
value of text area to "String"
Thanks a lot. At the moment my script looks like.
tell application "System Events"
tell application "Stickies" to activate
tell process "Stickies" to keystroke "n" using command down
tell process "Stickies" to keystroke "v" using command down
end tell
PS Please be gentle I am an AppleScript newbie.
--
"I never look back darling, it distracts from the now", Edna Mode (The
Incredibles)
------------------------------
Message: 5
Date: Wed, 6 Feb 2008 01:55:19 +0100
From: Kurt Klamp <email@hidden>
Subject: Re: strings, again and again
To: Applescript Users <email@hidden>
Cc: Justin Laden <email@hidden>, Kurt Klamp
<email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Am 05.02.2008 um 22:43 schrieb Justin Laden:
Gary, Kurt,
Thanks for all the help--but, shocker!--it works.
Congratulations !!
But allow me a last hint:
This is IMHO the more shorter and maybe faster solution.
It avoids an unnecessary access to the list:
repeat with i from 1 to (z)
try
set end of to jobNumRange to {(find text "^[a-zA-Z][0-9]{4}" in
item i of descriptionRange with regexp)}
on error
set end of jobNumRange to {""}
end try
end repeat
set value of range ("A1:A" & z) to jobNumRange
-- Kurt
------------------------------
Message: 6
Date: Tue, 5 Feb 2008 17:28:26 -0800
From: Christopher Nebel <email@hidden>
Subject: Re: Setting the correct linefeed.
To: Applescript Users <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
On Feb 5, 2008, at 1:49 PM, Shane Stanley wrote:
On 5/2/08 3:18 PM, "Christopher Nebel" <email@hidden> wrote:
use the "linefeed" constant (technically, it's a property of the
AppleScript
object, but never mind that) instead of "return". I think it was
added in
Tiger
Looks like it popped up unannounced in Leopard. Not that I'm
complaining...
I'll be darned, I missed that one in the release notes. Shane is
correct, the predefined "linefeed" property is in Leopard.
--Chris Nebel
AppleScript Engineering
------------------------------
Message: 7
Date: Tue, 05 Feb 2008 20:00:16 -0600
From: "John C. Welch" <email@hidden>
Subject: Re: Unsubscribe
To: AppleScript List <email@hidden>
Message-ID: <C3CE70D0.86502%email@hidden>
Content-Type: text/plain; charset="US-ASCII"
On 02/05/2008 15:50 PM, "Reyes, Augustine"
<email@hidden> wrote:
Please unsubscribe me!!
Read the Fine Instructions at the Bottom of the post
--
"It's like a koala crapped a rainbow in my brain!"
Captain Murphy, Sealab 2021
------------------------------
Message: 8
Date: Tue, 5 Feb 2008 18:39:51 -0800
From: Ed Stockly <email@hidden>
Subject: Re: New sticky with content
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
I am trying to write an AppleScript that starts up a new sticky and
writes some new content into it.
At the moment my script looks like...
You are so close!
Try this:
-----------
set myValue to "Hello world"
tell application "System Events"
tell application "Stickies" to activate
tell process "Stickies" to keystroke "n" using command down
tell process "Stickies" to keystroke myValue
end tell
-----------
PS Please be gentle I am an AppleScript newbie.
Well you've come to the right place.
You're starting off by scripting an unscriptable application
("Stickies") which is not appleScript at its best.
If you really want to learn applescript try working with some
scriptable applications.
And this list is a good place to go for guidance.
HTH
ES
------------------------------
Message: 9
Date: Tue, 5 Feb 2008 19:14:29 -0800
From: John Baltutis <email@hidden>
Subject: Re: Unsubscribe
To: email@hidden
Message-ID: <f05210607c3ced6307c93@[192.168.0.109]>
Content-Type: text/plain; charset="us-ascii"
On 02/05/08, "Reyes, Augustine"
<email@hidden> wrote:
Please unsubscribe me!!
Thanks
<Augustine>
What part of this don't you understand?
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.apple.com/mailman/listinfo/applescript-users
or, via email, send a message with subject or body 'help' to
email@hidden
BTW, submitting an entire digest is poor form.
------------------------------
Message: 10
Date: Tue, 5 Feb 2008 23:18:23 -0500
From: Yves Dussault <email@hidden>
Subject: Scripting PowerPoint save command
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
I need to include the PPT (2004) save command in a script but I can't
find the exact syntax of the command anywhere. The PPT dictionnary
provides the following:
save v : Save an object
save specifier : the object to save
[in Macintosh path/Posix path] : the file in which to save the object
[as save as presentation/save as template/save as RTF/save as show/
save as addIn/save as default/save as HTML] : the file type of the
document in which to save the data
but I don't understand enough how to use it. I know how to get the
file name and path but don't know how to apply the information to the
command.
I have found references to the some documentation on the MS site but
they seem to have redesigned the site for Office 2008 which breaks all
the links.
Would anybody have the complete syntax of the command with some
examples of use. I just want to save a file to a particular directory.
TIA. Yves.
------------------------------
Message: 11
Date: Wed, 6 Feb 2008 11:14:15 -0800
From: Scott Babcock <email@hidden>
Subject: RE: Evaluating Double Byte
To: "email@hidden"
<email@hidden>
Message-ID:
<745125AE0FBA18468AEDC36960AA97FC35B3631734@NA-EXMSG-
C103.redmond.corp.microsoft.com>
Content-Type: text/plain; charset="us-ascii"
I have a few questions that may help to clarify your situation:
Where is the data for your strings coming from? How are you
converting the extended characters to the raw Unicode ("data utxt")
format? How are you determining that the fault lies in
NSAppleScript? Do you get an error, or do you just get the wrong
result?
I have scripts that I have to run clear back on Jaguar. There's a
bug in Jaguar AppleScript that causes it to crash when I refer to
raw Unicode text data, so I always use 'do shell script' and Perl
to define my Unicode strings. Here's that it looks like:
set NunavikHi to do shell script "perl -e 'use utf8; print chr
(0x1575);'"
set theText to ("pulled text " as Unicode text) & NunavikHi & "
from db"
insert text theText at text object of selection
Note the Unicode text coercion of the first component of the
string. If you're running at least AppleScript 1.10 (shipped with
Mac OS 10.4), this isn't strictly necessary. If you're running on a
prior version of AppleScript, this is critical. The reason is that
the data type of the result of string concatenation would be the
data type of the initial concatenated element. Each succeeding
element would be automatically coerced to this type. If the initial
data type was [string], errors or silent data loss could occur when
[Unicode text] elements were downcast to [string].
-----Original Message-----
Date: Tue, 5 Feb 2008 16:47:52 -0500
From: "Mark J. Reed" <email@hidden>
Subject: Re: Evaluating Double Byte
To: email@hidden, has <email@hidden>,
"Applescript Users" <email@hidden>
Message-ID:
<email@hidden>
Content-Type: text/plain; charset=UTF-8
Why are you generating AppleScript source code? Just write the script
separately, design it to take the text to insert as a parameter, and
run it from your app. There's rarely a good reason to spit out new
code dynamically like this...
On 2/5/08, email@hidden <email@hidden> wrote:
has <email@hidden> wrote: On 5 Feb 2008, at 20:42, wrote:
Does anybody know of a means to evaluate a double byte character
without using the chevron notation i.e.:
??data utxt1603??
Depends what you mean by "double byte character". Hex string?
unichar?
Sounds like you're trying to do code generation of some sort, which
for most problems is the wrong solution anyway. More information
would
be helpful.
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
Sure, I am using my main application to pull data to be inserted
in a Word
Document.
thus pulling dynamic text in insert into preformed applescript
code i.e.
insert text "pulled text from db here" at text object of selection
This works fine until I come across any Japanese, Chinese, ect.
languages,
which I can test if they are and then wrap them in code such as:
insert text "pulled text " & ??data utxt1575?? as Unicode text &
"from db
here" at text object of selection
however, when the NSApplescript event attempts to pass that to
applescript,
it seems to not recognize the chevrons. It will replace them with
what
looks like a different character.
not sure if this was what you were looking for (nor if I made a
lot of sense
for that matter ;) ), but it seems I need to find a way to pass
the string
to applescript without using the chevrons.
Thanks for looking at it!
Brian
Works fine and dandy with low ASCII, or pre 2004 word, but wh
--
Mark J. Reed <email@hidden>
------------------------------
_______________________________________________
AppleScript-Users mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/applescript-users
End of AppleScript-Users Digest, Vol 5, Issue 87
************************************************