FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Auto insert data
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Auto insert data
Posted: Wed May 31, 2006 05:09 PM

Hi Everybody,

I am trying to find a way to create a macro for the end user of my application.

I would like to have them do someting like press F5 and have the text "HELLO" inserted into a get.

Any Ideas?

Thanks,
Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Auto insert data
Posted: Wed May 31, 2006 07:33 PM
Try something like this

POSTSTRING( oGet:hWnd, "HELLO" )

where POSTSTRING() is:

FUNCTION POSTSTRING( hWnd, cString )

    LOCAL i, c

    DEFAULT hWnd := GETACTIVEWINDOW()

    FOR i = 1 TO LEN( cString )
        c = SUBSTR( cString, i, 1 )

        IF c > " "
            POSTMESSAGE( hWnd, WM_CHAR, ASC( c ) )
        ELSE
            POSTMESSAGE( hWnd, WM_KEYDOWN, ASC( c ) )
        ENDIF

        SYSREFRESH()
    NEXT

    RETURN NIL


EMG
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Auto insert data
Posted: Wed May 31, 2006 08:09 PM

Or, you can try oGet:paste("Hello")

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Auto insert data
Posted: Wed May 31, 2006 08:44 PM

Much simpler. The only drawback is that it alters the clipboard, if I'm not wrong.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Auto insert data
Posted: Wed May 31, 2006 11:04 PM

Enrico,

>Much simpler. The only drawback is that it alters the clipboard, if I'm not wrong.

I don't believe so. If cText is NOT passed then it pastes from the clipboard, but if cText is passed, then cText is used instead. Either way the clipboard is left as is.

It also handles numeric and date types in addition to string.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Auto insert data
Posted: Thu Jun 01, 2006 02:13 AM

Thanks James and Enrico.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion