AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Basic Beginner's Questions. [solved 3/5] [NeedHelp]
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Leef_me



Joined: 08 Apr 2009
Posts: 1434
Location: San Diego, California

PostPosted: Tue Nov 10, 2009 11:53 pm    Post subject: Reply with quote

Quote:
The last line. If I have an application that has different cursors than the standard win ones, the function A_Cursor gives a result as unknown.
Is there a way to identify in any way even those unknown cursors?

Because I would like to assign different functions to the recognized different mouse cursors.
Your question seems to be application - specific. Can you name an example appication that does this, more than one example would be even better.
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 1434
Location: San Diego, California

PostPosted: Wed Nov 11, 2009 12:10 am    Post subject: Reply with quote

Quote:
Question 3: How can I run two different functions from one GUI, to send different informations to same application at one time.

The term "at one time" is ambiguous.
How often must the data be sent from each source?
How much data is coming from each source?
How does the destination program receive the data?
What is the impact or poor performance associated with not receiving both sets of data at the same time?
Can the two data sources be consolidated in real-time or can they be consolidated later?

Here is a simple program that sends keystrokes, if I uncomment all three settimer commands, I get 0...9a...z0...9a...z0...9a...z on repeated lines.
If I duplicate the script and comment out #2 on one script and #1 & #3 on the other script, I get the interspersed '9ab01cd23e4f etc" result shown below.

Is this anthing like you want?

Code:

f2::
settimer, app1, 200
sleep, 10
;settimer, app2, 50
sleep, 10
settimer, app3, 500
return

app1:
send abcdefghijklnmopqrstuvwxyz
return

app2:
send 0123456789
return

