Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Administration of variables interface/ini
#1
built this lengthy and relatively complex macro using almost no hard coding, with variables throughout that can easily be modified in the opening declaration section (for example, several different local, network and FTP directories, html page locations, audio editor to open, video codec and on and on).

I did this because most likely I won't be around to recode and recompile when changes might be necessary (like a switch in webhosting). What is the best way to make changes to default/initial values in a compiled program?

I'm guessing either a separate mac that will generate an ini-like text file, or just the ini file.

Questions:

1. What are the mechanics of getting say 15 different values from an external file for use by compiled macro as str variables?

For example, str's in compiled macro requiring values...

Code:
Copy      Help
str ftpdir =
str netdir =
str audioeditor =

...that will be grabbed from external file:
Code:
Copy      Help
"ftp://username:password@host.com/upload/"
"X:\users\broadcasts\archive\"
"$Program Files\Sony\Soundforge\forge80.exe"


2. If I don't want to let the end user in this case be able to muck about on his own in an ini-like file (which could prove disastrous), and instead want to be able to just provide them with changes in a new file, what's the best way to do this while preserving the main macro's access to the data? If it's encryption, could you please provide a simple example given the ini data -> into compiled macro variables example above?


Thanks again for your help!

Steve
#2
Ok, got the macro to get the variables from ini via "rget" using individual rget statements. This works fine, but feel free to let me know if there's a downside to this method, or if using IStringMap, standard arrays, or other method makes more sense..

Still need help/recommendations here (rephrased from earlier post):

I don't want to let the end user in this case be able to muck about in the ini file (which could prove disastrous). What's the best way to prevent user access to the ini file's data? I should mention that, if/when changes in the ini are required, I would do them remotely and the end user would initiate an "update" routine in the macro to pull the new ini off my FTP.

I haven't quite graduated to using encryption yet, so if that's the best method, can you please help me with a simple example of using rget with an encrypted ini?

Thanks,

Steve

-------------

If it's relevant (or helps others), here is an example of the rget code in the macro:


Code:
Copy      Help
str udir pubdir editor
rget(udir "udir" "varis" "C:\app.ini")
rget(pubdir "pubdir" "varis" "C:\app.ini")
rget(editor "editor" "varis" "C:\app.ini")

...and the corresponding bit in "app.ini" text file:

Code:
Copy      Help
[varis]

udir="C:\upload\"
pubdir="FTP://uname:pw@dom.com"
editor="forge80.exe"

[another_ini_section]
#3
Use two ini files. First - editable, second - encrypted. When exe runs, it loads the encrypted file (getfile), decrypts (decrypt), writes to a temporary ini file in $temp$ folder (setfile), and gets values from it (rget).

It is easy way. If not using a temp file, would need some string parsing.


Forum Jump:


Users browsing this thread: 1 Guest(s)