Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Controller Xbox360

Post any examples or modules that you want to share here

Controller Xbox360

Postby Almeida » Fri Jul 05, 2013 11:55 am

Hi,

I would like programming xbox controller with code like AHK (AutohotKey)
but i'm not used to code with Ruby. Can u help me to assign Button A to F1 function ?

If you have any documentation about programming controller, i will appreciate it !

Many thx !
Attachments
xbox360.fsm
(25.21 KiB) Downloaded 1547 times
Almeida
 
Posts: 10
Joined: Wed Jun 12, 2013 12:43 pm

Re: Controller Xbox360

Postby MyCo » Fri Jul 05, 2013 4:57 pm

Here are two modules that send key status messages to the current active window. It uses win32Api, which is a little bit hard to read. Check the FS user guide (page 198-201)
Attachments
key strokes (MyCo).fsm
(26.64 KiB) Downloaded 1650 times
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Controller Xbox360

Postby Almeida » Fri Jul 05, 2013 6:55 pm

working great. Thanks.
Almeida
 
Posts: 10
Joined: Wed Jun 12, 2013 12:43 pm

Re: Controller Xbox360

Postby MyCo » Fri Jul 05, 2013 7:00 pm

0x70 is just hexadecimal, you can use the windows calculator to convert it into decimal, or just use an online converter like this:
http://www.rapidtables.com/convert/numb ... ecimal.htm

Or you can use FS "hex to dec" primitive

Edit: Looks like you found your answer already ;)
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Controller Xbox360

Postby Almeida » Fri Jul 05, 2013 7:10 pm

yes i found it finally but can help other ! thx
Almeida
 
Posts: 10
Joined: Wed Jun 12, 2013 12:43 pm

Re: Controller Xbox360

Postby Almeida » Fri Jul 05, 2013 9:47 pm

i have some code in AHK which move window at some position X,Y on the screen when i push Right on my keyboard

Right::
WinGetActiveTitle, Title1
WinMove, %Title1%,, 938, 10

then do you think it' s possible to do the same with Flowstone?

Cause have already link Right of 360xbox to send "Right" but its not read by AHK when both are open ( AHK & Flowstone)
Almeida
 
Posts: 10
Joined: Wed Jun 12, 2013 12:43 pm

Re: Controller Xbox360

Postby MyCo » Fri Jul 05, 2013 9:56 pm

It can be done with 2 other WinApi functions (GetActiveWindow and SetWindowPos). I'll have a look at this tomorrow, or maybe someone else is faster than me ;)
User avatar
MyCo
 
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany

Re: Controller Xbox360

Postby digitalwhitebyte » Sat Jul 06, 2013 1:02 am

this is an example of code to define the size and position of the window.

Code: Select all
require 'Win32API'

def event i

# winapi GetSystemMetrics
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms724385(v=vs.85).aspx
# get current windows size
screen_width = Win32API.new("User32.dll","GetSystemMetrics",["L"],"L").call(0)
screen_height = Win32API.new("User32.dll","GetSystemMetrics",["L"],"L").call(1)

# winapi FindWindow
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms633499(v=vs.85).aspx
findWindow = Win32API.new('user32', 'FindWindow', ['P','P'], 'L')
# define your windows name here
windows_name =  'FlowStone - [Schematic1*]'
hWnd = findWindow.call(0, windows_name)

# winapi SetWindowPos
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx
setWindowPos = Win32API.new("user32.dll", "SetWindowPos", ['I','I','I','I','I','I','I'], 'I')

# Struct SetWindowPos
# set windows size when moved (this is one of many options)
cx = 1024
cy = 768
posX = (screen_width/2)-(cx/2)
posY = (screen_height/2)-(cy/2)
# see uFlag option
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx
uFlags = 16384

#Call SetWindowPos
return_SetWindowPos = setWindowPos.call(hWnd, -2, posX, posY, cx, cy, uFlags)

watch 'hWnd', hWnd
watch 'returned value from SetWindowPos  call (If the function succeeds, the return value is nonzero.)', return_SetWindowPos
end
User avatar
digitalwhitebyte
 
Posts: 106
Joined: Sat Jul 31, 2010 10:20 am

Re: Controller Xbox360

Postby Almeida » Tue Jul 23, 2013 4:42 pm

This code works fine when i use it in Flowstone but i would like to do this in the current window. I saw someone talk about enumwindows function (http://msdn.microsoft.com/en-us/library ... 85%29.aspx). I didn't find the way to implement it. Can u help me to do this?
Almeida
 
Posts: 10
Joined: Wed Jun 12, 2013 12:43 pm

Re: Controller Xbox360

Postby digitalwhitebyte » Tue Jul 23, 2013 5:12 pm

# define your windows name here
windows_name = 'FlowStone - [Schematic1*]'

in my code you have modify the red contents of this variable to match your app name windows

P.S.
EnumWindows work in conbination of EnumWindowsProc, the current Win32API not support callback.
User avatar
digitalwhitebyte
 
Posts: 106
Joined: Sat Jul 31, 2010 10:20 am

Next

Return to User Examples

Who is online

Users browsing this forum: No registered users and 27 guests