Re: Missing something obvious
Re: Missing something obvious
- Subject: Re: Missing something obvious
- From: Axel Luttgens <email@hidden>
- Date: Sun, 13 Dec 2009 13:07:54 +0100
Le 13 déc. 2009 à 02:55:35, Mark Ratledge a écrit :
> Tried all those property selectors in Pages; no difference. "set the_url to contents of «class pSel» of document 1" works fine outside of the if else loop. The problem is still with the if else loop; the script blows right by it.
Hello Mark,
I tested your script *as is* under both 10.4.11 and 10.6.2; it seems to work here, yet the concept of "working" may depend on what you are trying to do, and how you are trying to do it.
For example, the "return" statement appearing in the else branch could be an indication that your code in fact belongs to a handler.
Anyway, given your initial description of the problem:
> This script returns the value of the_title to the clipboard, not the_text (under 10.4.11, if it makes a difference):
it could be worth to first try a slightly amended version of your script:
> set the_title to the clipboard
>
> tell application "System Events"
> set myApp to name of first application process whose frontmost is true
>
> if myApp is "Pages" then
> tell application "Pages"
> set the_url to the selection as text
> end tell
>
> else if myApp is "BBEdit" then
> tell application "BBEdit"
-- Not really for debugging purposes: it is anyway a good
-- idea to avoid to send a subsequent event to BBEdit.
set the url to the selection as text
> --set the_url to the selection
> end tell
> else
-- Obviously, if we come here, nothing will happen wrt the clipboard.
-- Let's thus try to understand why we're here.
tell application "Finder" to display dialog "myApp: >>>" & myApp & "<<<" &return & "class of myApp: " & class of myApp
> return
> end if
> end tell
>
>
> set the_text to " <a href=\"" & the_url & "\" title=\"" & the_title & "\" class=\"external\">" & the_title & "</a>"
>
> set the clipboard to the_text
If a dialog pops up, could you share its message with us?
Otherwise, there must be a problem with the way you are accessing the clipboard's contents in your code.
HTH,
Axel _______________________________________________
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