AutoHotkey Community

It is currently May 27th, 2012, 7:36 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: August 1st, 2006, 10:37 pm 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
Hi

I truly enjoy AutoHotKey with it's script-recorder application but sometimes, the number of operations required to record and play a script is more trouble than to simply repeat the operations. We are talking about recording a script, saving it, and then use Explorer to browse to it, edit it into a callable script and finally execute it. This is basically what this script simplifies.

Here's how to use the "AutoScriptPlayer.ahk" script.
1) Start the script. It will start "AutoScriptWriter.exe" if it's not already there.
2) Record your script like you normally do.
3) Press win+p (window key and p) to save it in a temporary script file.
4) press win+q to play it.

The temporary script file already has a standard template header, giving you a head-start if you would like to preserve it. In that case, do not forget to save or rename this temporary script file, else it will be replaced the next time "win+p" is pressed. It is saved under the name "TempMacro.ahk" in the same directory than "AutoScriptPlayer.ahk" is.

If desired, you may quickly-edit your recorded script in the "AutoScriptWriter.exe" text window, like remove unwanted "MouseClick" instructions.

http://autohotkey.net/~Johny/AutoScriptPlayer/AutoScriptPlayer0_1.ahk


Hope you'll enjoy this as much as I do.

_____________________
Extended key version

This new version can save & execute multiple recorded macro that can be called with different hot keys. The following keys are used:
  • win+shift+q -> Save & execute a macro that will be played with win+q
  • win+shift+a -> Save & execute a macro that will be played with win+a
  • win+shift+z -> Save & execute a macro that will be played with win+z
  • win+shift+w -> Save & execute a macro that will be played with win+w
  • win+shift+s -> Save & execute a macro that will be played with win+s
  • win+shift+x -> Save & execute a macro that will be played with win+x
  • Win+shift+SpaceBar -> Direct Save & execute

A temporarely macro will be created for each new "save & execute" key invoked. This is a simple macro that can be modified if you would like to use different keys or more keys.

http://www.autohotkey.net/~Johny/AutoScriptPlayer/AutoScriptPlayer.ahk


Enjoy

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Last edited by Johny on September 24th, 2006, 3:51 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 7th, 2006, 6:04 am 
To get the same:
1. go to AutoScriptRecorder.exe und select the corresponding code
2. use http://www.autohotkey.com/forum/post-64430.html&sid=596913ce17ec4d0e473520633ccdd024#64430 , d-man: Script for quick test run of scripts,
hotkey ^w
Code:
^w::
send ^c

FileDelete, c:\TempScript.ahk
FileAppend, %Clipboard%, c:\TempScript.ahk
run, c:\TempScript.ahk
return


Report this post
Top
  
Reply with quote  
PostPosted: August 7th, 2006, 5:11 pm 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
robiandi wrote:
To get the same: (...)


It's close but not similar. You still need to manually do several operations to do the same, like: start AutoScriptWriter & your macro, manually add the hotkeys code, copy in the clipboard and so on... Different purpose, "AutoScriptPlayer" is really like adding a "play macro" button with a hot-key to "AutoScriptWriter". It's an instant macro player for "AutoScriptWriter".

The closer I've seen to the "AutoScriptPlayer" script is this: "http://www.donationcoder.com/Software/Skrommel/#DoOver". It's a "record and save macro" utility. Really well done but it doesn't allow to save your recording as an "AutoHotKey" editable script.

Thanks for your comments.


Please try "AutoScriptPlayer" and let us know what you think.

In my view (okay, the author’s biased view), this is the missing tool that would allow even non programmers to take advantage of the macro power. Instead of learning several macro syntax (word processing, electronic worksheet, CAD, VB script or else...) and be limited to that application, you learn a basic level of "AutoHotKey", use this script and you can say bye to these repetitive actions. It's so nice to see all those windows dancing everywhere on your desktop making all the work for you and saving a huge amount of time. And if it's really useful, save it (and share it here (!)). For me, it's now a mandatory tool on any new computers.

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 23rd, 2006, 1:07 am 
Offline

Joined: August 16th, 2006, 9:53 pm
Posts: 16
A hearty Thank you to the AHK-makers and friendly Addoners:

especially Johny for the ASP ( AutoScriptPlayer ) and Robiandi for the simple but efficient CP ( ClipboardPlayer ).

Both scripts are useful in their own right as quick script launchers:

* ASP for fresh ASW ( AutoScriptWriter ) generated scripts
* CP for scripts. given here in the forum or quick own edits.

What about the following suggestion?

Create or run scripts by keying a touchsensible midi keyboard single key with an appropriate velocity.

Each key of such a MidiKb allows 128 volume levels, but for practical reasons let's only use, say, four levels ;

* level1= [0..31] ( "piano" )
* level2= [32..63] ( "mezzoforte" )
* level3= [64..95] ( "forte" )
* level4= [96..127] ( "fortissimo" )

If a key <n><m><o> is pressed with level1 velocity this shall produce a string

<s><n><m><o><v> with the following elements:

<s>= ! ; a signal character
<n>= A | B | C | D | E | F | G ; notename prefix
<m>= s | b | _ ; optional modifier for sharp, flat, natural
<o>= 1..5 ; octave index
<v>= 1..4 ; velocity level


The produced string is sent as a faked keyboard input (to an appropriate AHK script to be written) with the following meaning, as sketched by example.
Some context can be found by searching for MidiKB in the AutoHotkey forum.


* !C_31 run the script C_3 which is located in an appropriate script directory
* !C_32 open an editwindow with a template to manually write/edit a script, named C_3
* !C_33 start the AutoScriptWriter in recording mode for being saved in a script, named C_3; make a *.bak if such a script exists.
* !C_34 abort the current script/command

Question:

As I am new to AutoHotKey, could someone provide a script, that blocks keyboard input to the system as soon as a "!" arrives, but receives in an inputfield exactly four more chars?

Of course a kb-listener, that would also catch and absorb the signal-char "!" would even be better.

(Yes I know there are other possibilities, clipboard-messages, shared memory, DDE, OLE, COM, sockets, OnMessage,... but would like to try out these simple construction first, for mutual convenience)

_________________
http://aboutUs.org/fridemar
Let's amplify each other's light :-)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 23rd, 2006, 4:23 pm 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
Thanks fridemar for your encouragements.

This is getting a bit off context. You might have more relevant help if this is re-posted in the “General help" forum. Anyway, I'll try to answer your questions.

Midi keyboard capture:
If I understood well, this seems to be a string capture-reaction request, meaning upon a series of received characters beginning with "!", it will call other macros. There are several threads that discuss this like: http://www.autohotkey.com/forum/topic10444.html.

Script that block user inputs:
Check commands "GetKeyState" and "Input". They are used in the examples cited above.


Example (there are many other way to do this. This is a simple one):

Code:
; A midi-capture and process string macro
; Use "!" to execute

!::
; Capture
;  Capture 4 characters, exclude the starting "!"
;   timeout of 3 seconds (ErrorLevel timeout not checked but it would be preferable)
Input, KeyCapt, T3L4 ;

; Process command
StringMid, KeyCmd, KeyCapt, 3, 2
;MsgBox, KeyCapt=%KeyCapt% and KeyCmd=%KeyCmd% ; for debugging, remove the starting ";"
if KeyCapt=31
   RunWait, C_31.AHK
if KeyCapt=32
{
   ; and so on...
}

return



Hope this help

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 24th, 2006, 12:43 am 
Offline

Joined: August 16th, 2006, 9:53 pm
Posts: 16
Dear Johny,

thank you for your example, which I have slightly modified to suggest further elaboration of your evolving AutoScripter (. Yes I can clearly see it :- ).

It is a good feeling to use as little as possible keyboard-input to get things done. What you do is stepping in the right direction and as many as possible scripting and programming users should support it.

As you invite suggestions, here is my next one:

Let's sketch it with the terms of the following snippet:

Code:
!::
; Capture
;  Capture 4 characters, exclude the starting "!"
;   timeout of 3 seconds (ErrorLevel timeout not checked but it would be preferable)
; Separate filename and todo mode

Input KeysCapt, T3L4 ;

; Process command
StringMid, filnam, KeysCapt, 1, 3
StringMid,  todo, KeysCapt, 4, 1
if KeysCapt<>
 MsgBox, filnam=%filnam% and todo=%todo%
if todo=1
 MsgBox, %todo% -> run filname=%filnam%
else if todo=2
 MsgBox, %todo% -> put Clipboard into filename=%filnam% and run it
else if todo=3
 MsgBox, %todo% -> call AutoScriptWriter, put result into filename=%filnam% and run it
else if todo=4
 MsgBox, %todo% -> edit filname=%filnam% or create a new one, if it doesn't exist
else
{
 MsgBox %todo% -> There is no such command, therefore we send the exclamation-mark
 send !
 ;doesn't work. How,at this place, can we temporarily disable the capture and enable typing ! ? Saving old clipboard, putting !  in it, pasting it at current cursor pos, if in edit field, restoring clipboard? Shouldn't we better abort without typing here. Short typing ! is easier.

}
return




Question:

