Dialog Input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • abnrange
    No longer a forum member
    • Feb 2006
    • 346

    Dialog Input

    Need helping getting value from INI file and dispalying the information into the dialog.input pop-up. Below is the code which, has the location of the data. Not sure how to pass the data from an INI file to the dialog.input. Thanks in advanced!


    s_File[1] = _SourceFolder.."\\tRecs\\"..AccName..".ini"
    PASS = INIFile.GetValue(s_File[1], "Basic Info", "PASS");
    PASS1 = Dialog.Input("Assessment Password", "Add Password to Student Assessment - Leave Blank for None:", "", MB_ICONQUESTION);
  • longedge
    Indigo Rose Customer
    • Aug 2003
    • 2498

    #2
    I'm not quite sure about what you are asking. You say you want to "pass the data from an INI file to the dialog.input", is that to pre-fill the password which seems a bit strange but nevertheless that would be -

    Code:
    PASS1 = Dialog.Input("Assessment Password", "Add Password to Student Assessment - Leave Blank for None:", PASS, MB_ICONQUESTION);
    but what I think you might be meaning to ask is how to do get the result of the input and make a comparison with the correct password which you have already 'collected' from the ini file as "PASS" in which case it might be something like -

    Code:
    PASS1 = Dialog.Input("Assessment Password", "Add Password to Student Assessment - Leave Blank for None:", "", MB_ICONQUESTION);
    if PASS~=PASS1 then
    Application.Exit()
    else
    result = Dialog.Message("Notice", "That's right. Carry on.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end

    Comment

    • abnrange
      No longer a forum member
      • Feb 2006
      • 346

      #3
      The way the app works is as follows. I have two buttons. The first saves new info and the other saves edited info. For the Save Edit Button, I wanted to call the existing password into the dialog input, so the user would not have to retype the password - But also give the option to change if needed. Hope this make more sense. Thanks

      Comment

      • longedge
        Indigo Rose Customer
        • Aug 2003
        • 2498

        #4
        Ah... right, the first option then. Just use the string variable you have already set "PASS". I'd change the wording though and say something like "To retain this password just hit OK." that'll set the variable "PASS1" to the same as "PASS" and then really you don't need to do anything else.

        edit - You could also test for a change and only if PASS ~= PASS1 go on to write the new information into the ini file.
        Last edited by longedge; 07-13-2008, 10:38 AM.

        Comment

        • abnrange
          No longer a forum member
          • Feb 2006
          • 346

          #5
          Not having much luck. Can you elaborate a bit more? Thanks

          Comment

          • mwreyf1
            Indigo Rose Customer
            • Aug 2004
            • 417

            #6
            That makes NO sense.

            Why even prompt for a password if your going to populate it for the user?

            That's ilogical.

            Comment

            • longedge
              Indigo Rose Customer
              • Aug 2003
              • 2498

              #7
              Something like this in the on show or in the project actions -

              Code:
              --set a counter for the number of tries
              count=0
              
              -- I'ver set the password here but you collect it from the ini file.
              old_pass = "password"
              
              --allow user to view and change if required the password
              --if the password is unchanged then just carry on
              --if a new password has been entered then confirm it before carrying on
              entered_pass = Dialog.Input("Enter Data", "Your current password.Change it here if you wish:" , old_pass, MB_ICONQUESTION)
              if entered_pass~=old_pass then
              while entered_pass~=entered_pass1 do
              entered_pass1 = Dialog.Input("Confirm new Password", "Please re-enter your new password:", "", MB_ICONQUESTION);
              count = count+1
              if count==3 then
              Application.Exit()
              end
              end
              end
              
              --That's the new password confirmed use the variable entered_pass to write out to your ini file.

              Comment

              • longedge
                Indigo Rose Customer
                • Aug 2003
                • 2498

                #8
                Originally posted by mwreyf1 View Post
                That makes NO sense.

                Why even prompt for a password if your going to populate it for the user?

                That's ilogical.
                As I understand it, it's a prompt for a password *change* that is fired by a "change password" button, not a new password.

                There's all sorts of questions in my mind like what prior checks are there that the current user isn't just changing someone else's password 'for fun' but I'm sure that abnrange is taking that into account - presumably they're already logged in?
                Last edited by longedge; 07-13-2008, 02:08 PM.

                Comment

                • abnrange
                  No longer a forum member
                  • Feb 2006
                  • 346

                  #9
                  I need to populate the password on button 2 which only saves the changed assessment. The way I have it setup is as follows. I have one Administartor who creates Student Assessments, saves the new data. Button two is for the Administrator to modifty an existing assessment - When the admin clicks button two, it prompts with the original password with the option to change. Only try to save a step for the admin user. Does someone have a better solution? All My data save to ini files. See sample below. Thanks

                  -- Ask the user if they added password

                  PASS = Dialog.Input("Assessment Password", "Add Password to Student Assessment - Leave Blank for None:", "", MB_ICONQUESTION);
                  --Application.SaveValue("User Info", "Pass", PASS);
                  --nChoice = Dialog.Message("Reminder", "You must create a password before saving. Did you create a password?", MB_YESNO, MB_ICONNONE, MB_DEFBUTTON2);
                  -- If yes was chosen, exit the application.
                  --if nChoice == 6 then

                  sName1 = Input.GetText("R-1");
                  sName2 = Input.GetText("R-2");
                  sTeacher = Input.GetText("R-3");
                  sClassroom = Input.GetText("R-4");
                  sDiscipline = Input.GetText("R-5");
                  sObjectives = Input.GetText("R-6");
                  sProvoke = Input.GetText("R-7");
                  sCode = Input.GetText("SCode");
                  --PASS = Input.GetText("PASS");
                  --sPIC = Input.GetText("R-Pic");

                  if sName1 == "" or sName2 == "" or sTeacher == "" or sClassroom == "" or sDiscipline == "" or sObjectives == "" or sCode == "" then
                  result = Dialog.Message("Notice", "Fill in all required fields!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
                  Application.ExitScript();
                  end

                  AccName = sCode..", "..sName1
                  DoesRecExist = File.DoesExist(_SourceFolder.."\\tRecs\\"..AccName ..".zip");

                  --does not allowed over wirtting of existing file-----
                  if DoesRecExist then
                  result = Dialog.Message("Notice", AccName.." Already Exists!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
                  Application.ExitScript();
                  end



                  s_File = {};s_File1 = {};s_File2 = {};s_File3 = {};s_File4 = {}
                  s_File[1] = _SourceFolder.."\\tRecs\\"..AccName..".ini"
                  s_File2[1] = _SourceFolder.."\\tRecs\\"..AccName.."-sProvoke.txt"
                  s_File3[1] = _SourceFolder.."\\tRecs\\"..AccName.."-sDiscipline.txt"
                  s_File4[1] = _SourceFolder.."\\tRecs\\"..AccName.."-sObjectives.txt"
                  --s_File5[1] = _SourceFolder.."\\tRecs\\"..AccName.."-sCode.txt"


                  INIFile.SetValue(s_File[1], "Basic Info", "PASS", PASS);
                  INIFile.SetValue(s_File[1], "Basic Info", "sName1", sName1);
                  INIFile.SetValue(s_File[1], "Basic Info", "sName2", sName2);
                  INIFile.SetValue(s_File[1], "Basic Info", "sTeacher", sTeacher);
                  INIFile.SetValue(s_File[1], "Basic Info", "sClassroom", sClassroom);
                  INIFile.SetValue(s_File[1], "Basic Info", "sCode", sCode);

                  TextFile.WriteFromString(s_File2[1], sProvoke, false);
                  TextFile.WriteFromString(s_File3[1], sDiscipline, false);
                  TextFile.WriteFromString(s_File4[1], sObjectives, false);
                  --TextFile.WriteFromString(s_File5[1], sTriggers, false);

                  --if sPIC ~= "" then

                  --s_File1[1] = sPIC
                  --str_sp = String.SplitPath(s_File1[1]);
                  --File.Copy(s_File1[1], _TempFolder, true, true, false, true, nil);
                  --File.Rename(_TempFolder.."\\"..str_sp.Filename..st r_sp.Extension, _TempFolder.."\\"..AccName..str_sp.Extension);
                  --s_File1[1] = _TempFolder.."\\"..AccName..str_sp.Extension
                  --sPIC = AccName .. str_sp.Extension
                  --INIFile.SetValue(s_File[1], "Basic Info", "sPIC", sPIC);
                  --end

                  Zip.Add(_SourceFolder.."\\tRecs\\"..AccName..".zip ", s_File, true, PASS, 0, nil, false);
                  Zip.Add(_SourceFolder.."\\tRecs\\"..AccName..".zip ", s_File1, true, PASS, 0, nil, false);
                  Zip.Add(_SourceFolder.."\\tRecs\\"..AccName..".zip ", s_File2, true, PASS, 0, nil, false);
                  Zip.Add(_SourceFolder.."\\tRecs\\"..AccName..".zip ", s_File3, true, PASS, 0, nil, false);
                  Zip.Add(_SourceFolder.."\\tRecs\\"..AccName..".zip ", s_File4, true, PASS, 0, nil, false);
                  --Zip.Add(_SourceFolder.."\\tRecs\\"..AccName..".zip ", s_File5, true, PASS, 0, nil, false);


                  File.Delete(s_File[1], false, false, false, nil);
                  --File.Delete(s_File1[1], false, false, false, nil);
                  File.Delete(s_File2[1], false, false, false, nil);
                  File.Delete(s_File3[1], false, false, false, nil);
                  File.Delete(s_File4[1], false, false, false, nil);
                  --File.Delete(s_File5[1], false, false, false, nil);

                  result = Dialog.Message("Notice", "Saved.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

                  --File.ExploreFolder(_SourceFolder.."\\sRecs", SW_SHOWNORMAL);

                  --Image.Load("R-Image", "AutoPlay\\Images\\jpeg.png");


                  Input.SetText("R-1", "");
                  Input.SetText("R-2", "");
                  Input.SetText("R-3", "");
                  Input.SetText("R-4", "");
                  Input.SetText("R-5", "");
                  Input.SetText("R-6", "");
                  Input.SetText("R-7", "");
                  Input.SetText("SCode", "");
                  --Input.SetText("R-Pic", "");


                  --else
                  --Application.ExitScript(0);

                  Comment

                  Working...
                  X