Jump to content

new on autoit... please help me


Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.”

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Moderators

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.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.”

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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