Option to add more User Variables
-
- Posts: 34
- Joined: Aug 2nd, ’14, 20:50
The User Variables are very useful. I have already run out of the custom ones. Would it be possible to have an option, when Editing, to add as many more fields as necessary? Thanks.
We may add few more in one of the next releases.
-
- Posts: 34
- Joined: Aug 2nd, ’14, 20:50
Thanks, Marko! I was proposing that the user can create as many new fields as necessary by clicking for example "Add new user variable field" button (or remove them) when in Edit mode but actually more user variables are available by just writing them in a Auto Run command in the Start Menu, which I was previously not aware, so just implement which ever way you as a developer see more appropriate
You can create as many local variables as you want -
To keep them persistent across sessions you can use a simple .ini file. Here is an example script I use in our business
This was created before there was a user variable function in FK's
WJ
; CreateWellMEDini:
/*
WellMed.ini start up for persistant data
test for .ini file in user Documents dir., if not there - create it
test A_UserName in WellMed.ini if not same ask if wants to enter info
If same exit
*/
; some globals
provider := "Null", Clinic := "Null", addr1 := "Null",
addr2 := "Null", phone := "Null", fax := "Null"
Ifexist, %A_MyDocuments%\WellMed.ini
{
;file exists
IniRead, CurUser, %A_MyDocuments%\WellMed.ini, UserInfo, user
if (CurUser = A_UserName) {
old := "y" ; y for yes is old, n for no is not match
; read in the user .ini data
IniRead, provider, %A_MyDocuments%\WellMed.ini, UserInfo, provider
IniRead, clinic, %A_MyDocuments%\WellMed.ini, UserInfo, clinic
IniRead, addr1, %A_MyDocuments%\WellMed.ini, UserInfo, addr1
IniRead, addr2, %A_MyDocuments%\WellMed.ini, UserInfo, addr2
IniRead, phone, %A_MyDocuments%\WellMed.ini, UserInfo, phone
IniRead, fax, %A_MyDocuments%\WellMed.ini, UserInfo, fax
; option to update / edit the .ini file
UpDateIni(old)
return
}
; get new user persistant info -
old := "n"
UpDateIni(old)
return
}
; need to create file and enter user data
CreateWMini()
return
;
;
UpDateIni(a)
{
global
; GUI for user persistent data
Gui, Add, Text, x12 y9 w190 h20 , Provider Name:
Gui, Add, Edit, x12 y29 w190 h20 vprovider, Edit
Gui, Add, Text, x12 y49 w180 h20 , Clinic Name:
Gui, Add, Edit, x12 y69 w290 h20 vclinic, Edit
Gui, Add, Text, x12 y89 w290 h20 , Clinic Address; Street
Gui, Add, Edit, x12 y109 w290 h20 vaddr1 , Edit
Gui, Add, Text, x12 y129 w290 h20 , Clinic Address; City`, State`, Zip
Gui, Add, Edit, x12 y149 w290 h20 vaddr2 , Edit
Gui, Add, Text, x12 y169 w190 h20 , Phone No.:
Gui, Add, Edit, x12 y189 w190 h20 vphone, Edit
Gui, Add, Text, x12 y209 w190 h20 , Fax No.:
Gui, Add, Edit, x12 y229 w190 h20 vfax, Edit
Gui, Add, Button, x12 y259 w90 h30 gWMIExit , Ok-Exit ; exit but no update
Gui, Add, Button, x132 y259 w100 h30 gWMIUpdate , OK-Update ; exit and update info
; Generated using SmartGUI Creator 4.0
; will pre-populate if .ini data is present
if (a = "y") {
GuiControl, ,provider, %provider%
GuiControl, ,clinic, %clinic%
GuiControl, ,addr1, %addr1%
GuiControl, ,addr2, %addr2%
GuiControl, ,phone, %phone%
GuiControl, ,fax, %fax%
}
Gui, Show, x127 y87 h304 w331, Review / Update User Info
Return
WMIUpdate:
Gui, submit
; update the .ini file
IniWrite, %A_UserName%, %A_MyDocuments%\WellMed.ini, UserInfo, user
IniWrite, %provider%, %A_MyDocuments%\WellMed.ini, UserInfo, provider
IniWrite, %clinic%, %A_MyDocuments%\WellMed.ini, UserInfo, clinic
IniWrite, %addr1%, %A_MyDocuments%\WellMed.ini, UserInfo, addr1
IniWrite, %addr2%, %A_MyDocuments%\WellMed.ini, UserInfo, addr2
IniWrite, %phone%, %A_MyDocuments%\WellMed.ini, UserInfo, phone
IniWrite, %fax%, %A_MyDocuments%\WellMed.ini, UserInfo, fax
;
WMIExit:
GuiClose:
Gui, destroy
return
}
;
CreateWMini() {
; create the file
FileAppend, [userinfo], %A_MyDocuments%\WellMed.ini
; now call UpDateIni(old)
old := "n"
UpDateIni(old)
return
}
It creates an .ini file in the users document directory
You would then have to have this file read in at each boot of your local FK -
Works for us and .ini files are very easy to use
Walker
To keep them persistent across sessions you can use a simple .ini file. Here is an example script I use in our business
This was created before there was a user variable function in FK's
WJ
; CreateWellMEDini:
/*
WellMed.ini start up for persistant data
test for .ini file in user Documents dir., if not there - create it
test A_UserName in WellMed.ini if not same ask if wants to enter info
If same exit
*/
; some globals
provider := "Null", Clinic := "Null", addr1 := "Null",
addr2 := "Null", phone := "Null", fax := "Null"
Ifexist, %A_MyDocuments%\WellMed.ini
{
;file exists
IniRead, CurUser, %A_MyDocuments%\WellMed.ini, UserInfo, user
if (CurUser = A_UserName) {
old := "y" ; y for yes is old, n for no is not match
; read in the user .ini data
IniRead, provider, %A_MyDocuments%\WellMed.ini, UserInfo, provider
IniRead, clinic, %A_MyDocuments%\WellMed.ini, UserInfo, clinic
IniRead, addr1, %A_MyDocuments%\WellMed.ini, UserInfo, addr1
IniRead, addr2, %A_MyDocuments%\WellMed.ini, UserInfo, addr2
IniRead, phone, %A_MyDocuments%\WellMed.ini, UserInfo, phone
IniRead, fax, %A_MyDocuments%\WellMed.ini, UserInfo, fax
; option to update / edit the .ini file
UpDateIni(old)
return
}
; get new user persistant info -
old := "n"
UpDateIni(old)
return
}
; need to create file and enter user data
CreateWMini()
return
;
;
UpDateIni(a)
{
global
; GUI for user persistent data
Gui, Add, Text, x12 y9 w190 h20 , Provider Name:
Gui, Add, Edit, x12 y29 w190 h20 vprovider, Edit
Gui, Add, Text, x12 y49 w180 h20 , Clinic Name:
Gui, Add, Edit, x12 y69 w290 h20 vclinic, Edit
Gui, Add, Text, x12 y89 w290 h20 , Clinic Address; Street
Gui, Add, Edit, x12 y109 w290 h20 vaddr1 , Edit
Gui, Add, Text, x12 y129 w290 h20 , Clinic Address; City`, State`, Zip
Gui, Add, Edit, x12 y149 w290 h20 vaddr2 , Edit
Gui, Add, Text, x12 y169 w190 h20 , Phone No.:
Gui, Add, Edit, x12 y189 w190 h20 vphone, Edit
Gui, Add, Text, x12 y209 w190 h20 , Fax No.:
Gui, Add, Edit, x12 y229 w190 h20 vfax, Edit
Gui, Add, Button, x12 y259 w90 h30 gWMIExit , Ok-Exit ; exit but no update
Gui, Add, Button, x132 y259 w100 h30 gWMIUpdate , OK-Update ; exit and update info
; Generated using SmartGUI Creator 4.0
; will pre-populate if .ini data is present
if (a = "y") {
GuiControl, ,provider, %provider%
GuiControl, ,clinic, %clinic%
GuiControl, ,addr1, %addr1%
GuiControl, ,addr2, %addr2%
GuiControl, ,phone, %phone%
GuiControl, ,fax, %fax%
}
Gui, Show, x127 y87 h304 w331, Review / Update User Info
Return
WMIUpdate:
Gui, submit
; update the .ini file
IniWrite, %A_UserName%, %A_MyDocuments%\WellMed.ini, UserInfo, user
IniWrite, %provider%, %A_MyDocuments%\WellMed.ini, UserInfo, provider
IniWrite, %clinic%, %A_MyDocuments%\WellMed.ini, UserInfo, clinic
IniWrite, %addr1%, %A_MyDocuments%\WellMed.ini, UserInfo, addr1
IniWrite, %addr2%, %A_MyDocuments%\WellMed.ini, UserInfo, addr2
IniWrite, %phone%, %A_MyDocuments%\WellMed.ini, UserInfo, phone
IniWrite, %fax%, %A_MyDocuments%\WellMed.ini, UserInfo, fax
;
WMIExit:
GuiClose:
Gui, destroy
return
}
;
CreateWMini() {
; create the file
FileAppend, [userinfo], %A_MyDocuments%\WellMed.ini
; now call UpDateIni(old)
old := "n"
UpDateIni(old)
return
}
It creates an .ini file in the users document directory
You would then have to have this file read in at each boot of your local FK -
Works for us and .ini files are very easy to use
Walker