Re: Detecting the minus sign in a string
Re: Detecting the minus sign in a string
- Subject: Re: Detecting the minus sign in a string
- From: Tommy Bollman <email@hidden>
- Date: Thu, 24 Jun 2010 10:08:26 +0200
This code runs.
set appName to application "AppleScript Editor"
tell application "Finder" to tell appName to get id of window 2
It must be a bug or have something to do with the fact that System Events supports the process class and other apps do not.
On 23. juni 2010, at 21.22, Michelle Steiner wrote:
> On Jun 23, 2010, at 11:36 AM, Alex Zavatone wrote:
>
>> Well, specifically, I'm trying to see if the minus sign is the second word from the end of a string.
>
> that makes it easy, assuming that there's at least one hyphen in the string.
>
> set text item delimiters to {"-"}
> set mystring to "This is - my - string"
> if (count words of last text item of mystring) is 1 then
> true
> else
> false
> end if
>
> This returns true if the last of more than one hyphens is the last word of the string.
>
> You would need error correction for zero hyphens. There may, however, be a problem depending on how you are defining "word"; would any other non-alphanumeric be considered a word, or exist after the last hyphen?
>
> -- Michelle
>
> --
> "Life is too cool to miss."
> -- Sammy Camarata
>
> _______________________________________________
> 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
Best regards
Tommy Bollman
--------------------------------------------------------------------------------------------------
Mollison's Bureaucracy Hypothesis:
If an idea can survive a bureaucratic review
and be implemented it wasn't worth doing.
_______________________________________________
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