Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Argument 2 must be of type string :(

    I must first start off by saying I am just a beginner at this programming thing... I used Setup Factory six and had no trouble using it... I am now pulling our media installs forward and finding it difficult. I have gotten a long ways but recently I am having a problem. Here is an example of what I am trying to do (and all the help files/forums say it should work):
    Code:
    DocLocation = INIFile.GetValue(_SourceFolder .. "\\Settings.ini" , "[Documentation]" , "DocLocation");
    But later when I try to use 'DocLocation' it comes up empty. So I put a dialog in right after the above line to display a message if it gets an error (right out of the help file) So the code would look like this:

    Code:
    DocLocation = INIFile.GetValue(_SourceFolder .. "\\Settings.ini" , "[Documentation]" , "DocLocation");
    if (error ~=0) then
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end
    At this point, upon running the built exe I get an error "Argument 2 must be of type string" which I have narrowed down to anytime I use Dialog.Message with a Variable in the "message" position.

    Can anyone please advise

  2. #2
    Join Date
    Oct 2005
    Location
    MI
    Posts
    524
    Be careful with the dialog.message action. If you are going to use a variable in the message, it has to contain a string. If it contains a table, boolean (true/false) or nil value you will get an error.

    In this case, it looks like you haven't populated your error variable with a value yet... so it is currently nil. Try this:

    Code:
    DocLocation = INIFile.GetValue(_SourceFolder .. "\\Settings.ini" , "[Documentation]" , "DocLocation");
    if (error ~=0) then
    error = Application.GetLastError();
    Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    end
    BTW, the reason your DocLocation is coming up empty is that you do not need the []'s in your INIFile.GetValue() argument. Try this instead:

    Code:
    DocLocation = INIFile.GetValue(_SourceFolder .. "\\Settings.ini" , "Documentation" , "DocLocation");

  3. #3
    Join Date
    Feb 2006
    Posts
    2

    Thanks

    That makes total sense, thank you very much!

Similar Threads

  1. argument 2 must be of type string
    By carlossequeira in forum AutoPlay Media Studio 5.0
    Replies: 5
    Last Post: 06-04-2005, 02:29 PM
  2. Argument 2 must be of typed string
    By rctshine in forum Setup Factory 7.0
    Replies: 24
    Last Post: 03-23-2005, 08:59 AM
  3. Argument 1 must be of type string
    By Sheritlw in forum Setup Factory 7.0
    Replies: 1
    Last Post: 09-27-2004, 05:32 PM
  4. Function: Show/Hide All Objects of a Specific Type
    By Brett in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 05-10-2004, 02:29 PM

Posting Permissions

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