Any help would be greatly appreciated.
I have a specialized config sheet I use to configure routers that have about twenty different variables. I ended up using Notepad++ along with Autohotkey to do a search and replace.
I will include a short list as it will make the point.
In my config sheet I want to search and replace these variables inside it that file these variables are listed allover the file to create further Autohotkey scripts to create labels, config updates and emails.
workorder
srwnumber
new-device
old-device
old-hub
new-asset
new-serial
What I was trying to figure out is have one piece of code that would loop through a list and replace the search and replace variables.
I don't know how to do array's and loops properly but my idea to do this would be something like this A list of those variable for search and replace So the inbox variable would be a variable and so would the question. Then I could loop through the questions while the variables would be updated.
This way I could always add and delete variables without having to have a giant list of hard code.
::ncvorep::
SetKeyDelay, 75,75
null := ""
inputbox, variable1v, variable2v
If %variable1v% <> %null%
{
send ^h
send Workorder{tab}{+tab}
send Workorder{space}%variable1v%
send !a
}
; this blanks out the variable if the variable1v is blank.
else if workorderv = %null%
{ send ^h
send workorder {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
more below.
::ncvorep::
SetKeyDelay, 75,75
null := ""
inputbox, workorderv, Enter Work Order #
If workorderv <> %null%
{
send ^h
send workorder{tab}{+tab}
send workorder{space}%workorderv%
send !a
}
else if workorderv = %null%
{ send ^h
send workorder {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
I had to create something like this to use along with Notepad++ to search and replace to get it done.
;Last update Tue, Feb 14, 2017 15 18 03:18:47 PM
#SingleInstance force
#Warn
; template to setup cvo search and replace segment.
::ncvorep::
SetKeyDelay, 75,75
null := ""
inputbox, workorderv, Enter Work Order #
If workorderv <> %null%
{
send ^h
send workorder{tab}{+tab}
send workorder{space}%workorderv%
send !a
}
else if workorderv = %null%
{ send ^h
send workorder {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
null := ""
inputbox, srwnumberv, Enter Service Order #
If srwnumberv <> %null%
{
send ^h
send srwnumber{tab}{+tab}
send srwnumber{space}%srwnumberv%
send !a
}
else if srwnumberv = %null%
{ send ^h
send srwnumber {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
null := ""
inputbox, new-devicev, Enter New Device Name #
If new-devicev <> %null%
{
send ^h
send new-device{tab}{+tab}
send new-device{space}%new-devicev%
send !a
}
else if new-devicev = %null%
{ send ^h
send new-device {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
null := ""
inputbox, old-devicev, Enter Old Device Name #
If old-devicev <> %null%
{
send ^h
send old-device{tab}{+tab}
send old-device{space}%old-devicev%
send !a
}
else if old-devicev = %null%
{ send ^h
send old-device {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
null := ""
inputbox, old-hubv, Enter Old Connecting Device #
If old-hubv <> %null%
{
send ^h
send old-hub{tab}{+tab}
send old-hub{space}%old-hubv%
send !a
}
else if old-hubv = %null%
{ send ^h
send old-hub {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
null := ""
inputbox, new-assetv, Enter New Asset #
If new-assetv <> %null%
{
send ^h
send new-asset{tab}{+tab}
send new-asset{space}%new-assetv%
send !a
}
else if new-assetv = %null%
{ send ^h
send new-asset {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
null := ""
inputbox, new-serialv, Enter New Serial Number #
If new-serialv <> %null%
{
send ^h
send new-serial{tab}{+tab}
send new-serial{space}%new-serialv%
send !a
}
else if new-serialv = %null%
{ send ^h
send new-serial {tab}{+tab}
send ^a
send {backspace}
send !a
Exit
}
return