Sign in to follow this  
Followers 0
gemeye

Where's the ignition, the key and how do I drive out of the showroom?

13 posts in this topic

Ok, I downloaded and installed AutoIT v3.0, downloaded and installed SciTE, though I thought I downloaded SciTE4AutoIT3, but whatever, here I am, running the SciTE or the SciTE4AutoIT3 or whatever.

No clue how to get started, I'm trawling tons of code examples (in my time, I've coded in CB, C, Fortran, COBOL, on and on...) but that's like saying I've got my driver's license but if the salesman doesn't point out the ignition and hand over the key, you're not leaving the showroom except the way you came in.

Somebody, please here's all I would lilke to do, create a macro that:

1. Inserts YYYYMMDDdow into an active window, e.g. word, text editor, whatever.

2. Assign the macro to a key combination or mouse action.

This should familiarize me with available functions (as in where do I find a list of functions, are they the standard vb functions, in which case no problem).

Also, where's the list of system variables that I can use?

The assignment part is the big part I'm missing - how to I get my code assigned to a key combination or mouse action?

The code and stuff I could possibly pull out of the tons of examples, but no one says anything about saving the macro file and assigning it to a key?

Thank you to the kind soul who can point me in the right direction.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

1. Inserts YYYYMMDDdow into an active window, e.g. word, text editor, whatever.

#Include <Date.au3>
Send(_NowCalc())

2. Assign the macro to a key combination or mouse action.

Look up the following functions in the helpfile:

MouseMove(....)

MouseClick(....)

Mouse*

And for easy access to the helpfile, press F1 in SciTe

Kurt

EDIT: For your first request, perhaps look up ControlSend in the helpfile, might serve you better.

Edited by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

2. Assign the macro to a key combination or mouse action.

On top of everything Kurt said, you might also want to look up HotKeySet in the help.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Thank you Kurt and SadBunny, But....

I think I'm on another planet here.

So, let me describe what I'm picturing, this worked for me in the past with other macro systems, eg Excel.

1. I create a piece of code that inserts the date or whatever into an open window.

2. When I'm ready to execute the code I do something like Ctrl+Alt+1 i.e. I hold down the Control Key and the Alt key and the 1 key at the same time, then...

3. The code in my macro file is excuted because running in the bacground is an interpreter (AutoIT?) to which has been assigned the keys Ctrl+Alt+1 as an interupt event.

That's all, I just can't seem to get to first base with this.

Maybe AutoIT is an altogether different paradigm. So far I can write code and execute them with the F5 key, or go into Tools>Go So How do I get beyond that?

Please

Share this post


Link to post
Share on other sites

How about this? Run it, and try pressing ALT + 1. It should popup a msgbox. Press ESC to quit it.

To run it from outside SCITE, easiest it to compile it to a standalone executable (F7 is the default key for that - 'autoit.au3' would be put into 'autoit.exe' which you can run standalone).

HotKeySet("!1", "DoMythang")
HotKeySet("{ESC}","exiting")

While 1
    Sleep(10)
WEnd

Func DoMyThang()
    MsgBox(0,"test","hotkey activated")
EndFunc

Func Exiting()
    Exit
EndFunc

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

Btw, ctrl+alt+1 returns an upside-down exclamation mark on my language settings, and as the help states, hotkeys that are in use by other programs or the system cannot be overwritten, so this particular hotkey I couldn't set :whistle:


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

2007/03/19 20:55:07

Ctrl+Alt+1

I have attached the script that performs what you want....

HotKeySet("^!1", "Date")
HotKeySet("^z", "MyExit")
#Include <Date.au3>

While 1
    WEnd

Func Date()
Send(_NowCalc())
Endfunc

Func MyExit()
    Exit
    EndFunc

In order for a program to remain running, it requires a while statement, or something that keeps it active.

You will see the AutoIt icon on the toolbar tray.

EDIT::::

DANGIT SADBUNNY!

You type faster.

Edited by multiloser

Share this post


Link to post
Share on other sites

