Re: JustWonedering
Re: JustWonedering
- Subject: Re: JustWonedering
- From: DigitEL <email@hidden>
- Date: Fri, 18 Sep 2009 05:54:22 -0700
Shane >
Thanks for the code info... Actually all I really want is to detect
the Option key down so that it becomes very simple to implement a
Preferences routine for settings but will allow the script to execute
'normally' without interruption otherwise. Seems like a no-brainer to
me to such a simple interface mech but maybe that's just me. As such
there is now no way now to include Preference settings in something
like folder actions that can be configured by the end user. That's
all I am really trying to do.
--
ForNow
DigitEL
On Sep 18, 2009, at 1:39 AM, Shane Stanley wrote:
On 18/9/09 6:19 PM, "Ronald Hofmann" <email@hidden> wrote:
Very interesting, and how are you doing it?
Can you give us an example?
Greetings, Ronald
---
Am 18.09.2009 um 01:23 schrieb Shane Stanley:
On 18/9/09 8:58 AM, "email@hidden" <email@hidden> wrote:
I believe that was from Jon's Commands
And it's probably worth noting that stuff like this is relatively
simple
using AppleScriptObjC, if you really need it in an app.
This thread seems to be jumping between lists, so excuse the cross-
post. It
started out about looking to see if a modifier key was pressed...
I set up a property for NSEvent class at the top level of the
script, for
convenience:
property eventClass : class "NSEvent"
Then I do the equivalent of calling NSEvent's modifierFlags method,
which
returns a (large) number. From that I can work out what modifier
keys are
down.
So this handler will cover the main ones:
on getModifiers_(sender)
set theMods to {false, false, false, false, false, false}
-- Fn,
Cmd, Opt, Ctrl, Shift, Caps Lock
set theNum to ((eventClass's modifierFlags()) div 65536)
if theNum > 127 then
set item 1 of theMods to true
end if
--set theNum to theNum mod 32
if theNum mod 32 > 15 then
set item 2 of theMods to true
end if
-- set theNum to theNum mod 16
if theNum mod 16 > 7 then
set item 3 of theMods to true
end if
-- set theNum to theNum mod 8
if theNum mod 8 > 3 then
set item 4 of theMods to true
end if
-- set theNum to theNum mod 4
if theNum mod 4 > 1 then
set item 5 of theMods to true
end if
-- set theNum to theNum mod 2
if theNum mod 2 = 1 then set item 6 of theMods to true
return theMods
end getModifiers_
If you're only interested in a particular modifier, it becomes a
lot simpler
obviously.
--
Shane Stanley <email@hidden>
AppleScript Pro, April 2010, Florida <http://www.applescriptpro.com>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
_______________________________________________
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