FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister   ProfileProfile    Log inLog in   RSS Feed

How to keep a key modifier "Key down" continuously?

 
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac
View previous topic :: View next topic  
Author Message
gamuso
Junior Member


Joined: 01 Feb 2007
Posts: 27

PostPosted: Thu Jan 24, 2008 3:42 pm    Post subject: How to keep a key modifier "Key down" continuously Reply with quote

hello,

I don't know very much about scripting, I have done some modifications to some scripts to achieve what I need.

BUT NOW I CAN'T FIND A WAY OUT. this is my problem:

I need to press "^" and to be able to keep the "Shift Modifier" down, until I press again "^" (then Shift modifier would go back to "key up").

this is the line I need to modify (and I don't know how):

[b] if keyCode = "^" then
if modifierShift then
set modifierShift to false
show screen message "AUX OFF"
else
set modifierShift to true
show screen message "AUX ON"
end if[/b]

my problem is that once I press "^" I have Shift activated, then if I press another key of my mobile phone I will have to press "^" again to get Shift activated, but I NEED THAT "SHIFT" KEEPS ACTIVATED UNTIL I PRESS "^", AGAIN. AND TO BE ABLE TO PRESS AS MANY KEYS AS NECESSARY WITHOUT HAVING TO PRESS "^" EACH TIME TO MAKE THEM "Shifted".
as if it were all the time "key down", until I press "^", then it would be "key up".

any suggestions (plesase!)?.

I send you my script.

thank you.




property modifieroption : false
property modifierShift : false
property modifierList : {}


using terms from application "SEC Helper"



on process invoke term
tell term
set player to make new keypad screen with properties {title:"Wireless Keyboard & Mouse", sends pen events:true}
tell player
make new text row with properties {horizontal alignment:left, overflow:wrap, font size:small, textual content:Ž
"Razluchayas s devoy miloy, " & return & Ž
}
end tell
push player
end tell
end process invoke


on process key down keyCode sent from pad
tell application "Live"
activate
end tell
tell application "SEC Helper"
-- show screen message keyCode

if keyCode = "^" then
-- Mail Key -- Shift Modifier
if modifierShift then
set modifierShift to false
show screen message "AUX OFF"
else
set modifierShift to true
show screen message "AUX ON"
end if
else if keyCode = "v" then
-- option + mail -- option
if modifieroption then
set modifieroption to false
show screen message "EFECTS OFF"
else
set modifieroption to true
show screen message "EFECTS ON"
end if
else
set modifierList to {}

if modifieroption then
set modifierList to {} & {"option"}
end if

if modifierShift then
set modifierList to {} & {"shift"}
end if

if keyCode = "*" then

simulate keyboard virtual keycode 24 modifiers modifierList
show screen message "*"

else if keyCode = "#" then
-- Down Arrow
simulate keyboard virtual keycode 47 modifiers modifierList
show screen message "#"
else if keyCode = "<" then
-- Left Arrow
simulate keyboard virtual keycode 31 modifiers modifierList
show screen message "lefa"
else if keyCode = ">" then
-- Right Arrow
simulate keyboard virtual keycode 12 modifiers modifierList
show screen message "Fade OUT!"
else if keyCode starts with "'" then
else if keyCode = "1" then
simulate keyboard virtual keycode 18 modifiers modifierList
show screen message "1"
else if keyCode = "2" then
simulate keyboard virtual keycode 19 modifiers modifierList
show screen message "2"
else if keyCode = "3" then
simulate keyboard virtual keycode 20 modifiers modifierList
show screen message "3"
else if keyCode = "4" then
simulate keyboard virtual keycode 21 modifiers modifierList
show screen message "4"
else if keyCode = "5" then
simulate keyboard virtual keycode 23 modifiers modifierList
show screen message "5"
else if keyCode = "6" then
simulate keyboard virtual keycode 22 modifiers modifierList
show screen message "6"
else if keyCode = "7" then
simulate keyboard virtual keycode 26 modifiers modifierList
show screen message "7"
else if keyCode = "8" then
simulate keyboard virtual keycode 28 modifiers modifierList
show screen message "8"
else if keyCode = "9" then
simulate keyboard virtual keycode 25 modifiers modifierList
show screen message "9"
else if keyCode = "0" then
simulate keyboard virtual keycode 10 modifiers modifierList
show screen message "0"
else if keyCode = "s" then
simulate keyboard virtual keycode 11 modifiers modifierList
show screen message "Enter"

end if

set modifieroption to false
set modifierShift to false
end if
end tell
return (true)
end process key down



end using terms from
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Jan 24, 2008 4:32 pm    Post subject: Reply with quote

Please see the Front Row controller script that comes with Salling Clicker. It does things very similar to what you need.

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gamuso
Junior Member


Joined: 01 Feb 2007
Posts: 27

PostPosted: Thu Jan 24, 2008 5:06 pm    Post subject: Reply with quote

nnnn... it looks too complicated for me.

I just need to modify that line to make the "^" key to keep "key downed" until I press again "^".

I'll study the front row script, but maybe I'll become cracy (I'm just a musician).

if anyone can tell me the neede modification I'll be so grateful
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Thu Jan 24, 2008 6:26 pm    Post subject: Reply with quote

And that's exactly what the Front Row script tells you how to do, if you can be bothered to check it out.

You could also have a look at the scripting dictionary for "SEC Helper" (Clicker's background application). It's fairly well documented.

Best.
--
Jonas

[quote="gamuso"]nnnn... it looks too complicated for me.

I just need to modify that line to make the "^" key to keep "key downed" until I press again "^".

I'll study the front row script, but maybe I'll become cracy (I'm just a musician).

if anyone can tell me the neede modification I'll be so grateful[/quote]
Back to top
View user's profile Send private message Send e-mail Visit poster's website
maelcum
Junior Member


Joined: 09 Dec 2007
Posts: 35

PostPosted: Thu Jan 24, 2008 11:17 pm    Post subject: Boy, you have had a bad day, hm? Reply with quote

[quote="salling"]And that's exactly what the Front Row script tells you how to do, if you can be bothered to check it out.
[/quote]

You might have a point here, true, but do you really think lecturing helps him or makes you more likeable? As the developer of this application and the scripts you are advising him to read, it sure is a piece of cake for you to help, isn't it. And it would probably have taken the same amount of time it took you to arrogantly lecture him.

Honestly, your answer sucks. You tried to help, he didn't get it, then why don't just leave it at that? Maybe somebody else picks up the thread.

Not everybody finds AppleScript easy. I don't; it somehow doesn't "fit" me. And understanding somebody elses scripts is hard enough on it's own, even being fluent in it's language.

Maybe you are making too much money with Clicker already, so shrugging off your customers is a fun entertainment. Or maybe you are not making enough money for it being worth helping them out.
Or maybe you just had a bad day.
Either way, it's not helping your business.

Just my 2 cents, as they say.
Back to top
View user's profile Send private message
salling
Site Admin


Joined: 27 Jul 2004
Posts: 7498
Location: Stockholm, Sweden

PostPosted: Fri Jan 25, 2008 12:05 am    Post subject: Reply with quote

I apologize if I came across as arrogant. It certainly was not my intention. I'll readily admit that I was busy while responding (only read "too complicated") and missed the part about being a musician trying to learn AppleScript. Sorry.

Here's how to cause shift to be pressed:

[code:1]
tell app "SEC Helper"
simulate keyboard virtual down keycode 56
end
[/code:1]

And here's for releasing it:

Here's how to cause shift to be released:

[code:1]
tell app "SEC Helper"
simulate keyboard virtual up keycode 56
end
[/code:1]

Best.
--
Jonas
Back to top
View user's profile Send private message Send e-mail Visit poster's website
maelcum
Junior Member


Joined: 09 Dec 2007
Posts: 35

PostPosted: Fri Jan 25, 2008 12:09 am    Post subject: Good sports Reply with quote

Thanks, Jonas.

Good sports. :D
Back to top
View user's profile Send private message
gamuso
Junior Member


Joined: 01 Feb 2007
Posts: 27

PostPosted: Fri Jan 25, 2008 12:17 am    Post subject: Reply with quote

uuaaauuhhh!! thank you maelcum...

well, I have felt I little stupid the first time I read the answer, but I always fight... so I opened the front row script and the SEC Helper dictionary... and spent one hour and a half with it.

I have learned some little things... but I donīt get the scripting thing (eh! this past year I`ve learned by my self to work with ableton live, logic, photoshop, finalcut, and Max/MSP).

...I must say I cant find the answer to my question:

HOW TO KEEP A MODIFIER DOWN UNTIL I PRESS AGAIN THE KEY ASIGNED TO IT.

in the past jonas helped me with some things... maybe it's just a bad day.

SO PLEASE, can anybody help me?

thank you again.


[url]www.davidfernandez.com.es[/url]
Back to top
View user's profile Send private message
gamuso
Junior Member


Joined: 01 Feb 2007
Posts: 27

PostPosted: Fri Jan 25, 2008 12:36 am    Post subject: Reply with quote

[quote="salling"]I apologize if I came across as arrogant. It certainly was not my intention. I'll readily admit that I was busy while responding (only read "too complicated") and missed the part about being a musician trying to learn AppleScript. Sorry.

Here's how to cause shift to be pressed:

[code:1]
tell app "SEC Helper"
simulate keyboard virtual down keycode 56
end
[/code:1]

And here's for releasing it:

Here's how to cause shift to be released:

[code:1]
tell app "SEC Helper"
simulate keyboard virtual up keycode 56
end
[/code:1]

Best.
--
Jonas[/quote]



thank you... it's much easier than what I had thought.
Back to top
View user's profile Send private message
gamuso
Junior Member


Joined: 01 Feb 2007
Posts: 27

PostPosted: Fri Jan 25, 2008 1:30 am    Post subject: Reply with quote

just one more thing please (20 min. trying to find it)

if 56 is the number for the shift... where can I find the numbers for the other modifiers (alt, command, control, etc.)?.

thank you
Back to top
View user's profile Send private message
maelcum
Junior Member


Joined: 09 Dec 2007
Posts: 35

PostPosted: Fri Jan 25, 2008 1:43 am    Post subject: List of Keycodes Reply with quote

[quote]where can I find the numbers for the other modifiers (alt, command, control, etc.)[/quote]

Here: http://hohabadu.de/?APPLESCRIPT/UIScripting
(Scroll Down, there's a big grey box coming up...)
(The site itself is in german, unfortunately; maybe googleing "AppleScript key codes" will come up with something more appropriate...)


Last edited by maelcum on Fri Jan 25, 2008 11:44 am; edited 1 time in total
Back to top
View user's profile Send private message
gamuso
Junior Member


Joined: 01 Feb 2007
Posts: 27

PostPosted: Fri Jan 25, 2008 11:30 am    Post subject: Reply with quote

THANK YOU!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Salling Software Forums Forum Index -> Scripting Salling Clicker for Mac All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group