Thank you Kurt, SadBunny and Muliloser. Btw SadBunny thanks for the heads up on Ctrl+Alt+1, and the compile into an excutable info.

But, I really think my communication skills have seriously lapsed.

Please raise your hand if anyone has created a macro in Excel, then you'll know what I am trying to do in terms of associating the macro to a hot key combination.

We can only communicate if we have shared experiences that we can refer to.

Here's the code I wrote, it generates exactly what I want to produce...

ClipPut( @CRLF & @YEAR & @MON & @MDAY & $DOW[@WDAY] & @CRLF )

EXCEPT, now I want to use it. in any program that I'm running, not just SciTE where I need to open the file I saved this in and then press F5. That's not at all practical.

An executable still doesn't advance me with this, other situations, yes but not for what I would like to do.

Here's the usage scenario:

I'm in word, or edit or textedit, or whatever. Now, I need to enter the values created by the macro into my clipboard and I would like to do this by pressing CTRL+ALT+D or whatever. Let's not get focused on the specifics but on the concept of what we are trying to accomplish.

How to I assign these key combinations CTRL+ALT+D (again, let's not get specific as to the actual key combo) to my hot new macro so that when I do a CTRL+V the string is inserted in my screen?!?!?!

Please

Share this post


Link to post
Share on other sites

That's what HotKeySet(..) is for!! Please use the examples posted above to create your script. Here's what I think you need:

HotKeySet("^!D", "Test")

While 1
    Sleep(50)
WEnd

Func Test()
    ClipPut("THIS IS THE TEXT THAT WILL BE COPIED TO THE CLIPBOARD")
EndFunc

This will copy the text to the clipboard once you press Ctrl+Alt+D. You're really lucky that the nice people are currently on the forum! There's no way in hell anyone else would provide THREE examples. You're really spoiled. Advice for next time: look up in the helpfile the functions we provide you, and study the script to see what does what.

Kurt


Awaiting Diablo III..

Share this post


Link to post
Share on other sites

OK, OK, after re-reading and testing and re-reading and testing what you wrote above, I see (said the blind man) the different paradigm.

I can create an exe file, say AutoITInterpret.exe (thank you SadBunny that will run

continually from startup until I turn it off using some hotkey (thank you Kurt).

Each time I create a utility, I do so as a function within AutoITInterpret.au3, add a hotkey combo and recompile to AutoITInterpret.au3 and so on.

Thank you one and all. Now why don't they just say that in a quickstart document?!

Share this post


Link to post
Share on other sites

That's what HotKeySet(..) is for!! Please use the examples posted above to create your script. Here's what I think you need:

HotKeySet("^!D", "Test")

While 1
    Sleep(50)
WEnd

Func Test()
    ClipPut("THIS IS THE TEXT THAT WILL BE COPIED TO THE CLIPBOARD")
EndFunc

This will copy the text to the clipboard once you press Ctrl+Alt+D. You're really lucky that the nice people are currently on the forum! There's no way in hell anyone else would provide THREE examples. You're really spoiled. Advice for next time: look up in the helpfile the functions we provide you, and study the script to see what does what.

Kurt

Thank you Kurt. It all finally made sense, thanks to you and SadBunny.

Here's what I wrote as my final reply

OK, OK, after re-reading and testing and re-reading and testing what you wrote above, I see (said the blind man) the different paradigm.

I can create an exe file, say AutoITInterpret.exe (thank you SadBunny that will run

continually from startup until I turn it off using some hotkey (thank you Kurt).

Each time I create a utility, I do so as a function within AutoITInterpret.au3, add a hotkey combo and recompile to AutoITInterpret.au3 and so on.

Thank you one and all. Now why don't they just say that in a quickstart document?!

And here's my code:

; Runs continually until terminated

; All macros executed from here.

;

HotKeySet("^+!d", "InsertYYYYMMDDDowString") ; Ctrl-Shift-Alt-d

HotKeySet("^+!{ESC}", "Terminate") ; Ctrl-Shift-Alt-Esc

;HotKeySet("^!1", "Date")

;HotKeySet("^z", "MyExit")

While 1

WEnd

Func InsertYYYYMMDDDowString()

dim $DOW[7] = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

dim $Str = ""

$Str = @CR & @YEAR & @MON & @MDAY & $DOW[@WDAY -1] & "-------------------------------------" & @CR

Send($Str)

Endfunc

;More Macros here

func Terminate()

Exit 0

EndFunc

Share this post


Link to post
Share on other sites

2007/03/19 20:55:07

Ctrl+Alt+1

I have attached the script that performs what you want....

HotKeySet("^!1", "Date")
HotKeySet("^z", "MyExit")
#Include <Date.au3>

While 1
    WEnd

Func Date()
Send(_NowCalc())
Endfunc

Func MyExit()
    Exit
    EndFunc

In order for a program to remain running, it requires a while statement, or something that keeps it active.

You will see the AutoIt icon on the toolbar tray.

EDIT::::

DANGIT SADBUNNY!

You type faster.

Thank you Multiloser. It all finally made sense, thanks to you and SadBunny and Kurt

Here's what I wrote as my final reply

OK, OK, after re-reading and testing and re-reading and testing what you wrote above, I see (said the blind man) the different paradigm.

I can create an exe file, say AutoITInterpret.exe (thank you SadBunny that will run

continually from startup until I turn it off using some hotkey (thank you Kurt).

Each time I create a utility, I do so as a function within AutoITInterpret.au3, add a hotkey combo and recompile to AutoITInterpret.au3 and so on.

Thank you one and all. Now why don't they just say that in a quickstart document?!

And here's my code:

; Runs continually until terminated

; All macros executed from here.

;

HotKeySet("^+!d", "InsertYYYYMMDDDowString") ; Ctrl-Shift-Alt-d

HotKeySet("^+!{ESC}", "Terminate") ; Ctrl-Shift-Alt-Esc

;HotKeySet("^!1", "Date")

;HotKeySet("^z", "MyExit")

While 1

WEnd

Func InsertYYYYMMDDDowString()

dim $DOW[7] = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

dim $Str = ""

$Str = @CR & @YEAR & @MON & @MDAY & $DOW[@WDAY -1] & "-------------------------------------" & @CR

Send($Str)

Endfunc

;More Macros here

func Terminate()

Exit 0

EndFunc

Share this post


Link to post
Share on other sites

Btw, ctrl+alt+1 returns an upside-down exclamation mark on my language settings, and as the help states, hotkeys that are in use by other programs or the system cannot be overwritten, so this particular hotkey I couldn't set :whistle:

Thank you SadBunny. It all finally made sense, thanks to you and Multiloser and Kurt

Here's what I wrote as my final reply

OK, OK, after re-reading and testing and re-reading and testing what you wrote above, I see (said the blind man) the different paradigm.

I can create an exe file, say AutoITInterpret.exe (thank you SadBunny that will run

continually from startup until I turn it off using some hotkey (thank you Kurt).

Each time I create a utility, I do so as a function within AutoITInterpret.au3, add a hotkey combo and recompile to AutoITInterpret.au3 and so on.

Thank you one and all. Now why don't they just say that in a quickstart document?!

And here's my code:

; Runs continually until terminated

; All macros executed from here.

;

HotKeySet("^+!d", "InsertYYYYMMDDDowString") ; Ctrl-Shift-Alt-d

HotKeySet("^+!{ESC}", "Terminate") ; Ctrl-Shift-Alt-Esc

;HotKeySet("^!1", "Date")

;HotKeySet("^z", "MyExit")

While 1

WEnd

Func InsertYYYYMMDDDowString()

dim $DOW[7] = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

dim $Str = ""

$Str = @CR & @YEAR & @MON & @MDAY & $DOW[@WDAY -1] & "-------------------------------------" & @CR

Send($Str)

Endfunc

;More Macros here

func Terminate()

Exit 0

EndFunc

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  
Followers 0