Has the behavior of 'run script' changed in Snow Leopard?

These work fine:
tell application "Safari"
return URL of front document
end tell
tell application "Safari"
set longURL to URL of front document
return longURL
end tell
This does not:
set getFrontmostURLCommand to "URL of front document"
tell application "Safari"
set longURL to run script getFrontmostURLCommand
end tell
return longURL
Why? It looks like a script interpretation error but I can't figure out what's wrong.
The error returned is:
error "Safari got an error: Can’t get URL of document 1." number -1728 from "URL of front document"

I see. Is there a way to make the application variable? I'm writing a function because getFrontmostURLCommand works with a couple of different browsers and I want it to be run conditionally based on the user's browser. Something like this:
set defaultBrowser to GetDefaultWebBrowser()
on GetDefaultWebBrowser()
set _scpt to "export VERSIONERPERL_PREFER_32BIT=yes; " & -
"perl -MMac::InternetConfig -le " & -
"'print +(GetICHelper \"http\")[1]'"
return do shell script _scpt
end GetDefaultWebBrowser
on defaultGetFrontmostURLCommand(defaultBrowserApplication)
tell application defaultBrowserApplication to set longURL to URL of front document
end defaultGetFrontmostURLCommand
on caminoGetFrontmostURLCommand()
tell application "Camino" to set longURL to URL of current tab of browser window 1
end caminoGetFrontmostURLCommand
if defaultBrowser is in {"Safari", "WebKit", "Opera"} then
defaultGetFrontmostURLCommand(defaultBrowser)
else if defaultBrowser is "Camino" then
caminoGetFrontmostURLCommand()
end if
set the clipboard to longURL