How can we modify the autorepeat-function in the following way?
Since the autorepeat function for the alphanumeric keys is nearly never used, what about the following?
Type alpha chars as usual, but as soon as the autorepeat delay is timed out, produce visible todo indices 1,2,3,4,x,1,..4,x,....... together with a visible keyrelated automatic filename:
.
E.g. If you keydown a and wait, you get successively the strings (in a visible inputfield)

a-_1
a-_2
a-_3
a-_4
a-_a

...

filename=a-_1 .. a-_4
todo=1..4,a

If you keyup on 1...4 do the appropriate cmds else abort with typing the respective key, you typed.

Can this be done with a script?

Of course I know, that for user friendlyness, the indices should later be elaborated to comment strings or icons and perhaps be orchestrated by some audio feedback. Idea, let the computer "read" it aloud. :-)



PS.:


Here comes a little memo for the sake of the freedom of the community friendly programmers/scripters.

No patent shall be made on (midikb) hotpatterns, as a generalization of hotstrings. Hotpatterns in general are defined here as patterns of arbitrary body movements or other (electric) biofeedback, captured for machine cmds.
Don't forget e.g. voiced speech patterns (including pitch, volume and timbre, ..., normally discarded in speech recognition) and (mouse) gestures.

MidiHotpatterns are a rich subset of those general hotpatterns.

Keykit is a freeware programming Midi system that allows to detect (regular) midi patterns of high complexity, that can be encoded to strings, sent as cmd triggers to appropriate freeware such as AutoHotKey, AutoIt, PowerPro, ... .

In the meantime, for the benefit of all PcKbOnly users, every one in the know and with goodwill, is invited to emulate the potential as good as possible.

Although MidiKb allows to generate the todo index (and more) with one single stroke, the PcKb can hopefully simulate velocity with timed typing.

For the benefit of the greater community this note is also stored in diigo and some other social bookmark communities for external annotation and
as document, that nobody can steal and block these and the forthcoming (straightforward) ideas by some patent ;-)

_________________
http://aboutUs.org/fridemar
Let's amplify each other's light :-)


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 25th, 2006, 6:11 am 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
I've edited my original message
  • Replace occurrences AutoScriptRecorder.exe by AutoScriptWriter.exe
  • Update the script download link.

Sorry if that causes any confusions.

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 25th, 2006, 6:18 am 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
Sorry Fridemar, but for the respect of the original code as well as other users, this thread should be for comments, improvements or alternatives for AutoScriptPlayer.ahk. A MIDI-keyboard support is out of the original objectives of AutoScriptPlayer.ahk.

However, I've answered your questions and updated the example code on a new thread. For now on, please answer on this new thread.

http://www.autohotkey.com/forum/viewtopic.php?p=73736

If anyone has MIDI-related comments, please post them on the thread cited above.

Thank you

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 1st, 2006, 1:09 am 
Offline

Joined: August 16th, 2006, 9:53 pm
Posts: 16
Hi Johny,

thank you for your friendly link/node creation of the specific Midi stuff, which inspired me to the following suggestion of your instant Autoit Recorder Player.

I don't know, if it is possible to script it , without lowlevel device driver
programming in Autoit...

Starting with the observation that the autorepeat function of alphanumeric keys is nearly never used for duplicating chars (in contrast to special chars like "=============================" )

what do you think about

    starting the recorder-macro with keying down an uppercase A...Z, hold down long enough that the modified autorepeat function allows the Recorder to save to a preset (tempory) filename A.ahk.
    starting a recorded-macro with keying down a lowercase a...z, hold down long enough that the modified autorepeat function calls the Macro A.ahk.


The script launching part could be generalized, such that holding down a lowercase letter even longer, the script directory would be called and each script, in lexicographic order, starting with the letter "A" would be successively shown until the key is released. After a short delay after keyup the current file under cursor is run.

However when immediately after releasing the key, a second keystroke of the same key is done, this would escape the process.

Soundsignals ( e.g. beeps with different frequencies) could give the user additional guidance.
In the Midi thread of this forum, I could give an example for time-sensitive MidiKb-use, if somebody is interested in such exotic keystroke minimal cmd-invocations.

_________________
http://aboutUs.org/fridemar
Let's amplify each other's light :-)


Last edited by fridemar on September 10th, 2006, 5:33 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 4th, 2006, 3:45 am 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
Using the upper case and lower case keys for different functions is a good idea and it's easy to do. So easy that I’ll give the recipe here if anyone want to modify the script to behave this way. Let' say:
  • Win+shift+a would save the code present in AutoScriptWriter and
  • Win+a would play it.
This would imply to replace the code:

