| View previous topic :: View next topic |
| Author |
Message |
kc7aad Contributor

Joined: 09 Oct 2005 Posts: 53 Location: Spokane Washington
|
Posted: Tue Jan 03, 2006 4:55 am Post subject: Using variables for user defined settings |
|
|
OK.. So in one of my programs, I want to be able to change a variable, but save it when it is closed. It is a Bandwidth tester. So every once and a while, I have an internet site that has an IP Address Change, and want to to be programmable / changeable from the GUI Interface.
Possible?? How?? Do I need some sort of Config file to make it changable?? And then just change the Config file when it needs to change???
Thanks!!
kc7aad |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Tue Jan 03, 2006 2:24 pm Post subject: |
|
|
Depending on your own preference, you should probably either use a registry entry or an .INI file. I tend to use an .INI file if I want to make the application settings "portable" (i.e. moveable to an other computer). For an app. like what you are doing I would probably opt for a registry entry...
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
kc7aad Contributor

Joined: 09 Oct 2005 Posts: 53 Location: Spokane Washington
|
Posted: Wed Jan 04, 2006 2:28 am Post subject: |
|
|
| Any hints, or examples I can look at?? |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Wed Jan 04, 2006 3:10 am Post subject: |
|
|
| Code: | # **** REGISTRY EXAMPLE - by DaveŽ ***
# Use if you want to set your own default registry key
rem OPTION REGKEY,companyname\appname
# @REGREAD( <root key>, <subkey>, <name> ,<default> )
%%IP = @REGREAD(DEFAULT,,IP,)
DIALOG CREATE,Reg example,-1,0,240,99
DIALOG ADD,EDIT,IP,25,30,180,19,%%IP
DIALOG ADD,BUTTON,Save,62,90,64,24,Save
DIALOG SHOW
:Evloop
wait event
goto @event()
:Close
stop
:SaveBUTTON
# REGISTRY WRITE, <root key>, <subkey>, <name>, <value>,<type>
REGISTRY WRITE,DEFAULT,,IP,@dlgtext(IP)
goto evloop
|
_________________ cheers
Dave |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Wed Jan 04, 2006 3:16 am Post subject: |
|
|
| Code: | # **** INI FILE EXAMPLE - by DaveŽ ***
# @INIREAD(<section name>,<key name> , <default>)
INIFILE OPEN,example.ini
%%IP = @INIREAD(MAIN,IP,)
DIALOG CREATE,Ini example,-1,0,240,99
DIALOG ADD,EDIT,IP,25,30,180,19,%%IP
DIALOG ADD,BUTTON,Save,62,90,64,24,Save
DIALOG SHOW
:Evloop
wait event
goto @event()
:Close
stop
:SaveBUTTON
INIFILE OPEN,example.ini
# INIFILE WRITE, <section name>, <key name>, <string>
INIFILE WRITE,MAIN,IP,@dlgtext(IP)
goto evloop
|
_________________ cheers
Dave |
|
| Back to top |
|
 |
kc7aad Contributor

Joined: 09 Oct 2005 Posts: 53 Location: Spokane Washington
|
Posted: Wed Jan 04, 2006 5:14 am Post subject: |
|
|
Thanks Dave!! I think the INI one will be a bit easier for what I am doing right now!! I HOPE!! It is a little bit more clear text foe me.
The other added benifit, is I can go in and manually change the .ini file, and not have to screw much with having to do it with the GUI!!
Thanks.. Will let you all know either how it turns out, or how much MORE hair i've lost!!
kc7aad |
|
| Back to top |
|
 |
kc7aad Contributor

Joined: 09 Oct 2005 Posts: 53 Location: Spokane Washington
|
Posted: Wed Jan 04, 2006 7:00 am Post subject: |
|
|
WOW!!!! IT WORKED!! IT WORKED!!! YIPEE!!!!!
OK.. So here is my code.. Anything missing or maybe need to be cleaned up a bit?? Seems to work well!! I guess that's half the battle!!
Thanks Guys!!!!!
PS: If anyone has a need for all of the program files, and config file, let m eknow and i'll be more than happy to share!!
| Code: | OPTION SCALE,96
INIFILE OPEN,\IPERF\IPERF.INI
%%S1 = @INIREAD(SERVER1,NAME,)
%%S2 = @INIREAD(SERVER2,NAME,)
%%S3 = @INIREAD(SERVER3,NAME,)
%%S4 = @INIREAD(SERVER4,NAME,)
%%S5 = @INIREAD(SERVER5,NAME,)
%%S6 = @INIREAD(SERVER6,NAME,)
Title IPerf Mobile Console
DIALOG CREATE,IPerf Mobile Console,-1,0,448,369,RESIZABLE
REM *** Modified by Dialog Designer on 1/3/2006 - 21:33 ***
DIALOG ADD,GROUP,SERVERS,3,4,215,335,SERVERS
DIALOG ADD,BUTTON,SERVER1,20,10,100,100,%%S1
DIALOG ADD,BUTTON,SERVER2,20,113,100,100,%%S2
DIALOG ADD,BUTTON,SERVER3,123,10,100,100,%%S3
DIALOG ADD,BUTTON,SERVER4,123,113,100,100,%%S4
DIALOG ADD,BUTTON,SERVER5,226,10,100,100,%%S5
DIALOG ADD,BUTTON,SERVER6,226,113,100,100,%%S6
DIALOG ADD,GROUP,CUSTOM,3,224,215,123,CUSTOM
DIALOG ADD,BUTTON,CUSTOM1,20,230,100,100,%%C1
DIALOG ADD,BUTTON,CUSTOM2,20,333,100,100,%%C2
DIALOG ADD,GROUP,SERVER,126,327,112,218,SERVER
DIALOG ADD,BUTTON,START,137,332,100,100,%%START
DIALOG ADD,BUTTON,STOP,240,332,100,100,%%STOP
DIALOG ADD,STATUS,STATUSBAR,STATUSBAR
DIALOG SHOW
:Resize
:Evloop
wait event
goto @event()
:SERVER1BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%%IP1 = @INIREAD(SERVER1,IP,)
RUNH \IPERF\IPERF.EXE -c %%IP1,PIPE
INFO @PIPE()
goto evloop
:SERVER2BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%%IP2 = @INIREAD(SERVER2,IP,)
RUNH \IPERF\IPERF.EXE -c %%IP2,PIPE
INFO @PIPE()
goto evloop
:SERVER3BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%%IP3 = @INIREAD(SERVER3,IP,)
RUNH \IPERF\IPERF.EXE -c %%IP3,PIPE
INFO @PIPE()
goto evloop
:SERVER4BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%%IP4 = @INIREAD(SERVER4,IP,)
RUNH \IPERF\IPERF.EXE -c %%IP4,PIPE
INFO @PIPE()
goto evloop
:SERVER5BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%%IP5 = @INIREAD(SERVER5,IP,)
RUNH \IPERF\IPERF.EXE -c %%IP5,PIPE
INFO @PIPE()
goto evloop
:SERVER6BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%%IP6 = @INIREAD(SERVER6,IP,)
RUNH \IPERF\IPERF.EXE -c %%IP6,PIPE
INFO @PIPE()
goto evloop
:CUSTOM1BUTTON
INIFILE OPEN,\IPERF\IPERF.INI
%S = @INPUT(Server Name or IP Address,)
%T = @INPUT(Duration of Test,)
RUNH \IPERF\IPERF.EXE -c %S -t %T,PIPE
INFO @PIPE()
goto evloop
:CUSTOM2BUTTON
%%S = @INPUT(Server Name or IP Address,)
%%T = @INPUT(Duration of Test,)
RUNH \IPERF\IPERF.EXE -c %%S -t %%T,PIPE
INFO @PIPE()
goto evloop
:STARTBUTTON
RUNH \IPERF\IPERF.EXE -s
goto evloop
:STOPBUTTON
RUNH \IPERF\IPERF.EXE -r
RUNH TASKKILL /F /IM IPERF.EXE
WAIT 2
goto evloop
:Close
exit
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|