Re: Repeat until ...the user chooses to stop?
Re: Repeat until ...the user chooses to stop?
- Subject: Re: Repeat until ...the user chooses to stop?
- From: Dane Springmeyer <email@hidden>
- Date: Tue, 27 Nov 2007 09:15:05 -0800
Ron,
Thanks for the idea. Having the display timeout or give up works to a
certain degree. If I set it to give up after "1" then the script is
able to capture coordinates from google earth about every second.
However, with the potentially fast movement of the position that is
being recorded in google earth, it would be ideal to avoid this
delay. Deivy let me know that applescript does not support sub-second
timeouts, so it seems that this approach won't quite work.
Any other ideas? Maybe I need to set up two applescripts within an
app bundle: One that records coordinates in the repeat loop and the
other that starts and stops the first script. Does anyone have
examples of this?
Thanks,
Dane
On Nov 26, 2007, at 6:05 PM, Ron wrote:
How about this...
set thePath to {}
tell application "Google Earth"
repeat
set theViewInfo to (GetViewInfo) as list
set the end of thePath to (item 2 of theViewInfo) & "," & (item 1
of theViewInfo) & "," & (item 3 of theViewInfo) & "
" as string
tell application "System Events"
set response to button returned of (display dialog "Press Go to
log a GE Coordinate" buttons {"Go", "Stop"} default button "Go"
giving up after 2)
--set theTime to do shell script "date +'%m-%d-%YT%I:%M:%S'"
end tell
if response = "Stop" then exit repeat
end repeat
end tell
List:
I'm interested in approaches to this problem:
I have a repeat loop crafted to capture the geographic coordinates
being viewed within Google Earth and a dialog that prompts whether
to continue the repeat loop and, therefore, to continue logging
coordinates.
The problem is that currently the user is required to continually
click the dialog to continue.
I'd like to find a way to have the repeat loop continue until the
user clicks "Stop", but while keeping the display dialog prompt as
a top floating window.
Any simple ideas of how to achieve this in one applescript?
Code:
----
set response to "Go"
set thePath to {}
tell application "Google Earth"
repeat while response = "Go"
set theViewInfo to (GetViewInfo) as list
set the end of thePath to (item 2 of theViewInfo) & "," & (item
1 of theViewInfo) & "," & (item 3 of theViewInfo) & "
" as string
tell application "System Events"
set response to button returned of (display dialog "Press Go to
log a GE Coordinate" buttons {"Go", "Stop"})
--set theTime to do shell script "date +'%m-%d-%YT%I:%M:%S'"
end tell
end repeat
end tell
thePath
------
Thanks,
Dane
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40hailmail.net
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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