Jump to content

MultiClip


 Share

Recommended Posts

I have a pretty good start on this one already, and without any help! :)

This part is working pretty good so far...

Dim $clip1
; Dim $clip2
; Dim $clip3
; Dim $clip4

; Escape key to end script.
HotKeySet("{ESC}", "Terminate")
; Look for Alt + 1 keystroke.
HotKeySet("!1", "ShowClip1")

; Ask for text for clipboard #1.
$clip1 = InputBox("MultiClip", "Enter/Paste text for the Alt + 1 clipboard", "" )
   If @Error = 1 Then
    MsgBox(0, "MultiClip", "OK... C-ya!")
     EndIf
   
; Run a loop to keep script alive?
While 1
    Sleep(100)
WEnd

; Show Clip #1
Func ShowClip1()
    MsgBox(0, "MultiClip", "Clipboard text for Alt + 1 is: " & $clip1)
EndFunc

Func Terminate()
    Exit 0
EndFunc

I don't want any help on writing the script, but I have some questions as to how and why some of this works, if anybody would like to explain...

1) To Dim a variable: Since I'm eventually going to make an array of variables, am I correct to Dim them? I'm not clear on why or why not to Dim.

2) Run a loop to keep script alive?: Without this code the script quits right after I enter the MsgBox text. What is the "1" operator in the While statement? How is this looping? How is the script able to run anything outside of the While - WEnd loop?

3) Func's: Do Functions need to be placed in a particular area or order in the script, or can they go just about anywhere and still work?

4) INI: Can AutoIt write and append an ini file?

I'm excited to get this script done, I actually have a need for it that I never knew I needed until I realized that it could be done.... thanks again to AutoIt! :)

-Scott

Link to comment
Share on other sites

I have a pretty good start on this one already, and without any help!  :)

This part is working pretty good so far...

Dim $clip1
; Dim $clip2
; Dim $clip3
; Dim $clip4

; Escape key to end script.
HotKeySet("{ESC}", "Terminate")
; Look for Alt + 1 keystroke.
HotKeySet("!1", "ShowClip1")

; Ask for text for clipboard #1.
$clip1 = InputBox("MultiClip", "Enter/Paste text for the Alt + 1 clipboard", "" )
   If @Error = 1 Then
    MsgBox(0, "MultiClip", "OK... C-ya!")
     EndIf
   
; Run a loop to keep script alive?
While 1
    Sleep(100)
WEnd

; Show Clip #1
Func ShowClip1()
    MsgBox(0, "MultiClip", "Clipboard text for Alt + 1 is: " & $clip1)
EndFunc

Func Terminate()
    Exit 0
EndFunc

I don't want any help on writing the script, but I have some questions as to how and why some of this works, if anybody would like to explain...

1) To Dim a variable: Since I'm eventually going to make an array of variables, am I correct to Dim them?  I'm not clear on why or why not to Dim.

2) Run a loop to keep script alive?: Without this code the script quits right after I enter the MsgBox text.  What is the "1" operator in the While statement?  How is this looping?  How is the script able to run anything outside of the While - WEnd loop?

3) Func's: Do Functions need to be placed in a particular area or order in the script, or can they go just about anywhere and still work?

4) INI: Can AutoIt write and append an ini file?

I'm excited to get this script done, I actually have a need for it that I never knew I needed until I realized that it could be done.... thanks again to AutoIt!  :)

-Scott

<{POST_SNAPBACK}>

1) Dim'ing a variable declares it. Let me see if I can find something a bit more on that.

2) Yes run your code in a loop to keep it alive. The "1" operator in the while statement could be any non zero number as stated in the helpfile. It bascially just says

While "this is true"
   Do this
WEnd

To exit a loop you use ExitLoop. Look it up in the help file. You would probably also need to use an If statement to check that you really want to exit. Functions is also a way to allow script to run outside of the loop, but as soon as the end of the function is done it comes back to the loop.

3) Functions can work anywhere in a script, though it is common to have them at the bottom for organization purposes. I also like to have them in order of appearance for ease of finding the right function.

