• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Rep: set volume v : Set the sound output and/or input volume
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rep: set volume v : Set the sound output and/or input volume


  • Subject: Rep: set volume v : Set the sound output and/or input volume
  • From: "koenig.yvan" <email@hidden>
  • Date: Mon, 15 Jul 2013 20:46:34 +0200

Le 15/07/2013 à 18:20, Robert Poland <email@hidden> a écrit :

Hi,

What I'm hearing is that if I have a long tell block and I want to embed the "set volume with output muted" command I must exit the tell block(s), do the "set volume with output muted" command then reenter the tell block(s).

On Jul 15, 2013, at 8:57 AM, "koenig.yvan" <email@hidden> wrote:


Le 15/07/2013 à 16:36, sphil <2551phil@gmail.com> a écrit :

Hi Robert

The 'set volume' command is part of the Standard Additions suite. That means it doesn't need to be in a tell block at all. Finder no doubt recognises it as such and passes it along, but GraphicConverter will choke on any commands that aren't in its dictionary.


set volume with output muted

will compile and execute on its own without being embedded in any tell block.


Best

Phil

In fact the truth isn't  "it doesn't need to be in a tell block at all. ".

As it was explained several times, it's "it must not be in a tell block at all." ;-)

It's the rule since 10.6.

If you study at least the chapter entitled  "Scripting Addition Security" in the document :

https://developer.apple.com/library/mac/#releasenotes/AppleScript/RN-AppleScript/RN-10_6/RN-10_6.html#//apple_ref/doc/uid/TP40000982-CH106-SW3

you will see that most of OSAX commands issue an error when called from a tell application … end tell wrapper.

KOENIG Yvan (VALLAURIS, France) lundi 15 juillet 2013 16:56:31

Robert Poland - Fort Collins, CO

You know that I'm not at ease with English so I try to be short and drop some details.
I taught that it was sufficient because this behaviour introduced with 10.6 was described many times here.

As it seams that reading the linked web page is too complicated for you, I reproduce the relevant chapter here.

Scripting Addition Security

For security reasons, most scripting addition commands now return a “privilege violation” error when sent between application processes. In order to preserve compatibility with existing scripts, AppleScript redirects most of these commands to the current application, that is, the process running the script. If a script sends events to a remote computer via EPPC (“Remote Apple Events”), AppleScript may redirect them to the System Events process on the target machine. AppleScript Editor’s Event Log will show when this redirection happens: you will see the event sent first to the original target process, return an error, and then sent again, often to the current application.
Some scripting addition commands, such as display dialog, must be handled within the target process to operate correctly, and may require authenticating as an administrator if any of the following are true:
  • The sender and target processes have different user or group owner ids.
  • The target process is “tainted” by privilege level changes. (See issetugid(2) for full details.)
  • The target application is not scriptable. To be considered scriptable, an application must have a terminology dictionary or the Info.plist key NSAppleScriptEnabled set to true.
If the event can be successfully redirected to the current process, then it didn’t need to be sent to the target process in the first place. You can eliminate the unnecessary double-send by moving the scripting addition command outside of the tell block, or by adding tell current application to to the command. For example, this script makes a new folder on the desktop named with the current date, but does it in a way that requires current date to be sent twice:
tell application "Finder"
    set folderName to date string of (current date)
    make new folder with properties {name:folderName}
end tell
To eliminate the double send, move the current date outside of the tell block:
set folderName to date string of (current date)
tell application "Finder"
    make new folder with properties {name:folderName}
end tell
Or add an inner tell applying to the addition command:
tell application "Finder"
    tell current application to set folderName to date string of (current date)
    make new folder with properties {name:folderName}
end tell

KOENIG Yvan (VALLAURIS, France) lundi 15 juillet 2013 20:17:01



 _______________________________________________
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

  • Prev by Date: Revisited: controlling sound input on Mac Pro?
  • Next by Date: Re: set volume v : Set the sound output and/or input volume
  • Previous by thread: Re: set volume v : Set the sound output and/or input volume
  • Next by thread: global variables
  • Index(es):
    • Date
    • Thread