Send multiple keys when typing 1103 , 1105 and 4418 Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Prazul
Posts: 94
Joined: 05 Aug 2021, 15:55

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by Prazul » 08 Aug 2021, 05:59

boiler wrote:
08 Aug 2021, 04:46
Prazul wrote: It interferate with my data saved in clipboard.
Have you seen that it interferes with the data saved in the clipboard, or are you just assuming it does? Because I put code in to save the previous contents of the clipboard and restore it after it copies the text into it and analyzes it.
@Boiler,
If I write "example" then press CTRL+C (copy in clipboard) , then after I execute the macro ,in the field where it paste "CTRL+V" the syntax of macro continue to be writen instead of sending "Ctrl+V" from my routine. It seem my program is too slow for the speed of macro execution, mabe is not optimised, is not updated since 2006 :think: . This doesn't happen every time.
I have observed that the more data I introduce in program, the more time it take to process every command.

Example: I have a client wich place a command of 10 products.
After every product insertedthe time for processing and jumping to the next row increase.
Introducing Product 1 take 10ms
Introducing product 2 take 14ms
and so on..
That is the problem in executing macro too, I think :think:

It seem the macro execution is too fast for the program to be processed and I believe this is the problem. I;m thinking introducing a short latency (some 10 ms mabe) between every step of execution of macro thus giving the database of program sometime to process everystep of macro.
User avatar
boiler
Posts: 17310
Joined: 21 Dec 2014, 02:44

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by boiler » 08 Aug 2021, 06:38

Perhaps these changes will help:

Code: Select all

:?B0C1:D::
	ClipSave := ClipboardAll
	Sleep, 100
	Clipboard := ""
	Send, +^{Left}^c^{Right}
	Entry := Clipboard
	Sleep, 100
	Clipboard := ClipSave
	if (Entry ~= "i)^\d{6,}D")
		gosub, MyRoutine
return
Prazul
Posts: 94
Joined: 05 Aug 2021, 15:55

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by Prazul » 08 Aug 2021, 14:56

boiler wrote:
08 Aug 2021, 06:38
Perhaps these changes will help:

Code: Select all

:?B0C1:D::
	ClipSave := ClipboardAll
	Sleep, 100
	Clipboard := ""
	Send, +^{Left}^c^{Right}
	Entry := Clipboard
	Sleep, 100
	Clipboard := ClipSave
	if (Entry ~= "i)^\d{6,}D")
		gosub, MyRoutine
return
:bravo: :thumbup: Excellent! Thank you very much! :clap:
Prazul
Posts: 94
Joined: 05 Aug 2021, 15:55

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by Prazul » 31 Aug 2021, 04:05

mikeyww wrote:
05 Aug 2021, 17:36

Code: Select all

:B0*:1103::
:B0*:1105::
Input, key, VL3, -()[]{}':;""/\`,.?! `n
If (key != "`t`t`t")
 Return
tomorrow := ""
tomorrow += 1, D
FormatTime, tomorrow, %tomorrow%, d
SendInput %tomorrow%{Tab 3}
Return
If you mean to send the Tabs instead:

Code: Select all

:B0*:1103::
:B0*:1105::
tomorrow := ""
tomorrow += 1, D
FormatTime, tomorrow, %tomorrow%, d
SendInput {Tab 3}%tomorrow%{Tab 3}
Return
The above code has an issue. Today is 31 august tomorrow is 1 september.
When I run 1103 hotkey, it set the date for 1 august instead of 1 september.
It is possible to make it set the date for tomorrow? Any help is welcomed :think:
User avatar
mikeyww
Posts: 27274
Joined: 09 Sep 2014, 18:38

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by mikeyww » 31 Aug 2021, 04:47

I'm surprised because I do not see the month appearing in your script.
Prazul
Posts: 94
Joined: 05 Aug 2021, 15:55

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by Prazul » 31 Aug 2021, 06:27

:lol: Yeah you're right. It was my explanation error because my software automatically complete the month but not when it is the last day of month. (E.g if the month has 30 days and today is 29 august, then typing 1103 will autocomplete 30/08/2021 .
Also typing manually the number 30 in the date field and pressing TAB will autocomplete the entire date.

But when it is the last day of month, as it is today, 31.08.2021 program does not autocomplete the next day and next month, 01/09/2021 nor the script nor the software i'm working in it.. So definitively it's my fault I did not was explicit.)
:facepalm:
User avatar
mikeyww
Posts: 27274
Joined: 09 Sep 2014, 18:38

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by mikeyww » 31 Aug 2021, 07:14

If needed, AHK can compute the correct month for you.
Prazul
Posts: 94
Joined: 05 Aug 2021, 15:55

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by Prazul » 31 Aug 2021, 09:29

Wow, Great! Really? Didn't knew that! That's so cool.

Do you offer a solution or you just uppset me because you know and I don't ?
Last edited by Prazul on 31 Aug 2021, 09:33, edited 1 time in total.
User avatar
mikeyww
Posts: 27274
Joined: 09 Sep 2014, 18:38

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by mikeyww » 31 Aug 2021, 09:33

I don't really have a lot of secrets. Most of my scripts are adapted directly from the AHK documentation.

Code: Select all

tomorrow := ""
tomorrow += 1, D
FormatTime, tomorrow, %tomorrow%, d MMMM
SendInput %tomorrow%
Explained: FormatTimeMore examples
Prazul
Posts: 94
Joined: 05 Aug 2021, 15:55

Re: Send multiple keys when typing 1103 , 1105 and 4418

Post by Prazul » 31 Aug 2021, 09:49

mikeyww wrote:
31 Aug 2021, 09:33
I don't really have a lot of secrets. Most of my scripts are adapted directly from the AHK documentation.

Code: Select all

tomorrow := ""
tomorrow += 1, D
FormatTime, tomorrow, %tomorrow%, d MMMM
SendInput %tomorrow%
Explained: FormatTimeMore examples

I will not tell you again because you know it already that you are the man :bravo:

This is the syntax I needed and to be sincerely, with the actual knowledge in AHK scripting would take a lot of time to find that.

Code: Select all

FormatTime, tomorrow, %tomorrow%, d/M
Thanks :wave:
Post Reply

Return to “Ask for Help (v1)”