4) Yes AutoIt can read and write and append INI files. Look it up in the helpfile.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

1) Dim is a good choice, but has limits. You can use local for just inside functions etc, so the variables will work within the boundary of the function etc. Global covers all areas.

2) The script stops at the inputbox and waits for your response. You can also use the the set hotkeys while the inputbox is waiting for you. If you respond to the inputbox, the script will enter the endless loop, as it will never find the 1 that you have set. If the loop was not in your script, it would go straight through, to the end of the script, line by line. The loop is there, so you can continue using the hotkey that you have.

3) Functions can be anywhere. They do not run until called upon.

4) Sure can. :)

Link to comment
Share on other sites

Thanks MHz!

That makes a lot of sense now.

I have one more question that I've been stuck on for awhile now.

Is there an alternative to the Send function that will 'paste' the text to a window without the slow typing format?

I have looked through the help file quite a bit for this.

-Scott

Link to comment
Share on other sites

Might look up the Control*() functions. ControlSend() might help. I am not sure though. I havent tried it personally. I have never had send type slow it has always typed almost faster than I could see. How slow is it going?

Look at the AutoItSetOption() there is some stuff in there for the length of keystrokes. Hint: (SendKeyDelay)

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Might look up the Control*() functions. ControlSend() might help. I am not sure though. I havent tried it personally. I have never had send type slow it has always typed almost faster than I could see. How slow is it going?

Look at the AutoItSetOption() there is some stuff in there for the length of keystrokes. Hint: (SendKeyDelay)

JS

<{POST_SNAPBACK}>

Thanks JS,

What I guess I'm looking for is a Doc_Write sort of function, but there doesn't seem to be one.

This script is going to simulate the windows clipboard, except only raw text.

I am planning to have 6 HotKeys to use as clipboard - paste.

I suppose I could make due with a speeded up Send function and just be patient while it's typing out a paragraph of text.

Send("" & $clip1, Opt("SendKeyDelay", 1))

Is it possible to have two options with the Send function?

I will need to have the "flag = 1, keys are sent raw" option along with the "SendKeyDelay" option. So far I have not found syntax that works for that.

-Scott

Link to comment
Share on other sites

Little mistake in your code...It should be as follows.

Opt("SendKeyDelay", 1)
Send("" & $clip1)

The option also only has to be done once at the beginning of a script. Why not just use the clipboard with ClipPut() and ClipGet()?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Little mistake in your code...It should be as follows.

Opt("SendKeyDelay", 1)
Send("" & $clip1)
So to add the Raw Keys flag to the Send function I would...

Opt("SendKeyDelay", 1)
Send("" & $clip1, 1)

...? The help is not super clear on how to use that.

The option also only has to be done once at the beginning of a script. Why not just use the clipboard with ClipPut() and ClipGet()?

JS

<{POST_SNAPBACK}>

ClipPut() and ClipGet() only go back and forth to the clipboard, I would still need a Send (type) of function to write the text to a window.

Grantid I could use hot keys to juggle variables in and out of the clipboard, but I would still need to paste from the clipboard to the window.... too many keystrokes.

My goal is to be able to hit #1 (as I found !1 isn't going to work) and have a pre-loaded block of text 'paste' into any text window. Once I'm able to do that, the pre-loading part can be done a number of ways.

-Scott

Link to comment
Share on other sites

So to add the Raw Keys flag to the Send function I would...

Opt("SendKeyDelay", 1)
Send("" & $clip1, 1)

...?  The help is not super clear on how to use that.

ClipPut() and ClipGet() only go back and forth to the clipboard, I would still need a Send (type) of function to write the text to a window.

Grantid I could use hot keys to juggle variables in and out of the clipboard, but I would still need to paste from the clipboard to the window.... too many keystrokes.

My goal is to be able to hit #1 (as I found !1 isn't going to work) and have a pre-loaded block of text 'paste' into any text window.  Once I'm able to do that, the pre-loading part can be done a number of ways.

-Scott

<{POST_SNAPBACK}>

As far as teh Send() goes that looks to be correct to me. That will send raw text, which is what it seems you want though below I hope to show there is no need for a send of such large amounts of text and it doesnt have to be raw :).

I see... my mistake. Except there is a way around everything and I just came up with a way to use ClipGet() and ClipPut() to help you and it will do it instantly.

What you do is you have your values in a variable such as in the code below.

Dim $lotsoftext;Many paragraphs of text for your purpose.

HotKeySet("{ESC}", "mExit")
HotKeySet("!1", "SClip1")
HotKeySet("!2", "SClip2")
HotKeySet("!3", "SClip3")

While 1
   Sleep(100)
WEnd

Func SClip1()
;use the INI read and write to get your variables to and from for the $lotsoftext var.
   ClipPut($lotsoftext)
   Send("^v")
End Func

Func SClip2()
;use the INI read and write to get your variables to and from for the $lotsoftext var.
   ClipPut($lotsoftext)
   Send("^v")
End Func

Func SClip3()
;use the INI read and write to get your variables to and from for the $lotsoftext var.
   ClipPut($lotsoftext)
   Send("^v")
End Func

Func mExit()
   Exit
End Func

If we can get a HotKeySet() to accept a Func(value) then you wouldnt require so many functions, but for now that is the way I would do it.

Edit: Fixed some spacing, odd it didnt work. Jon I think you might want to know this. Up where I Dim the variable and then I add a comment. It wont let me put a space between the variable and the comment.

I hope this helps some,

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Edit: Fixed some spacing, odd it didnt work. Jon I think you might want to know this. Up where I Dim the variable and then I add a comment. It wont let me put a space between the variable and the comment.

I just noticed the same comment spacing in a post by CyberSlug here.

I figured it was just quick typing, but there may be a good reason he doesn't space before a comment....?

I hope this helps some,

JS

<{POST_SNAPBACK}>

Very clever!

I'll have to play around with that.

I'm planning to use an ini, but I still require it to be semi fluid where I can quickly copy in new text for any of the keys. There is a ton of possibilitys on how to do this. I was drawing it out on paper last night exactly how it would work best for me, and still ended up with multiple ways to both enter the text and expung it.

Pasting repetitive web code into online site builders is the final use for this, thats why I need the raw keys format if I use Send (or else it may convert charactors into file commands while outputting).

Basically I have 6 different versions of web code that need to be determined by me which goes where in various places of online site builders. I've been doing this for months now, copying and pasting from a text file with all 6 lined up.... this will be a carpal tunnel saver for me!

Thanks for the help I didn't want, but will gladly accept because I would never have thought of that! :)

-Scott

Link to comment
Share on other sites

Yea sorry for giving you the source, as I knew you wanted to script it yourself, but I saw it as the only way to really explain what I meant. Re-write it. :) I do that with everything. Such as Larry and ezzetabi's search scripts. I didnt want to use theirs so I wrote my own. :)

I am also working on writing my own window hiding script, and I am writing a scheduling script for opening and closing programs for my wife's work on a daily basis. I am also working on a spyware automation tool that will install the 3 best spyware solutions on a computer. Once I get on GUI that one will be completed as I want the user to have the option of selecting which ones are installed.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

I am also working on a spyware automation tool that will install the 3 best spyware solutions on a computer. Once I get on GUI that one will be completed as I want the user to have the option of selecting which ones are installed.

JS

<{POST_SNAPBACK}>

I was just thinking about writing one of those also...

I do a fair amount of PC support for people and always seem to be grabbing a dozen cd's with my latest backups so I can run Adaware, Spybot, AVG, F-prot, Winpatrol, ZA, Mozilla, and a slew of other apps to take care of the nasty bugs people tend to become prey to.... especially hijacks! (Seen a lot of those lately, and they are a pain!)

Not to mention Winzip, IM apps, picture viewers/editors, and all the handily required tools to get anything done these days.

Have you tried CyberSlug's AutoBuilder GUI to make GUI's?

-Scott

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