Results 1 to 17 of 17

Thread: pasting into different app

  1. #1

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    is there a way i can paste the contents of a text box into the last app i was in (such as internet explorer)?

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    You can move the text of a TextBox into the clipboard by doing this :

    Clipboard.SetText Text1.Text

    You can then switch to your other application and do a Ctrl-V to put it in there.

    What you *can't* do is tell which application was active BEFORE you switched to this one... because that sort of information isn't kept.

    You *can* however get a list of applications currently running and then using the handle of the window it is in force that application to receive a "Ctrl-V" keypress effectively making it paste the clipboard contents into whatever has the current focus.... But you cannot change its focus.

  3. #3

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    well, can you ever tell which app is active?
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  4. #4
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    You can tell what the active window is using API calls... but if you switch between that app and your program then your program is now the active application...

    The moment you type text into the textbox it is the active application

    The moment you click a button it is the active application.

    All you can do is have your application run in the background, get something else in front of it and then run your commands.

  5. #5

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    k, if you can tell what's running before you goto your program, then can't you 'log' it and then use some sort of command to paste something into it?
    i've seen a program that can do this, thought it'd be a really nice addition to my clipboard program
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  6. #6
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    k, if you can tell what's running before you goto your program, then can't you 'log' it and then use some sort of command to paste something into it?
    But you can't tell what was running before you go to your program. YOU know what it was because you were using it... but your program has no idea because all you did was tell Windows to stop using THAT application and start using YOUR application.

    i've seen a program that can do this, thought it'd be a really nice addition to my clipboard program
    What was the program called?

  7. #7

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133

    But you can't tell what was running before you go to your program.

    You can tell what the active window is using API calls...
    a bit of ambiguity running around there...

    here's a link to the program i was talking about, does a lot of clipboard stuff
    http://www.cliptrakker.com/cliptrak.htm
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  8. #8
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Hello CWM!

    I done something like this before and similar to Generation X.

    Send the data you want to the clipboard like the way he had it.

    Next, if you know the application you want to switch to, use "Appactivate" and the application name. To get the application name, hit Control-Alter-Delete. Get that name and use it with "Appactivate". You don't have to type the entire name in, it will find the nearest match.

    Anyway, if you just want the last application, use "Sendkeys". Something like this:

    Sendkeys "%+{Tab}",True

    This method is case sensitive (must use with Uppercase to work properly). The above line means Alter-Shift-Tab.

    Then do a paste:

    Sendkeys "^{V}",True

    Anyway, Hope you got the picture.

    Chemically Formulated As:
    Dr. Nitro

  9. #9
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    CWM... your obviously not reading the fine print here

    a bit of ambiguity running around there...
    Not at all.

    You can't tell what was running BEFORE you switch to your program... but you CAN tell what is CURRENTLY the active window...

    This means that you can have your application running in the background and it can "poll" the system to find out what the active window is, but the moment you make your application the Active application that information is LOST.

    What you cannot do :

    - Load Internet Explorer
    - Switch to your program
    - Type something in a text box
    - Have it appear in Internet Explorer

    What you can do :

    - Load Internet Explorer
    - Switch to yuor program
    - Type something in a text box
    - Get a list of applications currently in memory
    - Pick one and have it brought to focus and the clipboard
    pasted to it.

    Note that it will try to paste it into whatever has focus at that time... it could be a form field, the address area or highlighted over an image.

    I hope that makes sense... you just need to try and visualise what is happening to understand it.

  10. #10

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    ok, like i said before, if you know what's running right now, why can't you log it and switch back to it later.

    example:

    i have microsoft internet exploiter running in the foreground
    my dumbass of a program polls to see what's in the foreground
    my dumbass of a program says to my dumbass of a text box "hey, this window is running right now, remember that, would yu?"
    my dumbass textbox nods and says "OK"
    i click on my dumbass of a program
    my dumbass of a program says "Hey, i'm active, i'm not talking to that dumbass of a textbox anymore"
    my dumbass of a textbox says "fine, you were a dumbass anyway"

    so, in this dumbass of a textbox we have the last app that was running, no?

    hey, nitro, the %+{TAB} doesn't work, good idea though =P
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  11. #11
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    2 problems with your "dumbass" program

    1. Polling too often
    If your application polls every say 5 seconds then you will significantly slow down your entire system by constantly asking it what is currently running.

    2. Polling too late
    You could switch to an application and then switch to another before it got a time to "remember" where you were.



    But if you know how to do that... why haven't you tried??!?!

  12. #12

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    you're the one that put the idea in my haead, i started programming.. uh.. what day is it?
    well, anyway, not long ago...
    wanna tell the dumbass programmer how to tell my dumbass program how to poll?

    btw, do you have icq? i want someone on my list that knows vb =(
    http://thedam.com/cwm/ClipboardSaverS.exe
    there's my program... give it a look, pretty handy (clipboard stuff)
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  13. #13
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    but you could try this:

    give your application a hotkey?
    make it just a macro?
    then when you press CTRL+SHIFT+R it pastes what you want into the text box of the active application.

    the project i am trying to achieve is the opposite of this,
    i am working on it, to help blind people??
    it takes all the text in the active application, and hopefully speaks it out via speakers.

    the only problem:
    i can't figure out how to get active text...

  14. #14
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    You probably know this already, but I am just helping.

    Have you look into SelText, StartText and etc...


    Chemically Formulated As:
    Dr. Nitro

  15. #15

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133

    give your application a hotkey?
    make it just a macro?
    then when you press CTRL+SHIFT+R it pastes what you want into the text box of the active application.
    dood, that is SO what i want to do... but i'm a dumbass, i can't figure hotkeys out =(

    would anyone make me a small program that set up ctrl+shift+1 and ctrl+shift+2 paste the contents of text1 and text2, respectivly?
    if i could get someone to do that i know i could figure hotkeysout... i've been trying for three days strait to do it =\
    Generic vb 5

    Private Sub WakeMyAssUp( As Boolean)
    If Then : = False
    End Sub

  16. #16

    Thread Starter
    Addicted Member cwm's Avatar
    Join Date
    Mar 2000
    Posts
    133
    *squeek* please? =(

  17. #17
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    search vb-world for "hotkey"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width