Page 1 of 1

Is fnxBasic a tool to control applications?

Posted: Fri Nov 09, 2007 10:20 pm
by Lifefree
I think it would be suitable to manage applications but it lacks a function like SendKeys to control another windows.
Could that function easily be included in the language? May be this is enough for this goal. Is the only one I miss.

cbrescia

Is fnxBasic a tool to control applications?

Posted: Tue Dec 11, 2007 4:35 pm
by Marco
Hi, I think you could use this api call I guess you must some experiments with the code below.
Best regards



const KEYEVENTF_KEYUP = &H2 ` Release key
const VK_LBUTTON=&h01 `Left mouse button.  
const VK_RBUTTON=&h02 `Right mouse button.  
const VK_CANCEL=&h03 `Used for control-break processing.  
const VK_MBUTTON=&h04h `Middle mouse button (3-button mouse).  
const VK_BACK=&h08  
const VK_TAB=&h09  
const VK_CLEAR=&h0C  
const VK_RETURN=&h0D  
const VK_SHIFT=&h10  
const VK_CONTROL=&h11  
const VK_MENU=&h12 `= alt key  
const VK_PAUSE=&h13  
const VK_CAPITAL=&h14  
const VK_ESCAPE=&h1B  
const VK_SPACE=&h20  
const VK_PRIOR=&h21 `Page up.  
const VK_NEXT=&h22 `Page down.  
const VK_END=&h23  
const VK_HOME=&h24  
const VK_LEFT=&h25  
const VK_UP=&h26  
const VK_RIGHT=&h27  
const VK_DOWN=&h28  
const VK_SELECT=&h29  
const VK_INSERT=&h2D  
const VK_DELETE=&h2E  
const VK_HELP=&h2F  
const VK_0=&h30  
const VK_1=&h31  
const VK_2=&h32  
const VK_3=&h33  
const VK_4=&h34  
const VK_5=&h35  
const VK_6=&h36  
const VK_7=&h37  
const VK_8=&h38  
const VK_9=&h39  
const VK_A=&h41  
const VK_B=&h42  
const VK_C=&h43  
const VK_D=&h44  
const VK_E=&h45  
const VK_F=&h46  
const VK_G=&h47  
const VK_H=&h48  
const VK_I=&h49  
const VK_J=&h4A  
const VK_K=&h4B  
const VK_L=&h4C  
const VK_M=&h4D  
const VK_N=&h4E  
const VK_O=&h4F  
const VK_P=&h50  
const VK_Q=&h51  
const VK_R=&h52  
const VK_S=&h53  
const VK_T=&h54  
const VK_U=&h55  
const VK_V=&h56  
const VK_W=&h57  
const VK_X=&h58  
const VK_Y=&h59  
const VK_Z=&h5A  
const VK_NUMPAD0=&h60  
const VK_NUMPAD1=&h61  
const VK_NUMPAD2=&h62  
const VK_NUMPAD3=&h63  
const VK_NUMPAD4=&h64  
const VK_NUMPAD5=&h65  
const VK_NUMPAD6=&h66  
const VK_NUMPAD7=&h67  
const VK_NUMPAD8=&h68  
const VK_NUMPAD9=&h69  
const VK_MULTIPLY=&h6A  
const VK_ADD=&h6B  
const VK_SEPARATER=&h6C  
const VK_SUBTRACT=&h6D  
const VK_DECIMAL=&h6E  
const VK_DIVIDE=&h6F  
const VK_F1=&h70  
const VK_F2=&h71  
const VK_F3=&h72  
const VK_F4=&h73  
const VK_F5=&h74  
const VK_F6=&h75  
const VK_F7=&h76  
const VK_F8=&h77  
const VK_F9=&h78  
const VK_F10=&h79  
const VK_F11=&h7A  
const VK_F12=&h7B  
const VK_F13=&h7C  
const VK_F14=&h7D  
const VK_F15=&h7E  
const VK_F16=&h7F  
const VK_F17=&h80  
const VK_F18=&h81  
const VK_F19=&h82  
const VK_F20=&h83  
const VK_F21=&h84  
const VK_F22=&h85  
const VK_F23=&h86  
const VK_F24=&h87  

declare keybrd as "keybd_event" of "user32"
  bVk As Byte
  bScan As Byte
  dwFlags As Long
  dwExtraInfo As Long
end declare

sub keydown(key as integer)
keybrd.bvk=key
keybrd.dwExtraInfo=0
keybrd
end sub

sub keyup(key as integer)
     keybrd.bvk=key
     keybrd.dwExtraInfo=KEYEVENTF_KEYUP
     keybrd
end sub
``================= end declaration
``example
shell("c:windows
otepad.exe","",1)``startup notepad
sleep 500`` wait
keydown(65)``65 is a to get an A fou must use the vk_shift first




Is fnxBasic a tool to control applications?

Posted: Thu Nov 13, 2008 1:45 pm
by Lifefree
Can all the previous code be included in the new version as a SendKeys() built-in function? The work is already almost done.
Regards

Is fnxBasic a tool to control applications?

Posted: Thu Nov 13, 2008 4:41 pm
by Marco
Hi how does the sendkey must function because there must be a key down and a key up function otherwise the shift and alt and ctrk can not be used?
best regards
I ve found it I try to add it seems a useful function.
rgds again