easier way

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cry8wolf9
Posts: 6
Joined: 03 Dec 2018, 04:26

easier way

12 Dec 2018, 03:01

so i alter this scrip alot and im looking for an easier way to do it
Here is the current script
Spoiler
I would love to make the send inputs easier to alter
something like this
Spoiler
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: easier way

12 Dec 2018, 03:25

You can try using a array and a for loop

Here is an example,

Code: Select all

#SingleInstance,force
Your_List:= [".b Brewer 4361",".b Grinder 4449",".b Shelving 3908",".b Wifi 3708",".b Ice-Machine 2599",".b Blender 2178",".b Table 1286",".b Dishwasher 896",".b Seat 50",".b Espresso 44",".b Boiler 52",".b Wastebin 43",".b Refrigerator 40",".b Infuser 35",".b Sofa 24",".b Dispenser 20",".b Creamer 12",".b Press 8",".b Pitcher 6",".b Urn 5",".b Airpot 4",".b Sleeve-Holder 3",".b Warmers 2",".b Spigot 2",".b Juicer 2",".b Teapot 2",".b Pump 1",".b Delivery 1",".b Grill 1",""]
*numpad1::
	For,k,v in Your_List
		{
			SendInput,% Your_List[k]
			SendInput {Enter}
			Sleep,100
		}
	return
*esc::Exitapp
cry8wolf9
Posts: 6
Joined: 03 Dec 2018, 04:26

Re: easier way

12 Dec 2018, 03:36

that has an error on line 3
User avatar
Hellbent
Posts: 2109
Joined: 23 Sep 2017, 13:34

Re: easier way

12 Dec 2018, 03:39

cry8wolf9 wrote:
12 Dec 2018, 03:36
that has an error on line 3
Line 3 is the hotkey, try some other hotkey.
cry8wolf9
Posts: 6
Joined: 03 Dec 2018, 04:26

Re: easier way

12 Dec 2018, 22:53

that worked but its still a pain to edit it. every time i edit it i change all of the values is there a way to make it even more dumbed down? all i need it it to do is pop out the .b commands with a 6 second pause in between.
Hatsuko
Posts: 15
Joined: 09 May 2018, 16:56

Re: easier way

13 Dec 2018, 02:27

Array can be written in multiple lines... is this easier to edit?

Code: Select all

#SingleInstance,force
Your_List:= [".b Brewer 4361"
,".b Grinder 4449"
,".b Shelving 3908"
,".b Wifi 3708"
,".b Ice-Machine 2599"
,".b Blender 2178"
,".b Table 1286"
,".b Dishwasher 896"
,".b Seat 50"
,".b Espresso 44"
,".b Boiler 52"
,".b Wastebin 43"
,".b Refrigerator 40"
,".b Infuser 35"
,".b Sofa 24"
,".b Dispenser 20"
,".b Creamer 12"
,".b Press 8"
,".b Pitcher 6"
,".b Urn 5"
,".b Airpot 4"
,".b Sleeve-Holder 3"
,".b Warmers 2"
,".b Spigot 2"
,".b Juicer 2"
,".b Teapot 2"
,".b Pump 1"
,".b Delivery 1"
,".b Grill 1"]
*f3::
	For,k,v in Your_List
		{
			SendInput,% Your_List[k]
			SendInput {Enter}
			Sleep,100
		}
	return
*esc::Exitapp
Hatsuko
Posts: 15
Joined: 09 May 2018, 16:56

Re: easier way

13 Dec 2018, 02:59

I just recall that string can also be written in multiple lines. See if this works for you.

Code: Select all

#SingleInstance,force
Your_List = 
(
.b Brewer 4361
.b Grinder 4449
.b Shelving 3908
.b Wifi 3708
.b Ice-Machine 2599
.b Blender 2178
.b Table 1286
.b Dishwasher 896
.b Seat 50
.b Espresso 44
.b Boiler 52
.b Wastebin 43
.b Refrigerator 40
.b Infuser 35
.b Sofa 24
.b Dispenser 20
.b Creamer 12
.b Press 8
.b Pitcher 6
.b Urn 5
.b Airpot 4
.b Sleeve-Holder 3
.b Warmers 2
.b Spigot 2
.b Juicer 2
.b Teapot 2
.b Pump 1
.b Delivery 1
.b Grill 1
)
*f3::
	arr := StrSplit(Your_List, "`n")
	For,k,v in arr
		{
			SendInput,% v
			SendInput {Enter}
			Sleep,100
		}
	return
*esc::Exitapp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: OrangeCat, scriptor2016 and 126 guests