app3:
send `n
return

esc::
exitapp[quote]9ab01cd23e4f5gh67i8j9kl0nm12op34qr56st78u9vw0x1yz234a5bc6d78ef9g0hi12jk34l5nm67op89qr0s1tu2v34wx56yz78
9a0bc12d3e4fg5h6i78j9kl0n1m2o3p4q5rs6t7u8v9w0xy1z23a45bc67de8f9g0hi1j2k34ln56m7o8pq9rs0tu1vw23x4y5z
67a8b9c0de1f2g34h5i6j7k8l9nmo01pq23rs45t6uv78w9xy0z1a2b3c4d5e6fg78hi9j0kl12nm34o5p6q7r8s9tu0v1wx23y4z5
6a78bc9de01fg23hi45jk67ln8m9o0pq12rs34tu56vw7x8y9z01ab2c3d45ef6g7h89ij0k1l2n3mo45p6q7r8st9u0v1w2x3y4z5
6a7b8c9def01g2h3i4jk56l7n8m9opq01r2s3t4u5v6w7x8y9za0b12c3d4e5f6g7h8ij9k0l1n2mo34p5q6rs78t9uv0w1x2y3z4
56a7b8c9de0fg1h23i4jk56l7n8m9opq01rs23t4u5v6wx78y9z0ab12c3d4ef56gh78i9jkl01n2m3o4pq56r7s8t9uv0w1x2y3z4
5a67b8cd9e0f1gh23i4j5k6ln78m9opq01r2st34u5vw6x7y8z9a0b12cd3e45f6g7h8ij9kl01n2m3op45qr67st89uv0wx12yz34
56ab78c9de0f1gh23i4j5k6l7nm89op0qr12st3u45v6w7xy89za01b2cd3ef4g5h6i78j9k0l1n2m3o4pq5r67s8t9uv0w1x2yz34
56ab7c8d9ef01g2hi34j5kl67nm89op0qr12st34uv5w67x8yz9a01b2c3de45fg67hi8j9kl01nm2o34pq56r7s8tu9vw01x2y3z
456a7bc89de0f1g2h3i4j5k6l7n8m9op0q1r2s3t4u5vw67x8y9za01b2c3de45fg67hi89jk0ln1m2o34pq5r67s8tu9vw0x12yz34
5a6b78cd9ef01gh23ij45kl67nm89op0q1r2st34u5vw67x8yz9a01b2cd34ef5g67h8i9jk0l1n2mo3p45q6r7st89uv0wx12y3z4
56a7bc89de0fg12h3i4j5kl67n8mo9pq01rs23tu45vw6x7y89za0b12c3de4f56gh78ij9kl01n2mo3p45qr6s7t89uv0wx12yz34
56a7b8cd9e0f1gh23ij45k6l7nm8o9p0q1rs23t4u5v6w7xy8z9a0b1c23d4e5f6g7hi89jkl01n2m3op45q6r7s8t9uv0w1x2y3z4
5a67bc89def01g2hi34jk56ln7m89op0qr12s3t4uv56wx78y9za01b2c3d4e5f6g7hi89jkl01n2m3o4pq56r7s8tu9v0w1xy23z
45a6b78c9de0f1g2h3i4j5k6l7nm89opq01r2st3u45v6w7x8yz90a1b23c4de56f7g8h9ij0kl1n23mo45p6qr78s9tuv0w1x23yz4

[/quote]
Back to top
View user's profile Send private message
antihack



Joined: 03 Nov 2009
Posts: 10

PostPosted: Wed Nov 11, 2009 9:35 am    Post subject: Reply with quote

Leef_me wrote:
Quote:
Question 3: How can I run two different functions from one GUI, to send different informations to same application at one time.

The term "at one time" is ambiguous.
How often must the data be sent from each source?
How much data is coming from each source?
How does the destination program receive the data?
What is the impact or poor performance associated with not receiving both sets of data at the same time?
Can the two data sources be consolidated in real-time or can they be consolidated later?


Hello!

Thank you for the support which you give in my topic.

As you could figure out, I want to make a program which would send keystrokes to a game. In this thread I want to learn about selected functions of Autohotkey, which I will use later in my project.

Sending multiple keystrokes from one script/application.

I will explain more about this. I've made a script which contains 2x dropdownlist and 2x combobox. Selected values from dropdownlists are keys from F1 to F12. The combobox values are timings (can put own timings in milliseconds). So lets say I want to have this application kind of flexible, to not write single Autohotkey scripts for every key and run like 4 applications at once (just to have a combination of keys sent). I want it all to be in one GUI, one application. So lets say I want to send a key F1 to a game. So i chose the F1 in dropdownlist and then i put timing 5000 (what will send key every 5 sec), then i press start and script run. Then I have second line with the 2nd buttons, there i select for example F3 and timing 4000 (4secs). While i press start, the previous executing script with F1 get stopped and is being replaced by the F3 key sending. This is the problem. Lets say i would like to have 5 rows of dropdownlist>combobox>start>stop to be able to select different keystrokes with different timings and using one gui for all of that. Note: If i run 2x that autohotkey application then sending 2 different keys works. But if two keystrokes are sent from one gui/application, then the newer replaces the older. I'm using the code which is present in first post. Just instead of the notepad is a name of a game.


EDIT:

Here is an example of a GUI:


DropDownList - ComboBox - Start - Stop ;DDL = %H%, CBox = %T% (Where %H% is a key for ControlSend and %T% is a timing for Sleep)
DropDownList - ComboBox - Start - Stop ;DDL = %H2%, CBox = %T2%
etc etc

PS2: Would be also nice to have the already submitted values unchangeable, like not active when you already submit/start. So would know which is already running.
_________________
Follow your dreams!
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 1434
Location: San Diego, California

PostPosted: Wed Nov 11, 2009 4:01 pm    Post subject: Reply with quote

Quote:
I'm using the code which is present in first post. Just instead of the notepad is a name of a game.

I never really looked at that code before Embarassed
I think you will like this change Wink

Untested.

Code:
;Here is the part of gStart1:
Start1:
Gui, Submit, Nohide
; To save the values from ComboBox and DropDownList in to memory.
SetTitleMatchMode 3
; To specify that only exact name of application will be count.
WinGet, note, ID, Bez tytulu - Notatnik
; To assign Notepad's ID with our variable 'note'.
; PS: I'm Polish, so in my language: Bez tytulu - Notatnik = Untitled - Notepad
IfWinNotActive, ahk_id %note%
WinActivate, ahk_id %note%

guicontrol, disable, H   ; hotkey ddl
guicontrol, disable, T   ; timing ddl

settimer, timer1, %T%
return


;Here is the part of gStop1:
Stop1:
settimer, timer1, OFF

guicontrol, enable, H   ; hotkey ddl
guicontrol, enable, T   ; timing ddl

return


Timer1:
ControlSend,, {%H%}, ahk_id %note%
return



/* commented out

; Activating application assigned in previous line.
loop
{
ControlSend,, {%H%}, ahk_id %note%
Return
; Will send a value:key specified in form DropDownList (H) to Bez Tytulu - Notatnik %note%.
Sleep, %T%
; Will sleep (delay) previous function with amount of millisecions specified in ComboBox as %T%.
if (T < 0 )
; Gives an option to break the key sending function (connected to ButtonStop).
Break
}
Return
*/

;Here is the part of gStop1:

/* commented out

Stop1:
T = -1
; When used, changes the value of %T% to negative (less than zero) what cause end of the loop.
Return
*/





/* scratchpad area


;Gui, Add, DropDownList, x96 y27 w70 h180 vH, F1|F2|A||B|C|D|E|F
; 'vH' Assigns selected value to variable %H%.

;Gui, Add, ComboBox, x276 y27 w60 h180 vT, 1000||2000|3000|4000|5000
; 'vT' Assigns selected value to variable %T%.

;guicontrol, enable, main,  ; from Leef_me project
;guicontrol, disable,CTRL,

end scratchpad area */

Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 1434
Location: San Diego, California

PostPosted: Wed Nov 11, 2009 4:01 pm    Post subject: Reply with quote

Quote:
I'm using the code which is present in first post. Just instead of the notepad is a name of a game.

I never really looked at that code before Embarassed
I think you will like this change Wink

Untested.

Code:
;Here is the part of gStart1:
Start1:
Gui, Submit, Nohide
; To save the values from ComboBox and DropDownList in to memory.
SetTitleMatchMode 3
; To specify that only exact name of application will be count.
WinGet, note, ID, Bez tytulu - Notatnik
; To assign Notepad's ID with our variable 'note'.
; PS: I'm Polish, so in my language: Bez tytulu - Notatnik = Untitled - Notepad
IfWinNotActive, ahk_id %note%
WinActivate, ahk_id %note%

guicontrol, disable, H   ; hotkey ddl
guicontrol, disable, T   ; timing ddl

settimer, timer1, %T%
return


;Here is the part of gStop1:
Stop1:
settimer, timer1, OFF

guicontrol, enable, H   ; hotkey ddl
guicontrol, enable, T   ; timing ddl

return


Timer1:
ControlSend,, {%H%}, ahk_id %note%
return



/* commented out

; Activating application assigned in previous line.
loop
{
ControlSend,, {%H%}, ahk_id %note%
Return
; Will send a value:key specified in form DropDownList (H) to Bez Tytulu - Notatnik %note%.
Sleep, %T%
; Will sleep (delay) previous function with amount of millisecions specified in ComboBox as %T%.
if (T < 0 )
; Gives an option to break the key sending function (connected to ButtonStop).
Break
}
Return
*/

;Here is the part of gStop1:

/* commented out

Stop1:
T = -1
; When used, changes the value of %T% to negative (less than zero) what cause end of the loop.
Return
*/





/* scratchpad area


;Gui, Add, DropDownList, x96 y27 w70 h180 vH, F1|F2|A||B|C|D|E|F
; 'vH' Assigns selected value to variable %H%.

;Gui, Add, ComboBox, x276 y27 w60 h180 vT, 1000||2000|3000|4000|5000
; 'vT' Assigns selected value to variable %T%.

;guicontrol, enable, main,  ; from Leef_me project
;guicontrol, disable,CTRL,

end scratchpad area */

Back to top
View user's profile Send private message
antihack



Joined: 03 Nov 2009
Posts: 10

PostPosted: Wed Nov 11, 2009 9:08 pm    Post subject: Reply with quote

Leef_me wrote:
Quote:
I'm using the code which is present in first post. Just instead of the notepad is a name of a game.

I never really looked at that code before Embarassed
I think you will like this change Wink


Thanks!

Something new to study: SetTimer Very Happy
Is late for today, tomorrow after work I will edit the scripts and test it out.


Any idea about how to recognize, if animated_cursor1 changed to animated_cursor2 such as A_Cursor?
_________________
Follow your dreams!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group