Code:
   ...
   TempHeader10=; Use Windows+Q to execute
   TempHeader11=`#q`::
   ...
   ;"Save and execute" key sequence pressed
   #p::
   ...

by this code:

Code:
   ...
   TempHeader10=; Use Windows+A to execute
   TempHeader11=`#a`::
   ...
   ;"Save and execute" key sequence pressed
   +#a::
   ...


Capture the repetition is much more tricky. It would imply a key-capture sequence and some sort of comparison with a time-based sub-routine. The “repetitive letter” feature is marginally use, but it's used. I use it sometime when I debug serial-based protocols. I think some gamers use this also. However, beside the operating-systems, I can't think of any applications that use the windows-keys. So I suggest staying with a windows-key based solution.

I read on another thread that it might be useful to have an input-box asking us what key the recorded macro would be executed with. With this, we could have several temporary macros available at once. The ProKey DOS application had a similar functionality. So, to stay in the same line of thinking, how about having some behavior like this:

  • Win+shift+a would record a macro that would be played with Win+a
  • Win+shift+b would record a macro that would be played with Win+b
  • Win+shift+c would record a macro that would be played with Win+c
  • ... and so on for every letters on the keyboard


What do you think?

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
PostPosted: September 9th, 2006, 1:37 am 
Offline

Joined: August 16th, 2006, 9:53 pm
Posts: 16
Hello Johny,

I guess, a lot of people will enjoy your simple but highly efficient key arrangement in your Macrorecorder/Player improvement.

Please script it, so that it can immediately be put to use.

When working with a graphics system, simple keying for macros is very convenient, because the interplay between mouse and keyboard gets more confortable.

The resp. MidiKb-variant would be straightforward:

e.g. for Midikey "a" with

a heavier touch 64<=a.vol <128 <--> Win-shift-a (for the rarer situation, when a macro is to be generated)
and a softer touch 1<=a.vol <64 <--> Win-a (for the more frequent situations, when a macro is used)

(Not only) multimedia authors with a MidiKb and a graphics tablet will know to apreciate it.

It's nice to see, how the community can build up on each other's solution. We are on (the beginning of) a wonderful journey.

_________________
http://aboutUs.org/fridemar
Let's amplify each other's light :-)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: hello yall
PostPosted: September 9th, 2006, 4:17 am 
Quote:
It's nice to see, how the community can build up on each other's solution.
It all starts on the foundation of a great idea. We should all give thanks for that foundation. A borrowed foundation is also known as "the coattails". Feel free to drop by autoitscript.com and make a donation.

Lar.


Report this post
Top
  
Reply with quote  
 Post subject: Re: hello yall
PostPosted: September 10th, 2006, 4:09 pm 
Offline

Joined: August 16th, 2006, 9:53 pm
Posts: 16
Quote:
It all starts on the foundation of a great idea. .... Feel free to drop by autoitscript.com and make a donation.


Hi Larry,

thank for pointing to the father of Autohotkey: http://www.autoitscript.com/autoit3/, deserving its credit, now evolving more and more into a general purpose programming system.

By the way, is there a macrorecorder in your system too?

You know that the programmers there are welcome here in the same way as the programmers here to use and elaborate the upcoming "hot" ideas .

_________________
http://aboutUs.org/fridemar
Let's amplify each other's light :-)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2006, 4:01 am 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
Larry:
Hi Larry,

You've made an important contribution with, among other, the AutoScriptWriter, thanks. However, as you can see, there are several patches and alternatives that began to appear. One day, one of them may replace your application.

To preserve the paternity you deserve, I would highly encourage you to share your code so other users may propose modifications on it. (I might!). Other users may or may not accept them. That's also a power of the open source.

Applications get betters, so are the numbers of users and the contributions.

Just my little "a bit off the subject" comment.


fridemar:
AutoIt is one of those "positive competition" applications that make both solutions great and powerful alternatives to Microsoft’s VB/JS script & VBA. Their lack of a proper recorder and keyboard/mouse support pushes us to alternatives. That's why, in my humble option, the keyboard/mouse recorder is such a major piece in this puzzle.

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2006, 4:06 am 
Offline

Joined: August 1st, 2006, 9:39 pm
Posts: 20
Location: Montreal, Quebec, Canada
Several days passed since I propose the modification. From what I can see, I would like to propose a simplified key-limited version.

We'll have to admit that we rarely execute more than 3 or 4 recorded macros simultaneously. For those who would like to do so, I have created an "extended key version". The first message has been edited to link to this new version.

Hope you'll like it.

_________________
Questions, comments and suggestions are always welcome.

Johny :idea:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: kurakura, nothing, Yahoo [Bot] and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group