List Problem (I think) Disguised as a GraphicConverter Problem
List Problem (I think) Disguised as a GraphicConverter Problem
- Subject: List Problem (I think) Disguised as a GraphicConverter Problem
- From: "Jonathan Levi, M.D." <email@hidden>
- Date: Tue, 8 Mar 2005 20:10:23 -0500
Trying to enhance the limited scriptability of
GraphicConverter (GC), I've come upon something I
don't understand, seemingly about lists, less
likely about GC itself. The problem occurs in the
context of a handler I've written to bring a
given GC window to the front (requiring Finder;
GC seemingly can't do this by itself.)
I have two open GC windows, "a.pict (RGB)" and
"b.pict (RGB)", a list gcWindowNames consisting
of these two window names, and two ways to get
them sequentially, "repeat with i from 1 to
(count items of gcWindowNames)" and "repeat with
wname in items of gcWindowNames". The first way
works, the second doesn't. Is there a fundamental
property about iterating through a list's items
that I'm missing? --Many thanks, Jonathan
--------------------------------
the Script:
(*
gcActivateWindow.scpt -- drives a subroutine gcActivateWindow()
to make GraphicConverter activate a given window. JL 3/8/2005.
*)
on gcActivateWindow(wname)
tell application "GraphicConverter" to set f to file of window wname
tell application "Finder" to open f --needed to bring window to front
end gcActivateWindow
set gcWindowNames to {"a.pict (RGB)", "b.pict (RGB)"}
gcActivateWindow("a.pict (RGB)") --works
repeat with i from 1 to (count items of gcWindowNames) --works
gcActivateWindow(item i of gcWindowNames)
end repeat
repeat with wname in items of gcWindowNames --doesn't work
gcActivateWindow(wname)
end repeat
--------------------------------
the Event Log:
tell application "GraphicConverter"
get file of window "a.pict (RGB)"
file "HD:Users:jonathan:Desktop:a.pict"
end tell
tell application "Finder"
open file "HD:Users:jonathan:Desktop:a.pict"
end tell
tell application "GraphicConverter"
get file of window "b.pict (RGB)"
file "HD:Users:jonathan:Desktop:b.pict"
end tell
tell application "Finder"
open file "HD:Users:jonathan:Desktop:b.pict"
end tell
tell application "GraphicConverter"
get file of window "a.pict (RGB)"
"GraphicConverter got an error: Can't make some data into ¬
the expected type."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden