Hi,
I wonder how to set up a checkbox, which would keep a desired setting - once it was set up. Means: If the user has set the check box, that email should always be deleted on the pop3server (after having downloaded emails), one should not have to use the checkbox again, which would cause a mess, if it is being remembered only occasionally.
Cheers,
George
Permanent first time set-up
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Use EditIniFile> and ReadIniFile>
Here's an example:
Run it over and over again and you will see that your previous setting is saved and is displayed in the dialog.
Here's an example:
Code: Select all
IfFileExists>%TEMP_DIR%CheckBoxSetting.ini,Continue
WriteLn>%TEMP_DIR%CheckBoxSetting.ini,wresult,[Setting]
WriteLn>%TEMP_DIR%CheckBoxSetting.ini,wresult,CheckBox=False
Label>Continue
ReadIniFile>%TEMP_DIR%CheckBoxSetting.ini,Setting,CheckBox,CheckBoxSetting
Dialog>Dialog1
Caption=Dialog1
Width=314
Height=94
Top=112
Left=46
CheckBox=msCheckBox1,Do Something,40,24,97,%CheckBoxSetting%
Button=Ok,176,24,75,25,3
EndDialog>Dialog1
Show>Dialog1,r1
If>%DIALOG1.MSCHECKBOX1%=False
EditIniFile>%TEMP_DIR%CheckBoxSetting.ini,Setting,CheckBox,False
Else
EditIniFile>%TEMP_DIR%CheckBoxSetting.ini,Setting,CheckBox,True
EndIf
MDL>Checkbox = %CheckBoxSetting%
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Resulting question
Well, beginner that I am, I tried to decode your example (thank you for it) by reading the help file and erasing and inserting again paragraph by paragraph.
But another question occured to me: Which road should one take, that
- the script could be compiled and distributed plus
- the user won`t be asked any question, which a scripter could avoid?
Means, which path could I safely enter, that the ini-file would neither be erased (as would happen sooner or later in the system temp directory), nor cause a fuzz?
Checking the help I ran into:
Input>path,Please enter directory to create :
CreateDir>path
But this would cause even more code to produce, when it would be much more sufficient to save it in the same directory as where the macro would be. BUT - now imagine how many users would not create a subdirectory, but rather run any file directly from the desktop ... Creating a subdirectory there would not be the best idea. Thus - a minimum installing routine seems to be the best thing to do or would anyone more experienced have a better plan
Cheers,
George
But another question occured to me: Which road should one take, that
- the script could be compiled and distributed plus
- the user won`t be asked any question, which a scripter could avoid?
Means, which path could I safely enter, that the ini-file would neither be erased (as would happen sooner or later in the system temp directory), nor cause a fuzz?
Checking the help I ran into:
Input>path,Please enter directory to create :
CreateDir>path
But this would cause even more code to produce, when it would be much more sufficient to save it in the same directory as where the macro would be. BUT - now imagine how many users would not create a subdirectory, but rather run any file directly from the desktop ... Creating a subdirectory there would not be the best idea. Thus - a minimum installing routine seems to be the best thing to do or would anyone more experienced have a better plan
Cheers,
George
The sample script creates the ini if it does not exist. If you are concerned that the file will be deleted from the temp directory, put the file in any other directory where it will not be deleted. The Windows folder is usually safe from deletion. Or, as you pointed out, you could create you own directory for example, under C:\program files.
I generally do not ask the user where they want items to be placed, if you do that you run into the same problem you're facing now. You have to find a location to store their choices so that your program can use that data next time it's run.
Another possibility would be to not use an ini file but create a registry entry instead. I would recommend this only if you are comfortable dealing with the registry. Look in help under RegistryReadKey> and RegistryWriteKey>.
I generally do not ask the user where they want items to be placed, if you do that you run into the same problem you're facing now. You have to find a location to store their choices so that your program can use that data next time it's run.
Another possibility would be to not use an ini file but create a registry entry instead. I would recommend this only if you are comfortable dealing with the registry. Look in help under RegistryReadKey> and RegistryWriteKey>.
-
- Pro Scripter
- Posts: 68
- Joined: Wed Dec 07, 2005 7:13 am
Works all right, now how to hide it in an extra setup?
Hm, yes, ok, as a newsbie I better would not mess with someone else`s registry ...
Concerning the temp registry, I thought it would be awful, if someone would erase the the content in the temp directory regularly as many programs offer.
Nevertheless, guess, I misinterpreted something here.
Ok, since there will be more set-up options, I would like to hide all of these under a button "Setup".
The full script should later be able to run all by itself, with occasional options that a user could interfere here and there. Otherwise automatic processes could tend to irritate the computer owner a little too much...
Concerning the temp registry, I thought it would be awful, if someone would erase the the content in the temp directory regularly as many programs offer.
Nevertheless, guess, I misinterpreted something here.
Ok, since there will be more set-up options, I would like to hide all of these under a button "Setup".
The full script should later be able to run all by itself, with occasional options that a user could interfere here and there. Otherwise automatic processes could tend to irritate the computer owner a little too much...