Auto insert data

Auto insert data

Postby Jeff Barnes » Wed May 31, 2006 5: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
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Auto insert data

Postby Enrico Maria Giordano » Wed May 31, 2006 7:33 pm

Try something like this

POSTSTRING( oGet:hWnd, "HELLO" )

where POSTSTRING() is:

Code: Select all  Expand view
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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Wed May 31, 2006 8:09 pm

Or, you can try oGet:paste("Hello")
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Wed May 31, 2006 8:44 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » 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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Wed May 31, 2006 11:07 pm

Ops, you are right!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Thu Jun 01, 2006 2:13 am

Thanks James and Enrico.
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests