Jump to content
Sign in to follow this  
Omga4000

ClipPut Replacment

Recommended Posts

Omga4000

Hey all :mellow:

As you can see, I'm pretty new to AutoIt so I will appreciate if you show some patient with me.

So I simply wrote a code that stops the script whenever I press ESC:

HotKeySet ("{ESC}", "Terminate")
Func Terminate ()
    Exit
EndFunc

I don't want to write this over and over every time I write a new script,

so I was thinking of making a script that will simply copy this to the clipboard.

The problem is "ClipPut" func doesn't allow {} or "Terminate".

What do I do?

Thank you :)

Share this post


Link to post
Share on other sites
Melba23

Omga4000,

I would save the code as an abbreviation within SciTE - then you can call it whenever you need it. I have lots of personal abbreviations added to the standard ones installed with SciTE. :mellow:

Look in the SciTE Help file under <SciTE/AutoIt3 - Abbreviation How To> to see how it is done. There are also some scripts in the Examples forum to help you automate the process, but you will have to search for them. :)

Come back if you run into problems. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Omga4000

I have to admit this is not easy at all.. :mellow:

First - did you mean this?

http://www.autoitscript.com/autoit3/scite/docs/abbrevHelp.htm

What exactly are those abbreviations?

What kind of "orders" can I give them? (Something = ?????)

I assume I can't just write:

hotkey= HotKeySet ("{ESC}", "Terminate")
        Func Terminate ()
          Exit
        EndFunc

What kind of command can I use to terminate the script?

Is there a list of commdand I can add?

And where are all of the example abbreviations?

My file is empty.

I know those are a lot of questions. Feel free to answer only part of them if that's too much..

Thanks a lot!! :)

Edited by Omga4000

Share this post


Link to post
Share on other sites
Melba23

Omga4000,

I have to admit this is not easy at all

Yes it is! :)

That is the correct Help page - so let us go through this slowly and you will soon see how to do it. :)

1. Open the abbreviations file via the <Options - Open Abbreviations File> menu in SciTE. Now you can see all the abbreviations that come with SciTE on installation. All we need to do is add our own - best to do it at the end of the file, so scroll down. The final abbreviation I see is wwna=WinWaitNotActive(|).

2. Now we will add your abbreviation to the list - let us call it hke (short for HotKeyEscape). Add a few blank lines under the final entry in the abbreviations file and type "hke=". Now we need to tell SciTE what to do when it expands the abbreviation, so we type the text we require, using \n for NewLine and \t for Tab. We end up with this:

hke=HotKeySet("{ESC}", "Terminate")\nFunc Terminate()\n\tExit\nEndFunc

3. Now save the file and see what happens when you type hke and then press Ctrl-B. You should get the abbreviation replaced by the text. :mellow:

M23

Edit: Just seen your edit to say that the abbreviations file is empty. Are you using the full SciTE4AutoIt3 package? If not I recommend that you do - lots of extra goodies to help you code in AutoIt. You can download it from here. :)

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Omga4000

You sure do make it simple :mellow:

1. I've opened the file "abbrev.properties" and the file is empty. I see no commands at all there.

2. Done!

3. Works perfectly!! Thank you!!

Melba23 you are a :)

Share this post


Link to post
Share on other sites
Melba23

Omga4000,

Glad I could help. :mellow:

I really do recommend the SciTE4AutoIt3 package - and not because Jos gives me a cut of the royalties. :)

You get a lot of extra utilities to help you code in AutoIt and many of the tips you see in the forum will only work with the full version rather then the cut-down version of SciTE you get with the normal AutoIt install. :)

M23

Edit: Typnig!

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Omga4000

I will check it out as soon as I get back home.

(this, right? http://www.autoitscript.com/site/autoit-script-editor/)

Once again, thank you for the help! :mellow:

P.S

What do I do with my empty file?

Could you send me the full file?

Edited by Omga4000

Share this post


Link to post
Share on other sites
Melba23

Omga4000,

That is the one. You will get the full abbreviation file when you install it. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Omga4000

Alright, so that's one case solved.

Now what do I do if I really need to copy {} to the clipboard?

How do I do that?

Share this post


Link to post
Share on other sites
Omga4000

Well that worked :mellow:

However, this won't work:

ClipPut(""{Terminate}"")

Why won't it work? Why can't I copy quotation marks ("") to clipboard?

Edited by Omga4000

Share this post


Link to post
Share on other sites
smartee

@JohnOne: :mellow:

@Omga4000: If you would like to place data from a file onto the clipboard you may want to have a look at FileRead() too. Something like this maybe

ClipPut(FileRead("HotkeyTemplate.au3"))

Share this post


Link to post
Share on other sites
Omga4000

I would like to add, for example, the word Terminate with quotation mark.

It's not possible with ClipPut for some reason.

Check it out:

ClipPut(""{Terminate}"")

Share this post


Link to post
Share on other sites
smartee

You can, double up on the double quotes or bind them in single quotes like

ClipPut("""{Terminate}""")
or
ClipPut('"{Terminate}"')

Share this post


Link to post
Share on other sites
Omga4000

After seeing this simple solution I feel so dumb :mellow:

Thank you all, you've really helped me! :)

More questions are sure to come. what a great program!

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  

×