View Full Version : Problem with IF and setting-files for single executables
SonG0han
12-14-2003, 12:26 PM
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 :cool:
Corey
12-14-2003, 12:36 PM
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 (http://www.indigorose.com)
SonG0han
12-14-2003, 04:12 PM
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:
TJ_Tigger
12-15-2003, 09:00 AM
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:
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:
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.
repeat
do something here
until condition
SonG0han
12-15-2003, 12:35 PM
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. :rolleyes:
I will try it with lowercase now. Thank you! :)
edit: can anyone tell me someting about the 2. question? (on top)
Brett
12-15-2003, 02:27 PM
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.
SonG0han
12-16-2003, 05:13 AM
ok, thanks. :)
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.