{help}insert 0001 to 9999 with a hotkey Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
nightguerreiro
Posts: 2
Joined: 06 Jan 2018, 10:28

{help}insert 0001 to 9999 with a hotkey

06 Jan 2018, 11:15

Hi there, never used AHK before,i've looked in the forum to see if i could find the solution for my problem but couldnt find it, so what im looking is:
lets say my hotkey is F3
i need a script that every time a press F3 it types for me the number from 0001 to 9999
so lets say i press F3 it would type 0001 then i press it again and it would type 0002
and so go on, also if i could selection from where it would start, let say i used the key to go till 2000 the i turn off my pc and go to sleep, next day i wanna start from 2000 so i dont have to start from 0001 again, i know i would have to edit the script but as long it has a place where i can edit the number.

I hope i made it as cleary as possible, would be awesome if someone could help with it, thanks a heaps!!
User avatar
noname
Posts: 509
Joined: 19 Nov 2013, 09:15

Re: {help}insert 0001 to 9999 with a hotkey  Topic is solved

06 Jan 2018, 11:35

Code: Select all

F3::
IniRead, n, %A_ScriptDir%\number.ini, Section, counter, 0000
n++
m_new:=format("{1:04}",n)
send %m_new%
IniWrite,%m_new%, %A_ScriptDir%\number.ini, Section, counter
return
Last edited by noname on 06 Jan 2018, 11:56, edited 1 time in total.
soundcloud.com/user-32706894
garry
Posts: 1903
Joined: 22 Dec 2013, 12:50

Re: {help}insert 0001 to 9999 with a hotkey

06 Jan 2018, 16:06

@noname , thank you works fine
changed a little , so not each time write to ini

Code: Select all

#warn
IniRead, n, %A_ScriptDir%\number.ini, Section, counter, 0000

F3::
n++
m_new:=format("{1:04}",n)
msgbox, 262208, , %m_new%,1
return

esc::
IniWrite,%m_new%, %A_ScriptDir%\number.ini, Section, counter
msgbox, 262208, ,Script now close and save number,2
exitapp
BoBo
Posts: 2519
Joined: 13 May 2014, 17:15

Re: {help}insert 0001 to 9999 with a hotkey

06 Jan 2018, 16:16

garry wrote:@noname , thank you works fine
changed a little , so not each time write to ini

Code: Select all

#warn
IniRead, n, %A_ScriptDir%\number.ini, Section, counter, 0000

F3::
n++
m_new:=format("{1:04}",n)
msgbox, 262208, , %m_new%,1
return

esc::
IniWrite,%m_new%, %A_ScriptDir%\number.ini, Section, counter
msgbox, 262208, ,Script now close and save number,2
exitapp
OnExit :?:
garry
Posts: 1903
Joined: 22 Dec 2013, 12:50

Re: {help}insert 0001 to 9999 with a hotkey

06 Jan 2018, 16:27

@BoBo , you mean when close the script in tray menu
it's better then use ESC button by mistake

Code: Select all

#warn
#Persistent
OnExit, ExitSub
IniRead, n, %A_ScriptDir%\number.ini, Section, counter, 0000
return

F3::
n++
m_new:=format("{1:04}",n)
msgbox, 262208, , %m_new%,1
return

exitsub:
IniWrite,%m_new%, %A_ScriptDir%\number.ini, Section, counter
msgbox, 262208, ,Script now close and save number,2
exitapp

/*
esc::
IniWrite,%m_new%, %A_ScriptDir%\number.ini, Section, counter
msgbox, 262208, ,Script now close and save number,2
exitapp
*/
nightguerreiro
Posts: 2
Joined: 06 Jan 2018, 10:28

Re: {help}insert 0001 to 9999 with a hotkey

06 Jan 2018, 17:26

noname wrote:

Code: Select all

F3::
IniRead, n, %A_ScriptDir%\number.ini, Section, counter, 0000
n++
m_new:=format("{1:04}",n)
send %m_new%
IniWrite,%m_new%, %A_ScriptDir%\number.ini, Section, counter
return
Worked like a charm, thanks you so much! i had some problems to select where the number could start in case i wanna go to a specific number, but then i just noticed i just needed to edit the number.ini file.
thanks once again

and thanks everyone else in this post for trying to help, you guys are awesome!!

Return to “Ask For Help”

Who is online

Users browsing this forum: AHK_user, blad4, grimboto, synnapt and 252 guests