Similar Messages

  • Did Apple Script change - upgraded Snow Leopard Mavericks

    I used to use below script to toggle sound output (assigned to function key) in Snow Leopard.
    Upgraded to Mavericks few weeks ago and wanted to use that script again, but keep on getting error -1728 as displayed hereafter, anyone out there to tell me what I should do to make it work in Mavericks?
    Thx,
    Laerg1
    Here's the full script:
    --This script toggles between two audio outputs in the "Sound" pane in "System Preferences.
    --USES GUI SCRIPTING - "ENABLE ASSISTIVE DEVICES" OPTION MUST BE CHECKED IN "UNIVERSAL ACCESS" PREFERENCE PANE
    --Adapted from script written by Corey Menscher for toggling outputs using Salling Erickson Clicker
    tell application "System Preferences"
        activate
    end tell
    tell application "System Events"
        tell application process "System Preferences"
            set frontmost to true
            click menu item "Sound" of menu "View" of menu bar 1
            if my wait4window("Sound") is false then return false
            tell window "Sound"
                tell tab group 1
                    tell radio button "Output"
                        click
                    end tell
                    (* You can add your own audio output descriptive text, such as "iMic USB Audio", in the next section. *)
                    if (selected of row 2 of table 1 of scroll area 1) then
                        set selected of row 1 of table 1 of scroll area 1 to true
                    else
                        set selected of row 2 of table 1 of scroll area 1 to true
                    end if
                end tell
            end tell
        end tell
    end tell
    tell application "System Preferences" to quit
    on wait4window(this_title)
        tell application "System Events"
            tell process "System Preferences"
                repeat with i from 1 to 60
                    if the name of window 1 is this_title then return true
                    delay 1
                end repeat
            end tell
        end tell
        return false
    end wait4window

    Let's double-check the amount of RAM in that machine. Click the Apple logo in the upper left corner & choose About This Mac. In the window that comes up, what's listed for RAM?
    That machine will run Snow Leopard very nicely with 2GB of RAM. For it to run Mavericks, I would upgrade it to at least 4GB or more if it can handle it.
    If I was in your position, I would run Snow Leopard for a while and see how well it serves you. If you want to upgrade, my  personal opinion would be to go to Mountain Lion, rather than Mavericks, but that is simply because I found that Mavericks slowed one of my machines to a crawl and was not pleased with the performance. Went back to Mountain Lion and it's humming along.
    ~Lyssa

  • My AppleWorks spread sheet has started crashing.  I upgraded AppleWorks from 6 to 6.2.9, but it still crashes when I try to save changes or print.  I run 10.6.8 Snow Leopard.

    My AppleWorks spread sheet has started crashing.  I just upgraded AppleWorks from 6 to 6.2.9, but it still crashes when I try to save changes or print.  I run 10.6.8 Snow Leopard.  This same spread sheet does not crash on my other two Macs.  Please help, I use this spread sheet daily in my business.  Jeanie

    Did you apply the security update to this Mac & not the others? If you did, check Software Update again. Apple has released an updated security update. This has fixed the problems caused by the first version.

  • My mid-2012 MacBook Pro has the fan constantly running. As soon as I turn it on. My MBP won't even be hot and the fan is running. How can I fix this?

    My mid-2012 MacBook Pro has the fan constantly running. As soon as I turn it on. My MBP won't even be hot and the fan is running. How can I fix this?

    If you are still under warranty and/or have AppleCare, call them.  Let them deal w/it.
    OOW try the following:  http://support.apple.com/kb/HT1411 Apple Portables: Resetting the System Management Controller (SMC) 

  • Why does my laptop give me a warning saying that firefox is using too much memory and to restart firefox to be more efficient? I just bought this laptop so I know it has the power to run what I need it to.

    Why does my laptop give me a warning saying that firefox is using too much memory and to restart firefox to be more efficient? I just bought this laptop so I know it has the power to run what I need it to.

    You appear to have AVG installed:
    *See --> http://forums.avg.com/ww-en/avg-forums?sec=thread&act=show&id=173969#post_173969
    From reading on the internet, it appears that when there is a spike in memory usage, AVG "interprets" that as a memory leak, possibly caused by malware. AVG could be incorrect concerning that assumption. Maybe they are being a bit too conservative about memory usage; just my opinion.
    The decision is yours to turn off the "advisor" or leave it on.
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''
    Not related to your question, but...
    You may need to update some plug-ins. Check your plug-ins and update as necessary:
    *Plug-in check --> http://www.mozilla.org/en-US/plugincheck/
    *Adobe Shockwave for Director Netscape plug-in: [https://support.mozilla.com/en-US/kb/Using%20the%20Shockwave%20plugin%20with%20Firefox#w_installing-shockwave Installing ('''''or Updating''''') the Shockwave plugin with Firefox]
    *'''''Adobe PDF Plug-In For Firefox and Netscape''''': [https://support.mozilla.com/en-US/kb/Using%20the%20Adobe%20Reader%20plugin%20with%20Firefox#w_installing-and-updating-adobe-reader Installing/Updating Adobe Reader in Firefox]
    *Shockwave Flash (Adobe Flash or Flash): [https://support.mozilla.com/en-US/kb/Managing%20the%20Flash%20plugin#w_updating-flash Updating Flash in Firefox]
    *'''''Next Generation Java Plug-in for Mozilla browsers''''': [https://support.mozilla.com/en-US/kb/Using%20the%20Java%20plugin%20with%20Firefox#w_installing-or-updating-java Installing or Updating Java in Firefox]

  • I am running a Mac OSX Snow Leopard. Joined Creative Cloud for the year and now it won't allow me to

    I am running a Mac OSX Snow Leopard. Joined Creative Cloud for the year and now it won't allow me to install the app due to administrator rights. Does anyone know how to fix this ?  I have done all the necessary logging already.

    Duplicate post http://forums.adobe.com/thread/1382476

  • HT1444 How can I upgrade the OS on my 5 year old MacBook Pro 17.  It is currently running 10.4 (Tiger).  I have an IMac 27 running Lion but have Snow leopard discs which came with the purchase.  Can these be used to upgrade?

    How can I upgrade the OS on my 5 year old MacBook Pro 17.  It is currently running 10.4 (Tiger).  I have an IMac 27 running Lion but have Snow leopard discs which came with the purchase.  Can these be used to upgrade?

    Buswab wrote:
    How can I upgrade the OS on my 5 year old MacBook Pro 17.  It is currently running 10.4 (Tiger).  I have an IMac 27 running Lion but have Snow leopard discs which came with the purchase.  Can these be used to upgrade?
    If they are the grey discs which came with the iMac, then they will be machine specific and will not work on the MBP anyway. You will need to purchase a retail copy of Snow Leopard from the Apple Store for about $29 and upgrade from that. I presume your MBP is Intel and not G4.
    Good Luck
    Pete

  • Which macs are the most powerful versions that can still run 10.6.8 snow leopard?

    which macs are the most powerful versions that can still run 10.6.8 snow leopard?

    See this previous discussion:
    https://discussions.apple.com/thread/5050319?tstart=0

  • Has Apple stopped supporting email on iCloud using Snow Leopard?

    May 1, 2012 4:43 PM 
    Has Apple stopped supporting email on iCloud using Snow Leopard?
    As of Friday, 27 Apr 12, I have been unable to load me.com email onto my computer although I can still bring in my other account (sbc), but I am only able to view my me.com email using the icloud web site. It loads ok on my iPhone, and I had an appointment @ an Apple store and all my email came in ok while in the store. I migrated to iCloud last year, but I'm still running Snow Leopard because of the incompatibility issues of Lion and other software, specifically Quicken.
    Any ideas?

    ds store wrote:
    Sorry, I'm trying a new OS (not Apple) and having a issue which I went back to edit my post and then the window closed.
    Maybe you should re-think that strategy.
    I don't know, perhaps Apple found out about Roger's trick and is now banning 10.6 users from iCloud.
    iClould still provides standard IMAP and SMTP services: http://support.apple.com/kb/HT4864
    IMO, just use a web based email like Gmail or Hushmail, that way any device anywhere that has a web broswer can get it.
    But if you use Apple Mail, then you can access your mail wether you have internet or not.

  • Scripts broken under Snow Leopard?

    I wrote a script using AppleScript Editor. After several tests, running it manually from within AppleScript Editor, it seems to work just fine and does what I want it to. So, I saved a copy of the script as "run only". Supposedly, I should now be able to double-click the run-only script in order to run it without opening the editor. But, when I double-click the file, I get two pop-up windows. The first says: "Unable to read the file because the script is not editable (it was saved as run-only)", the second says "The document 'myscript' could not be opened."
    Are scripts broken under Snow Leopard?

    sauljaffe wrote:
    That's absurd. What purpose does the "run-only" option have then?
    that's needed when people publish applications they created and don't want others to see source code. this is done to all commercial software to protect against software piracy. you can do it to your own home made programs too if you want using that button.
    If you can't run it, and can't open it with the editor, then you have a file on your system you can only do one thing with: move it to the trash.
    There must be a way to save scripts so they can be run without opening the editor first.
    of course there is. you save the script as an application. then to run it you double-click on it.
    If "run-only" isn't it, then what is it?

  • Script Editor in Snow Leopard painfully slow after adding apps to Library

    I have four different Macs that I use from time to time, and on each of them I notice a constant: adding more items to AppleScript Editor's Library window slows performance of mundane operations (opening a dictionary, switching between Library window and editor window, scrolling in the Library window, etc).
    In Leopard, I noticed little to know latency in opening a dictionary in Script Editor, but Snow Leopard's AppleScript Editor kills my productivity by making me wait on it with most UI interactions with the Library window.

    Hello
    I read another post of yours:
    Topic : Issue with applescript and installer scripts
    http://discussions.apple.com/thread.jspa?threadID=2143147
    It seems that the installer is calling osascript which is run in 64-bit mode under OSX 10.6 whereas XSLT Tools.osax invoked in the script is in 32-bit mode only.
    Until the osax becomes 64-bit capable, you may try setting /usr/bin/osascript to run in 32-bit mode. Perhaps by setting an option in Get Info window in Finder as explained in the AppleScript Release Notes listed earlier. (?)
    I'm not sure but if Finder cannot do it for commands, you'd need to replace 'osascript' with 'arch -i386 osascript' in the installer script (if it's editable) or let /usr/bin/osascript be wrapped via arch(1) so that it is run in 32-bit mode.
    cf.
    http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/m an1/arch.1.html
    Good luck,
    H

  • How can I save my keepsake photo albums as PDFs in my album folder. Since I changed from Snow Leopard to Lion last year I have't been able to do this.

    How can I save my keepsake photo albums as PDFs in my album folder. Since I changed from Snow Leopard to Lion last year I have't been able to do this.

    preview it using this method -http://support.apple.com/kb/HT1040 - and save the resulting PDF
    Is this what you are doing?Your description does not sound like you are
    LN

  • Why am i having problems since changing from snow leopard loading maverick

    why am i having problems since changing from snow leopard downloading maverick

    Yes you solved your own question, use printer handles color, whcih shodul have been the default. If you do want to experiment with Photohsop manages color, try the CMYK profiles, and send a cmyk file. Only exception is if you print to one of the few RGB printers like a lambda.

  • All applications in iWork fail to open after installing latest apple update. iMac running 10.6.8 Snow Leopard. Have tried reinstalling from iWork disc but no improvement. Help!

    All applications in iWork fail to open after installing latest apple update. iMac running 10.6.8 Snow Leopard. Have tried reinstalling from iWork disc but no improvement. Help!
    Error report as follows
    Process:         Pages [208]
    Path:            /Applications/iWork '09/Pages.app/Contents/MacOS/Pages
    Identifier:      com.apple.iWork.Pages
    Version:         4.1 (923)
    Build Info:      Pages-9230000~1
    Code Type:       X86 (Native)
    Parent Process:  launchd [93]
    Date/Time:       2012-08-22 12:33:15.909 +0100
    OS Version:      Mac OS X 10.6.8 (10K549)
    Report Version:  6
    Interval Since Last Report:          102101 sec
    Crashes Since Last Report:           11
    Per-App Interval Since Last Report:  2217715 sec
    Per-App Crashes Since Last Report:   4
    Anonymous UUID:                      1FA704D3-D5EF-4CE3-9813-42E4559157DC
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Crashed Thread:  0
    Dyld Error Message:
      Symbol not found: _SFAAutosaveUserActivityException
      Referenced from: /Applications/iWork '09/Pages.app/Contents/MacOS/Pages
      Expected in: /Library/Application Support/iWork '09/Frameworks/SFArchiving.framework/Versions/A/SFArchiving

    I'm having this issue as well only with a little different twist I guess. I'm transferring the iWorks applications from my Macbook Pro 3,1 with Lion to a new MBP 10,1 running Mountain Lion. I transferred the apps over using DropCopy since the older MBP doesn't have AirPlay. Applications show up but crash upon opening. This is the first install so there are no previous plist, versions or such to delete. All three crashed upon opening every time until I just had to have Keynote and purchased again - although Apple agreed to refund that purchase since my previous version quit working. Any ideas since I don't have any previous plist/versions to delete? Thanks in adavnce for any help you can offer.
    Process:         Pages [13521]
    Path:            /Applications/iWork '09/Pages.app/Contents/MacOS/Pages
    Identifier:      com.apple.iWork.Pages
    Version:         4.3 (1048)
    Build Info:      Pages-10480000~1
    Code Type:       X86 (Native)
    Parent Process:  launchd [153]
    User ID:         501
    Date/Time:       2013-03-11 14:57:02.175 -0400
    OS Version:      Mac OS X 10.8.2 (12C3103)
    Report Version:  10
    Crashed Thread:  0
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Application Specific Information:
    dyld: launch, loading dependent libraries
    Dyld Error Message:
      Library not loaded: @rpath/SFCompatibility.framework/Versions/A/SFCompatibility
      Referenced from: /Applications/iWork '09/Pages.app/Contents/MacOS/Pages
      Reason: image not found
    Binary Images:
        0x1000 -   0x354fe3  com.apple.iWork.Pages (4.3 - 1048) <3F2BE397-E81E-3355-C0DE-8B0F014E897B> /Applications/iWork '09/Pages.app/Contents/MacOS/Pages
      0x3ec000 -   0x46bff7  com.apple.iLifeMediaBrowser (2.7.2 - 546) <24A0A118-874B-3C7C-B50C-C80BED03A15F> /System/Library/PrivateFrameworks/iLifeMediaBrowser.framework/Versions/A/iLifeM ediaBrowser
    0x8fe3e000 - 0x8fe70e57  dyld (210.2.3) <23DBDBB1-1D21-342C-AC2A-0E55F27E6A1F> /usr/lib/dyld

  • I have just installed Snow Leopard 10.6.3 and want to update my Safari 4.0.4 to the latest version.  However, the latest Safari version needs at least Snow Leopard 10.6.8.  What can I do?

    I have just installed Snow Leopard 10.6.3 and want to update my Safari 4.0.4 to the latest version.  However, the latest Safari version needs at least Snow Leopard 10.6.8.  What can I do, please?

    Go to the Apple Icon, Top Left of your Screen and Run Software Update...
    Or go here  >  http://support.apple.com/kb/DL1399
    and download and Install the 10 6 8 Combo Update...
    Be sure to Restart your Mac after the Install.

Maybe you are looking for

  • I am unable to open my ipad , 2 icloud updates on screen and can't open or shutdown?

    I am unable to open my ipad. I have not used it for a while, it has 2 icloud backup windows on the screen and nothing happens whem I ok the update. Unable to open or shutdown as well.

  • My ipad 4 wont restore

    how do i restore it i have tried it with itunes and with my device. when i do it with my device it takes forever but it doesnt work. when i did it on itunes it showed up as an error.

  • Firefox Built-In Spell Checker

    I installed Firefox from 'Pacman' today and it works great. It's currenlty 3.5.7 and noticed that when I am typing and mis-spell obvious words, it does not underline them in red as Firefox would on any other distribution. I made sure I have the optio

  • Cannot Promote Server 2012 R2 Server to DC??

    I have a freshly installed Server 2012 R2 Core Edition with all of the latest updates as of today.  I did the following: - Changed name to DC6 - Joined it to the existing domain. - Logged in as domain admin. - Set fixed IP address & set DNS servers t

  • Database Reorganize

    Hi expert I want to minimize the size of our current production server, so I delete 1 client (unused client) Now I'm going to do database reorganization with BRTOOLS my question is what table to reorganize ? thanks Della