Get Keyboard Statue with Combination Key ?

Discussions concerning programming of SOFTIMAGE©
Post Reply
User avatar
eternal art
Posts: 93
Joined: 08 Jun 2009, 22:48
Location: UAE - Abu Dhabi

Get Keyboard Statue with Combination Key ?

Post by eternal art » 27 Jul 2013, 15:36

Hi ..
I'm using this code to get the keyboard key statue when doing something to identify if Ctrl or Shift or Alt key is pressed when calling command :

Code: Select all

Dim ModifierKey
GetKeyboardState , ModifierKey


if CBool(CByte(1) And CByte(ModifierKey)) Then
'--------------------------------------------------------
Logmessage "Shift"

ElseIf CBool(CByte(2) And CByte(ModifierKey)) Then
'--------------------------------------------------------
Logmessage "Ctrl"
		
ElseIf CBool(CByte(4) And CByte(ModifierKey)) Then
'--------------------------------------------------------
Logmessage "Alt"

Else
'--------------------------------------------------------
Logmessage "Nothing"
  
End If
But i want to get a combination key statue like Ctrl + Shift together ? Is there any way to get it .
3D Supervisor - Production House .

User avatar
csaez
Posts: 253
Joined: 09 Jul 2012, 15:31
Skype: csaezmargotta
Location: Sydney, Australia
Contact:

Re: Get Keyboard Statue with Combination Key ?

Post by csaez » 27 Jul 2013, 19:00

Hi,
You can add Shift values, here's a python example:

Code: Select all

# HINT: Shift == 1, Ctrl == 2, Alt == 4
mask = Application.GetKeyboardState()("Shift")
if mask == 1 + 2:
    print "shift + ctrl"
Cheers!

User avatar
eternal art
Posts: 93
Joined: 08 Jun 2009, 22:48
Location: UAE - Abu Dhabi

Re: Get Keyboard Statue with Combination Key ?

Post by eternal art » 27 Jul 2013, 21:17

it's work , thanks csaez .
3D Supervisor - Production House .

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests