View Full Version : Invisible pincode?
ds99jove
May 17th, 2004, 11:17 AM
I want to enable certain commands by typing in a pin-code, this should all happen in the background and be invisible to the user. Could anyone give me a push in the right direction how on how to accomplish this?
Promixis
May 17th, 2004, 12:23 PM
Well, you can have Girder catch keys from the keyboard and then block them from being transmitted to another app. Are you planning on having the user press a special key to start listening?
ds99jove
May 17th, 2004, 03:22 PM
Well, you can have Girder catch keys from the keyboard and then block them from being transmitted to another app. Are you planning on having the user press a special key to start listening?
I don't use a keyboard, I was thinking about "listening" to numbers 0-9 on the remote (Remote Wonder). I was thinking that if a user presses 1-2-3-4 and then a function button on the remote an application would be launched. But if someone presses 1-2-3-4 and another button I want to "reset" the function (same goes for pressing combinations of "invalid" pin codes). I.e having a combination of keys triggering an application launch.
Grin Reaper
May 17th, 2004, 06:11 PM
Well, you can have Girder catch keys from the keyboard and then block them from being transmitted to another app. Are you planning on having the user press a special key to start listening?
I don't use a keyboard, I was thinking about "listening" to numbers 0-9 on the remote (Remote Wonder). I was thinking that if a user presses 1-2-3-4 and then a function button on the remote an application would be launched. But if someone presses 1-2-3-4 and another button I want to "reset" the function (same goes for pressing combinations of "invalid" pin codes). I.e having a combination of keys triggering an application launch.
if you are wanting to try and make something yourself, there is the nokia alphabet gml export. it has a timer, so you can use the keys 2 pressed once = a, twice =b, three times = c, four times = 2. just like entering in numbers to a cell phone. so in this way, you could set up something to catch a number when sent and if within 1 second a second number is pressed, add it to a string... if it gets to whatever a function is, then it can do something with it. i assume basically you'd just need to catch the initial button presses, you would only need a timer if you wanted it to clear the memory if you haven't pressed all buttons for a while (like on a TV, the ones you HAVE to hit the enter key to change channels, if you just hit 1 2, but not enter, it'll clear the "12" and just do nothing).
i'm not sure how well i'm understanding you jove, but i think you just want to use combo-key presses to launch an app. is this more as a security function (like keeping small kids from pressing buttons on the remote and messing something up, or just keeping some people from executing certain things) or is this more so just to expand the number of functions your remote can do via girder (i.e. you ran out of buttons and now need to make combo commands to fit in more things to do).
ds99jove
May 18th, 2004, 12:02 AM
if you are wanting to try and make something yourself, there is the nokia alphabet gml export. it has a timer, so you can use the keys 2 pressed once = a, twice =b, three times = c, four times = 2. just like entering in numbers to a cell phone. so in this way, you could set up something to catch a number when sent and if within 1 second a second number is pressed, add it to a string... if it gets to whatever a function is, then it can do something with it. i assume basically you'd just need to catch the initial button presses, you would only need a timer if you wanted it to clear the memory if you haven't pressed all buttons for a while (like on a TV, the ones you HAVE to hit the enter key to change channels, if you just hit 1 2, but not enter, it'll clear the "12" and just do nothing).
i'm not sure how well i'm understanding you jove, but i think you just want to use combo-key presses to launch an app. is this more as a security function (like keeping small kids from pressing buttons on the remote and messing something up, or just keeping some people from executing certain things) or is this more so just to expand the number of functions your remote can do via girder (i.e. you ran out of buttons and now need to make combo commands to fit in more things to do).
I have BitMonster's Toolkit installed, would that do the trick of inputting numbers? I'm just uncertain on how to proceed and catch the input (some kind of script I guess) and do things depending on what is entered. You might say that I want to look at everything that gets pressed and if at anytime the latest 4 key presses corresponds to XXXX then I want to enable Y.
And yes, exactly I want to keep children from knowing that certain functions exist :)
Grin Reaper
May 18th, 2004, 12:53 AM
You might say that I want to look at everything that gets pressed and if at anytime the latest 4 key presses corresponds to XXXX then I want to enable Y.
And yes, exactly I want to keep children from knowing that certain functions exist :)
well, i think it'd be funny if a kid pressed a button and all of a sudden the lights turn down low, barry white starts playing softly on the stereo, and the round bed starts rotating. and then they ask daddy why that happens :P
as far as the capturing thing, i could try and come up with something, but i'll leave that for the real experts so as i don't confuse you.
Promixis
May 18th, 2004, 07:44 AM
You can do it using anything for input. Here is a lua function that lets you build a string from any kind of input. You can then check if the string equals what you want and then trigger an event. Let me know what you need help with.
--[[
BuildString Script
This script is used to build a character or numerical string. The user calls the BuildStringAddChar
to add characters to the string. The function should be connected to each event to be captuered
from the remote.
By Michael Cumming
Requires WinLuaEx plugin
Usage: BuildStringAddChar (char,timeout,handler, sendontimeout)
ie. BuildStringAddChar ("g",1000,BuildStringTest,1)
char = char to add to the string, a char of "" means call the handler, char == nil means cancel
timeout = timeout to end string collection in milliseconds, only specified on first call, nil never times out
handler = lua function to call when string collection done, tihs only needs to specified on the first call to BuildString
the handler is called with the string as the only parameter
sendontimeout = flag to call handler when timeout reached, nil = no, non nil = yes
returns nil if not succesful
NOTE: the timeout,handler,sendontimeout arguments need only be sent on the first call, they are
ignored on all other calls.
--]]
-- Only one global BSData, a table
function BuildStringAddChar (char,timeout,handler,sendontimeout)
local err
if not BSData then
if not handler then
return nil
end
BSData = {["string"] = "", ["timeout"] = timeout, ["handler"] = handler,["sendontimeout"] = sendontimeout }
end
if not char then -- cancel
if BSData.timer then
BSData.timer.Destroy ()
end
BSData = nil
return 1
end
if char == "" then -- send
BSData.handler (BSData.string)
if BSData.timer then
BSData.timer.Destroy ()
end
BSData = nil
return 1
end
if BSData.timeout then
if BSData.timer then
BSData.timer.Destroy ()
end
BSData.timer = TIMER_CreateObject ()
err = BSData.timer.Create ("","BuildStringTimeout ()","",0)
if err then
print ("Timer create error ",err)
return nil
end
BSData.timer.Arm (timeout)
end
BSData.string = BSData.string .. char
return 1
end
function BuildStringTimeout ()
if BSData.sendontimeout then
BSData.handler (BSData.string)
end
BSData.timer.Destroy ()
BSData = nil
return 1
end
function BuildStringTest (s)
print (s)
end
ds99jove
May 19th, 2004, 01:22 PM
Thank you Mike C, this seems perfect for wat I need :) I'm new to scripting in Girder however, so some of these questions might be very basic, but how do I connect this script to pressing a button? For example, BitMonster's Toolkit contains all the number buttons on the remote, a script is executed which lets you select 'A','B'..'1' etc when button 1 is pressed. How do I take the result from that script and pass it along to BuildStringAddChar() ?
Promixis
May 19th, 2004, 01:30 PM
First, when Girder loads, you need to execute any command that contains a script to initialize it. Then you will need to find where in BitMonsters tools to send the character or number to buildstring. I haven't used his tools so I don't where you would do this - I don't even know if you really need them for this. The easiest way to begin with this might be using the Diamond key plugin to play with building and testing strings....
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.