Data transfer via the system keyboard buffer? (VFP9) - keyboard

Using a Visual FoxPro 9 executable file, (EXE), I need to be able to place data into the system keyboard buffer which is then to be picked up by another program, (non-FoxPro). I've already tried using the KEYBOARD command, however, that only seems to work with fields and controls within the FoxPro application! Does anyone have any ideas on how this can be accomplished?

You'll need to call into the Win32 API - keybd_event is probably the call you want as SendInput uses structs, which are a pain in VFP. There's sample code here.

Do you mean to copy to the clipboard? If so, here are two ways. The first example copies a string to the clipboard. The second example copies a table/cursor to the clipboard.
_cliptext = "test"
_vfp.DataToClip(SELECT(ALIAS()), RECCOUNT() + 1, 3)

Related

Using Open instruction in VBA

Is it possible use the "Open" instruction in VBA to work with shared text files?
For example, 2 people sending at same time a command to write in the file.

any programming ways to save variable of program in linux?

I only have one machine and want to save some variable values like a = 3 in linux. I can resume the last progress if power-off suddently happens.
I can only figure out two ways, one is to save in files and the other one is save to DB.
Are there any special ways to do like this without saving in files or db? any programming language is ok.
I guess there is some confusion. Do you want to save the state of your program? If so then use text editor which saves your progress even if you don't save it using ctrl+s, like sublime or gedit. Otherwise please elaborate more on what you want.

IBM Mainframe copy/paste

Disclaimer: I'm new to using Rumba to access IBM Mainframe.
I have currently set up a library for personal use and I have some code that I want to store in a member of this library, how can I copy/paste from a .txt file on my desktop into this program??? As of right now I can successfully copy/paste one line at a time from documents outside of Rumba.
There are various ways. The best one will depend upon the size of the file/amount of data to be transferred.
If it's only a few lines, block copy and paste should work, but you might have to play with Rumba's 'paste' edit settings such as how to handle new lines, etc.
Bigger files can be transferred with the TSO file transfer program indĀ£file (maybe ind$file on your system) which essentially copies a file to the screen and then Rumba 'scrapes' the screen for data to put into a file (this is for a mainframe-to-PC transfer; for going the other way the operation is reversed). This can be surprisingly quick.
Lastly there's FTP - either from the command line or via a program such as WinSCP.
Edit:
Based on your comment that the files are about 300 lines long, I'd look into using Rumba's file-transfer option using the ind$file utility. Once you have the files on one system, speak to your mainframe tech support team about the best way to get them to the other systems.
If you need help uploading the files, then the tech support team should be your first point of call.
What mainframe editor are you running? TSO/ISPF?
I copy and and paste from ".txt" files into ISPS all the time with no problem.
Select the text you want to copy (in the ".txt" file)
Press CTRL-C
Open the mainframe file using ISPF Edit (option 2).
Enter line command "Inn" at the line where where you want the copy to start.
(This inserts "nn" empty lines to receive the copied data. Personally, I usually use "nn"=20)
Position your cursor at the first character of the first empty line.
Press CTRL-V

Lua WinAPI - Read cell from Microsoft Excel

I am trying to read values from cells of a running Excel 2007 document. I am using the WinAPI extension for Lua. I am currently running on a Windows XP computer (if that matters, but it seems the WinAPI works from XP on.
This is my Excel document:
This is my Lua code:
require 'winapi'
w = winapi.find_window_match('Book1') -- Specify the name of the window
w:show() -- Set the visability
w:set_foreground() -- Bring this window to the foreground
handle = w:get_handle() -- Get window handle
t = {} -- Create a table
w:enum_children(function(w) table.insert(t,w) end) -- Enumerate all children
for k,v in pairs(t) do -- Print out all pairs in the table
print("",k,"=",v)
end
This is my Lua code output:
Does anyone know how I recursively should enumerate in order to find each Cell? Or is there a better way to go about this? The text I want is the "1234". I have not done much Windows programming since I prefer Unix, but it seems like I am on the right track. I just don't know how to progress from here!
I doubt that Excel uses a window for each and every cell in the spreadsheet, so trying to get to the cell by navigating the window hierarchy is likely a dead end.
If possible, I'd recommend exporting the data to a common file type, like comma-separated values, and making your program parse that.
Alternatively, you can read about UI Automation, which is how things like screen readers can access the data in a Windows application's UI. I've never done that, but it looks like it might be a lot of work. Nevertheless, I believe it's the most robust, supported method for trying to get data out of a Windows application via its user interface.

Clipboard viewer for programming purposes

I need a clipboard viewer in order to understand the type and contents of the data I'm receiving. Is there any such program available, (for Windows) that lets you explore any type of data currently in the clipboard?
ClipSpy: Unfortunately the only workable multi-format viewer, ClipSpy, shows me the string data wrapped every 10 characters, and expands the hex and binary views which I'm not concerned about.
Start -> Run -> clipbrd
I would use the command-line clipboard tool to send the clipboard contents to a file. Then you view/parse it using any old tool.
I use Ditto which uses an SQL lite database. I am sure you could figure out a way to manipulate the stored data for syntax highlighting or modify the program so that when editing clips it would open with syntax highlighting or in an editor that has it.

Resources