Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    1,546

    INI File question?

    I need some help with an INI file that I'm trying to use for a simple substitution-cypher (project.apz is attached)
    The INI file contains the following data:

    [values]

    a = 07
    b = 14
    c = 23
    d = 38
    e = 48
    f = 54
    g = 69
    h = 72
    i = 87
    j = 91
    k = 10
    l = 18
    m = 12
    n = 13
    o = 84
    p = 19
    q = 11
    r = 67
    s = 78
    t = 92
    u = 20
    v = 51
    w = 22
    x = 21
    y = 77
    z = 42

    Basically what I'm trying to achieve is, if the user enters a 'letter' value (eg. johnsmith) into InputBox-1,
    the corresponding 'number' value (as governed by the INI file) should appear in InputBox-2.

    So in this example, if 'johnsmith' was entered into InputBox-1, then '918472137812879272' should appear in InputBox-2.

    At the moment, I'm using the following code:

    result = Input.GetText("Input1");
    value_data = INIFile.GetValue(_SourceFolder .. "\\cypher.ini", "values", result);
    Input.SetText("Input2", value_data);

    ... but the problem of course, is that it only works if the user inputs a SINGLE letter. I need it to work REGARDLESS of how many letters are entered, and it needs to adhere to the values as specified in the INI file.

    I've been playing around with both the String.Replace and INIFile.GetValue functions but can't figure out a way to achieve this. Can anyone help me out here, please? (I'm guessing that some kind of TableFunction might be required which I'm not too good with).

  2. #2
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    Place this on the On Click event of the button:

    Code:
    result = Input.GetText("Input1");
    ReturnString="";
    for i=1, String.Length(result)do
    	sChar = String.Mid(result, i, 1);
    	value_data = INIFile.GetValue(_SourceFolder .. "\\cypher.ini", "values", sChar);
    	ReturnString=ReturnString..value_data;
    end
    Input.SetText("Input2", ReturnString);
    Regards, CB
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

  3. #3
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    1,546
    Thanks CB,

    You're a bloody legend, mate. Couldn't have asked for a better solution!

  4. #4
    Join Date
    Apr 2007
    Location
    Raalte, OV, Netherlands
    Posts
    3,287
    hehe no problem, it worked well?
    Bas Groothedde
    Imagine Programming :: Blog :: Familiar people here

    My AMS Plugins:

Similar Threads

  1. How to read one INI file encripted?
    By Solmos in forum AutoPlay Media Studio 7.5
    Replies: 3
    Last Post: 07-12-2008, 10:48 PM
  2. environment variables in ini file
    By vladguan in forum Setup Factory 7.0
    Replies: 3
    Last Post: 07-07-2008, 10:24 PM
  3. Probably a dumb question
    By beeneeb in forum Visual Patch 2.0
    Replies: 1
    Last Post: 10-12-2006, 01:19 PM
  4. ini file problems.. help
    By AciDFuRY in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 02-26-2006, 06:46 PM
  5. ini end of file space
    By gerankel in forum Setup Factory 6.0
    Replies: 3
    Last Post: 01-03-2002, 09:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts