(HELP) How to automate and execute all scripts into One Command

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Valkyrie666
Posts: 7
Joined: 07 Feb 2023, 07:57

(HELP) How to automate and execute all scripts into One Command

17 Mar 2024, 11:39

Hi!!
I am looking forward to someone who can help me with this idea of automating all commands into one plus inserting certain keys.
I am a data entry enocder and my total daily quota just reached one thousand and I won't be able to finish it all.
I'm not an autohotkey pro although I learned some basics myself and with the help of other people from this community.
Be advised that the first part of the script I believe is from version 1 since my department just gave me an old Windows 8.1 laptop and "Alt + Tab" in Windows 8.1 is utilised by using an old compex script from version 1.

I am running both versions.

Where:

FONTS IN RED IS Version: 1.1.36
FONTS IN BLUE IS Version 2.0.2

But anyways, I want to combine and automate all the scripts into one by just typing the word FX2. That should automate all the scripts and made it look ike the laptop is typing by itself. Also, I want to loop this 50 times.

Here is the script and I have no idea how to automate and insert two additiona keys like "ENTER and "DOWN ARROW" key in between.

FX2::

ins::
Sleep, 20
Send, ^c ; Ctrl + C
return

#NoEnv
Process, Priority, ,High
#SingleInstance Force

Del::
WinGet, AllWinsHwnd, List
Loop, % AllWinsHwnd
{
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
If !(exStyle & 0x100)
Continue
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
WinGetTitle, active_title, A
If CurrentWinTitle = %active_title%
continue
WinActivate, %CurrentWinTitle%
break
}
return


PgUp::^a
PgDn::!p
Home::^v
End::{
Send "{Alt down}{a down}s"
Send "{Alt up}{up}"
}


PLUS


PRESS ENTER KEY

#NoEnv
Process, Priority, ,High
#SingleInstance Force

Del::
WinGet, AllWinsHwnd, List
Loop, % AllWinsHwnd
{
WinGet, exStyle, exStyle, % "ahk_id" AllWinsHwnd%A_Index%
If !(exStyle & 0x100)
Continue
WinGetTitle, CurrentWinTitle, % "ahk_id " AllWinsHwnd%A_Index%
WinGetTitle, active_title, A
If CurrentWinTitle = %active_title%
continue
WinActivate, %CurrentWinTitle%
break
}
return


PLUS

DOWN ARROW KEY

(Then back to the very first script)


I want to loop this 50 times then stop at the 50th time.
I want to automate all the commands and let the computer type by itself by just pressing FX2.
I am tired of pressing all the scripts repeatedly since I am inputting a thousand of file every day.

Be advised I am usin both versions of autohotkey. Autohotkey 1.1.36 and Autohotkey 2.0.2.
Should this 2 versions cannot co-exist with this automation. What woud be your advise?
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: (HELP) How to automate and execute all scripts into One Command

18 Mar 2024, 04:39

I see you want to combine all those keystrokes into FX2 right?
And the addional keys, it is like you want to fire them not use them as names for hotkeys for other tasks
If so
Make sure you do a copy of your work before you test this

Code: Select all

#requires autohotkey v2.0
#singleinstance force
processsetpriority('high')
sleeptime := 250
looptimes := 1

esc::exitapp()

f7:: {
    loop looptimes
        combined()
}

combined() {
    ; ins
    sendinput('^c')

    sleep(sleeptime)

    ; del
    del()
    del() {
        hwnds := wingetlist()
        for each, hwnd in hwnds {
            exstyle := wingetexstyle('ahk_id ' hwnd)
            if !(exstyle & 0x100)
                continue
            wintitle := wingettitle('ahk_id ' hwnd)
            activewintitle := wingettitle('a')
            if wintitle = activewintitle
                continue
            winactivate(wintitle)
            break
        }
    }

    sleep(sleeptime)

    ; pgup
    sendinput('^a')

    sleep(sleeptime)

    ; pgdn
    sendinput('!p')

    sleep(sleeptime)

    ; home
    sendinput('^v')

    sleep(sleeptime)

    ; end
    sendinput('{alt down}{a down}s{alt up}{a up}')

    sleep(sleeptime)

    ; press enter
    sendinput('{enter}')

    sleep(sleeptime)

    ; del
    del()

    sleep(sleeptime)

    ; press down arrow
    sendinput('{down}')

    sleep(sleeptime)
}
Edit: replaced FX2 with F7
Last edited by Smile_ on 21 Mar 2024, 13:19, edited 1 time in total.
Valkyrie666
Posts: 7
Joined: 07 Feb 2023, 07:57

Re: (HELP) How to automate and execute all scripts into One Command

21 Mar 2024, 08:24

@Smile_

First off, Thanks a lot for helping me out with these automation. However, I realised that the FX2 text deletes or supercedes the data entry in my excel cell. Woud it be possible to change it to F7 or backspace instead?

Second, I'm having trouble with this part:

; end
sendinput('{alt down}{a down}s{alt up}{a up}')

sleep(sleeptime)

; press enter
sendinput('{enter}')

sleep(sleeptime)

WHERE: "End" key is Press and Hold "Alt key down" , plus press and hold "A key down" then strike the "S key"

afterwards execute the ENTER button.

It doesn't work as intended. The rest does fine though.

I'l be waiting for your improvisation and I'm excited to test it out.
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: (HELP) How to automate and execute all scripts into One Command

21 Mar 2024, 13:18

No more FX2 now. it is replaced with F7. (Updated the script above)
But regarding what you mentioned about the end key, I can't find any issue with sendinput('{alt down}{a down}s{alt up}{a up}'), I see it does exactly what you said.
Valkyrie666
Posts: 7
Joined: 07 Feb 2023, 07:57

Re: (HELP) How to automate and execute all scripts into One Command

29 Mar 2024, 03:14

Smile_ wrote:
21 Mar 2024, 13:18
No more FX2 now. it is replaced with F7. (Updated the script above)
But regarding what you mentioned about the end key, I can't find any issue with sendinput('{alt down}{a down}s{alt up}{a up}'), I see it does exactly what you said.
@Smile_

First off, I apologise for not being able to correspod to you in the past days since I am really quite busy.

However, I really thank you for making this automation possible. It really reduced the amount of time needed to finish my task. Without it, it could have been impossible. Thanks to you. :dance:

The "End" button is definitely working now.

I am just wondering though if it is possible to insert individual sleeptime to each function.
Exampe like the sleeptime for:

; ins
sendinput('^c')

sleep(sleeptime)


is relatively quite shorter like "50"

than

; end
sendinput('{alt down}{a down}s{alt up}{a up}')

sleep(sleeptime)


which might be "100"

Just thinking though So I can make revisions myself.

But, Thanks to you mate! Cheers! :superhappy:
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: (HELP) How to automate and execute all scripts into One Command

29 Mar 2024, 08:43

Yeah why not, instead of using sleep(sleeptime), use the amount you want, like sleep(50)

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Dav22, Draken, loek6000, vmech and 103 guests