Jump to content

Recommended Posts

Posted

Hello everyone

I'm creat a autoit file, i want to auto copy to clipboard when i select them

after 5 or 10 sec, it will automatic paste where my mouse click

i used this code, but it not work

#include <GuiConstants.au3>
Dim $Start
HotKeySet("{F8}","Pause")
HotKeySet("{F9}","Start")
While 1
    Sleep(50)
WEnd
Func Start()
    $Start = NOT $Start
    If $Start Then ToolTip('Press (F8) to Pause',0,0)
    $start = TimerInit()
    While $Start
        If TimerDiff($start) > 2000 Then
            Send("{ENTER}")
            Sleep(50)
            Send("^v")
            Sleep(50)
            Send("{ENTER}")
            $start = TimerInit()
        EndIf
    WEnd
    ToolTip("")
EndFunc
Func Pause()
    ToolTip('Press (F9) to Start',0,0)
    While 1
        Sleep(50)
    WEnd
EndFunc

Please help me

Posted

Declare $Start as False before the function. I would also change the While $Start to: While $Start = True

And it also will only send the clipboard to wherever you click, not where your mouse is hovering at.

A safer way to send the clipboard is to do: Send(clipget())

Posted

i think this code is fail

i want to auto copy to clipboard when i select them

it will automatic paste where my mouse click after that

;)

Posted

What somdcomputerguy is saying is make an effort to use these functions. If you are not sure where to start run the examples in the help file and then try and figure out how you might adapt the examples to suit your needs. If you get stuck then post your efforts. Also, without knowing the control you wish to copy from it is tricky to know what would be the best solution.

Posted

  On 6/4/2012 at 2:12 PM, 'czardas said:

What somdcomputerguy is saying is make an effort to use these functions. If you are not sure where to start run the examples in the help file and then try and figure out how you might adapt the examples to suit your needs. If you get stuck then post your efforts. Also, without knowing the control you wish to copy from it is tricky to know what would be the best solution.

or before Mechaflash creates some obfuscated code for you XD

  Reveal hidden contents

 

Posted (edited)

Ya, that is partially what I meant. It usually takes me quite a while to come up with actual working code. Also, as czardas said, it'd be kinda tough to come up with something that would work for you since nobody (maybe even you!) knows just what you want. But try this code. Some notes first though:

1. Select the appropriate text and use CTRL-C to copy it. I ran into some complications with ControlCommand. That function would be fine using CTRL-A to select, but a click-drag or Shift-Arrow doesn't work out, as only one character at a time is selected..

2. Use ALT-TAB to switch to the app you want to paste into. Don't click! Once you copy, the next click will start the paste.

#include <Misc.au3>

Opt("SendKeyDelay", 50)

$dll = DllOpen("user32.dll")

ClipPut("")

While 1
    ToolTip(" Copy Something ")
    If ClipGet() <> "" Then ExitLoop
    Sleep(10)
WEnd

While 1
    ToolTip(" Click to paste ")
    If _IsPressed("01", $dll) Then
        ToolTip("")
        Send(ClipGet())
        Exit
    EndIf
    Sleep(10)
WEnd

This should get you started, and you can click on a function in the code above to load the online doc's page. F1 in SciTE does the same (though with the local help file).

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted

  On 6/4/2012 at 7:32 PM, 'JLogan3o13 said:

Hi, toolauto, here's an idea - TRY IT ;) Take what somdcomputerguy has generously given you, and try it out with the functions you're asking about.

:) i've tried till now. but i can not fix this code :)(

Posted

Showing what you've tried will go a lot further than saying that you've tried. The only editing I would do to that snippet above would be to add comments. Maybe I should've done that in the first place, but the code as it is shouldn't be hard to follow.

Read thru the Help file once or twice or a hundred times. Especially the first few sections - Using AutoIt, Tutorials, and Language Reference. There's some other very helpful tutorials here, just search on that word - tutorial.

I hope you don't take this except as how I mean it - sincerely. ;)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Posted

;)( i can't edit :)(

everything's error .

i don't know how to repeat that funtion again and again......

how must i do now ? I've tried my best :)

Posted

Post your code and any errors.

  Reveal hidden contents

 

Posted

#include <Misc.au3>
Opt("SendKeyDelay", 50)
$dll = DllOpen("user32.dll")
ClipPut("")
While 1
    ToolTip(" Copy Something ")
    If ClipGet() <> "" Then ExitLoop
    Sleep(10)
WEnd
While 1
    ToolTip(" Click to paste ")
    If _IsPressed("01", $dll) Then
        ToolTip("")
        Send(ClipGet())
        Exit
    EndIf
    Sleep(10)
WEnd

i used somdcomputerguy but i don't know how to repeat copy , paste again and again ;)

thanks all :)

Posted

  On 6/4/2012 at 4:38 PM, 'somdcomputerguy said:

  Reveal hidden contents

This should get you started, and you can click on a function in the code above to load the online doc's page. F1 in SciTE does the same (though with the local help file).

  On 6/5/2012 at 6:48 PM, 'toolauto said:

  Reveal hidden contents

i used somdcomputerguy but i don't know how to repeat copy , paste again and again ;)

thanks all :)

You posted exactly what somdcomputerguy gave you for a starting point. Edit your code to do what you need, if it doesn't work, post what you've done here with any errors. Laziness is unacceptable... i mean... you're already sitting on your butt not doing physical labor. How much more laziness do you need?
  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...