Re: Won't run
Re: Won't run
- Subject: Re: Won't run
- From: Robert Poland <email@hidden>
- Date: Tue, 26 Mar 2013 13:17:04 -0600
Thanks Chris,
Sometimes "KISS" works.
I finally got an Automator worked out. I can now use a service from anywhere to open Smile and check version status. As a side benefit this gets around the nuisance of Smile opening a dozen other apps when it starts up.
Here's the current Script, complete with my usual loads of gibberish;
(* SmileVersion - 3/24/13, from Christopher Stone <email@hidden> 3/26/13 - added dialog
*)
global item_list, this_text, replacement_string -- hide Smile BUG
with timeout of 60 seconds
set fileData to ""
set search_string to ["<"]
set search_string2 to [">"]
set replacement_string to [return]
set originalDelimiters to the AppleScript's text item delimiters
set _cmd to "curl -sL -A 'Mozilla/5.0' \"http://www.satimage.fr/software/en/downloads/index.html\"; \\
| perl -wlne 'if (m!(?ims)(<a href=.+?downloads.+?smile.+?build.+?</a>)!) {print \"$1\"}';
"
set remoteSmileVersion to do shell script _cmd
set fileData to remoteSmileVersion as string
set remoteSmileVersion to replace_chars(fileData, search_string, replacement_string)
set remoteSmileVersion to replace_chars(remoteSmileVersion, search_string2, replacement_string)
set the AppleScript's text item delimiters to {return}
set fileData to every text item of remoteSmileVersion as list
set remoteSmileVersion to text item 3 of fileData
set remoteSmileVersion to replace_chars(remoteSmileVersion, " full edition", "") -- strip " full edition" from result
-- **************************************
set the AppleScript's text item delimiters to {return} -- strip ending return
set fileData to every text item of remoteSmileVersion as list
set remoteSmileVersion to text item 1 of fileData
set the AppleScript's text item delimiters to originalDelimiters -- reset
tell application "Finder"
set smileApp to application file id "com.satimage.Smile" as alias
set localSmileVersion to (version of smileApp)
set localSmileVersion to paragraph 1 of localSmileVersion
end tell -- Finder
end timeout
-- set clipboard to localSmileVersion -- & return & remoteSmileVersion
-- set clipboard to remoteSmileVersion
if localSmileVersion = remoteSmileVersion then
tell application "System Events" to display dialog "You are running the current version," & return & return & localSmileVersion
else
beep
tell application "System Events" to display dialog "There is a newer version available," & return & return & "Newest Smile Version = " & remoteSmileVersion
end if
tell application "Smile"
close window "TestScript" without saving
end tell
on replace_chars(this_text, search_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
On Mar 26, 2013, at 12:42 PM, Christopher Stone <email@hidden> wrote:
> On Mar 26, 2013, at 13:26, Robert Poland <email@hidden> wrote:
>> This sample doesn't run. Error - Can't get window whose name of it = "TestScript".
> ______________________________________________________________________
>
> Hey Bob,
>
> Try this:
>
> tell application "Smile"
> close window "TestScript" with saving
> -- OR
> close window "TestScript" without saving
> end tell
>
> I haven't fiddled with the check-for-updates script for Smile yet, but I will when I have some time. The idea is to write a context-script for Smile that will perform the check when it [Smile] starts up, but I haven't delved into that stuff for years and need to refresh my memory.
>
> --
> Best Regards,
> Chris
Robert Poland - Fort Collins, CO
_______________________________________________
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
References: | |
| >Won't run (From: Robert Poland <email@hidden>) |
| >Re: Won't run (From: Christopher Stone <email@hidden>) |