Jump to content
Sign in to follow this  
toolauto

new on autoit... please help me

Recommended Posts

toolauto

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

Share this post


Link to post
Share on other sites
Kidney

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())

Share this post


Link to post
Share on other sites
toolauto

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

;)

Share this post


Link to post
Share on other sites
somdcomputerguy

These functions - ControlCommand (hint: with GetSelected parameter), and _IsPressed, and ClipPut, may be useful here.


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

Share this post


Link to post
Share on other sites
toolauto

i can not start from anything

Please help me somdcomputerguy

Share this post


Link to post
Share on other sites
somdcomputerguy

Please help me somdcomputerguy

Well OK, but don't hold your breath waiting.


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

Share this post


Link to post
Share on other sites
czardas

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.

Share this post


Link to post
Share on other sites
Mechaflash

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


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
toolauto

Thanks somdcomputerguy ;)

Could you edit how to auto copy something :) and don't work 1 time, work longer time ....

Thanks again :)

Share this post


Link to post
Share on other sites
toolauto

can that code be edited with hotkeyset : copy function to left mouse ?

paste the clipboard with next click ?

Anything idea ?

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
toolauto

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 :)(

Share this post


Link to post
Share on other sites
somdcomputerguy

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. ;)

  • Like 1

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

Share this post


Link to post
Share on other sites
toolauto

I will try more and i will comeback . okay ;)

Share this post


Link to post
Share on other sites
somdcomputerguy

The Forum and this great community will be here. ;)

  • Like 1

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

Share this post


Link to post
Share on other sites
toolauto

;)( 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 :)

Share this post


Link to post
Share on other sites
Mechaflash

Post your code and any errors.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
toolauto

#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 :)

Share this post


Link to post
Share on other sites
Mechaflash

#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).

#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 :)

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?

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×