Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2003
    Posts
    163

    Problem with IF and setting-files for single executables

    hello everyone

    I have 2 questions and hope someone can help me.

    1. how (if) can I use AND/OR in an IF statement?
    i tried many different kinds but all I get are error messages.

    example:
    if (DesiredUserName == "CANCEL" OR DesiredUserName == "") then
    Dialog.Message("Title", "ERROR")
    end

    or:
    if (DesiredUserName == "CANCEL") OR (DesiredUserName == "") then
    Dialog.Message("Title", "ERROR")
    end
    ...
    where is the error? is there no way to use AND/OR in IF-Statements anymore?

    i get this:
    Syntax Error: [Location="Info:btnOrder", Event "On Click", Line=4]
    Error Detail: [`)' expected near `OR'] in [if (DesiredUserName == "CANCEL" OR DesiredUserName == "") then]

    2. if i use _SourceFolder for a single executable file to open a textfile and write into it it doesnt seem to work. will the file be deleted after closing the single executable?? do i have to specify an absolute path for the file to load/read?

    bye :

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Hi, go to the Help File > Scripting Guide > Expressions and operators. Reading that short chapter will answer any questions you have about operators, i.e. AND/OR.

    Corey Milner
    Creative Director, Indigo Rose Software

  3. #3
    Join Date
    Dec 2003
    Posts
    163
    thats what i did already but i cant find information about using them in if statements. it was possible in the previous version.


    from the help:
    Logical operators are used to perform Boolean operations on Boolean values. The following logical operators are supported:

    and (only true if both values are true)
    or (true if either value is true)
    not (returns the opposite of the value)

    For example:

    a = true;
    b = false;
    c = a and b; -- false
    d = a and nil; -- false
    e = not b; -- true
    there is nothing about if statements and how to use them there? :confused:

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    One thing I noticed about your actions listed above, is that the word "OR" was in caps, in AMS5 it needs to be in lowercase. Try this:
    Code:
    DesiredUserName = Dialog.Input("Username", "Please enter a user name", "", MB_ICONINFORMATION);
    if (DesiredUserName == "CANCEL") or (DesiredUserName == "") then 
    Dialog.Message("Error", "Please enter a username to continue.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
    end
    Here is another good example on how to do it from the users guide:

    Code:
    name = "";
    -- Loop until a valid full name is entered or the user cancels.
    while (name == "") and (name ~= "CANCEL") do
        -- Prompt the user for their full name
        name = Dialog.Input("Personal Information", "Please enter your full name:", "", MB_ICONQUESTION);
       
        -- If the user does not enter any text, display an error message. The loop will continue from the beginning
        if name == "" then
            result = Dialog.Message("Error", "Your information could not be processed as entered. Please try again.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
       
        -- If the user entered a valid name and didn't cancel, display a welcome message.
        elseif name ~= "CANCEL" then
            result = Dialog.Message("Welcome", "Welcome "..name.."!", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
        end
    end
    Although in the above example I might put a counter in that would only allow them to try 3 times before timing out. In that case you could look at using a repeat action instead.
    Code:
    repeat
         do something here
    until condition

  5. #5
    Join Date
    Dec 2003
    Posts
    163
    omg, it must be in lowercase? :confused:
    until now I have used the uppercase version everytime and thought that would work in the new version of AutoPlay too. :

    I will try it with lowercase now. Thank you!



    edit: can anyone tell me someting about the 2. question? (on top)
    Last edited by SonG0han; 12-15-2003 at 11:39 AM.

  6. #6
    Join Date
    Jan 2000
    Posts
    2,002
    2. if i use _SourceFolder for a single executable file to open a textfile and write into it it doesnt seem to work. will the file be deleted after closing the single executable?? do i have to specify an absolute path for the file to load/read?
    Right. When you use the single executable option the files that are extracted are deleted when the app closes. This is by design. If you want t text file to persist, create some actions that will either copy or create it in a permanent location on the system.

  7. #7
    Join Date
    Dec 2003
    Posts
    163
    ok, thanks.

Posting Permissions

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