Indigo Rose Software
  #1  
Old 12-04-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
Grin Action depends on the password you enter

I've been using Autoplay Media 4.0 for several years so this is a major change to get used to. I've downloaded the demo just minutes ago and am considering this purchase for our company.

1. I would like a dialog box to appear on launch so a user can enter a password.
2. Based on the password they enter, I would like an action to occur.

Is this possible and how is it done?

Specifically, if they enter password "1", a network share is mapped (I was going to do this with a batch file) a series of minor changes take place on the system (such as file deletion/creation, also handled with a batch file) and finally a .txt file containing some information is deposited to that mapped network location. (that may also be done with a batch file if necessary)

If they enter a password of "2", the same thing happens basically but the files which are created/deleted are different.
Reply With Quote
  #2  
Old 12-04-2007
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
Hi,

Step 1. >>> Get the password as a variable, like :

sPassword = Input.GetText("Input1");

Step 2. >>> Use an if ... then loop like :

if sPassword == "1" then
------- do something here------
elseif sPassword == "2" then
------- do something else here----
elseif sPassword =="" then
-------open a dialog box---
end
__________________
Newbie Examples
------> AMS 7.5 : amstudio.azman.info
----> AMS 6 & 5: www.azman.info/ams/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
  #3  
Old 12-04-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
I'll give that a shot. Will this loop endlessly (which is what I would prefer) ?

Is this the actual code I would use: result = Dialog.PasswordInput (as found in the help file)

I have been able to do it with version 4 where after x number of tries, the app closes. But I would like this to stay open until they enter a password.

Thanks,

Joe
Reply With Quote
  #4  
Old 12-04-2007
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
Hi,

Yes. The variable can be taken like:

sPassword = Dialog.PasswordInput()

Yes. You can leave the thing hanging there until the user enters a correct one. And you can also decide the number of tries by placing a counting mechanism in the loop ( something like below ).

--initial flush
nAttempt = 0;

if sPassword ~="" and sPassword ~="CANCEL" then
nAttempt = nAttempt+1;

if nAttempt = 5 then
Application.Exit();
else
if sPassword == "1" then
------- do something here------
elseif sPassword == "2" then
------- do something else here----
elseif sPassword ~= "1" and sPassword ~= "2" then
sPassword = Dialog.PasswordInput();
end
end

elseif sPassword == "CANCEL" then
Application.Exit();

elseif sPassword == "" then
sPassword = Dialog.PasswordInput()

end

--------------------------

Something to that effect above. I havent the copy of AMS on this PC, so I couldnt test for errors in the loop. But I hope it gives you some useful points.
__________________
Newbie Examples
------> AMS 7.5 : amstudio.azman.info
----> AMS 6 & 5: www.azman.info/ams/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
  #5  
Old 12-04-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
Man, that's great. This is what I have so far:

password = Dialog.PasswordInput("Please call the Help Desk at ext. 3277", "Enter your Deployment Code:", MB_ICONQUESTION);

-- test area start
--initial flush
attempt = 0;
if password ~="" and password ~="CANCEL" then
attempt = attempt+1;
if attempt = 5 then
Application.Exit();
else
-- test area end
if (password == "derek") then
File.Open("AutoPlay\\Docs\\derek.bat", "", SW_SHOWNORMAL);
end
if (password == "dad") then
File.Open("AutoPlay\\Docs\\joe.bat", "", SW_SHOWNORMAL);
end

The part in red gets flagged upon syntax check: 'then' expected near '='
I'm too novice at script writing to understand what it's asking me to do.

Thanks,

Joe
Reply With Quote
  #6  
Old 12-04-2007
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
Hi,

Its asking for another equal sign, which I missed.

Should be >> if attempt == 5 then

Expect more errors because I noticed you missed a few things as well.

> You need to close if loops with end.
> You need to use elseif to present options.
__________________
Newbie Examples
------> AMS 7.5 : amstudio.azman.info
----> AMS 6 & 5: www.azman.info/ams/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
  #7  
Old 12-04-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
Thanks again! This is my code so far:


password = Dialog.PasswordInput("Please call the Help Desk at ext. 3277", "Enter your Deployment Code:", MB_ICONQUESTION);
-- test area start
--initial flush
Attempt = 0;
if password ~="" and password ~="CANCEL" then
Attempt = Attempt+1;
if Attempt == 500 then
Application.Exit();
else
-- test area end
if (password == "derek") then
File.Open("AutoPlay\\Docs\\derek.bat", "", SW_SHOWNORMAL);
end
if (password == "dad") then
File.Open("AutoPlay\\Docs\\joe.bat", "", SW_SHOWNORMAL);
end
elseif password ~= "1" and password ~= "2" then
password = Dialog.PasswordInput();
end
end
-- more test area start
elseif password == "CANCEL" then
Application.Exit();

elseif password == "" then
password = Dialog.PasswordInput()

end
-- more test area end


The read area being flagged again:
Line=17: 'end' expected (to close 'if' at line7) near 'elseif'

Can you shed some light on that one?

Thanks again,

Joe
Reply With Quote
  #8  
Old 12-04-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
Grin

This is what I have and it seems to work well with one exception: after 2 incorrect password entries, the password prompt simply goes away. I'm trying to get it to annoyingly continue to prompt for a password until a valid password is entered. I don't want some to just click cancel and get out of entering the password. Any suggestions?

sPassword = Dialog.PasswordInput("Please call the Help Desk at ext. 3277", "Enter your Deployment Code:", MB_ICONQUESTION);
--initial flush
nAttempt = 0;
if sPassword ~="" and sPassword ~="CANCEL" then
nAttempt = nAttempt+1

if nAttempt == 5 then
Application.Exit();
else
if sPassword == "1" then
File.Open("AutoPlay\\Docs\\derek.bat", "", SW_SHOWNORMAL);

elseif sPassword == "2" then
File.Open("AutoPlay\\Docs\\joe.bat", "", SW_SHOWNORMAL);

elseif sPassword ~= "1" and sPassword ~= "2" then
sPassword = Dialog.PasswordInput("Please call the Help Desk at ext. 3277", "Enter your Deployment Code:", MB_ICONQUESTION);
end
end

elseif sPassword == "CANCEL" then
Application.Exit();

elseif sPassword == "" then
sPassword = Dialog.PasswordInput("Please call the Help Desk at ext. 3277", "Enter your Deployment Code:", MB_ICONQUESTION);

end
Reply With Quote
  #9  
Old 12-05-2007
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
Joe,

Try look at a sample I have. Download and see how it works.

www.azman.info/ams/Password.apz

Then customize it.
__________________
Newbie Examples
------> AMS 7.5 : amstudio.azman.info
----> AMS 6 & 5: www.azman.info/ams/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
  #10  
Old 12-05-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
Smile

That's about 99% of it, looks great! If you enter the wrong password, however, it just craps out and stops at page1 without prompting for the password again. I was working on a "while" statement when you posted this which looks like a much better route! Thanks for your help! I'll continue to look at the code today but if you know it's an easy fix and wouldn't mind sharing, I'd be grateful.

Thanks,

Joe

Last edited by jhiltabidel; 12-05-2007 at 07:28 AM. Reason: Not fixed as originally thought.
Reply With Quote
  #11  
Old 12-05-2007
azmanar's Avatar
azmanar azmanar is offline
Indigo Rose Customer
 
Join Date: Oct 2004
Location: East, South & West Asia
Posts: 948
Joe,

Yes, it will crap out after 1 wrong entry. Thats why I reinitiate everytime after each entry by routing it to page 1. Thus it will not crap out. Evenso, I consider this as poor control.

Another alternative is to have a welcome page with a little START button. Everytime you click the START button, the Dialog Prompt will reinitiate.

There is however another alternative for password entry. You can use Input Object instead of using Dialog.PasswordInput. The Input Object is placed on the welcome page and a small button GO to click.

What you need to do is to set the Input Object property InputStyle to password mode so that all entries are seen as asterisks *.

Either way, you have better control.

Good luck !!!
__________________
Newbie Examples
------> AMS 7.5 : amstudio.azman.info
----> AMS 6 & 5: www.azman.info/ams/
----> Twitter: www.twitter.com/azmanar/
Reply With Quote
  #12  
Old 12-05-2007
jhiltabidel jhiltabidel is offline
Indigo Rose Customer
 
Join Date: Dec 2007
Posts: 20
Thumbs up

Ahhh, different kind of crap out. Your code was still working fine and crapping out exactly when it should -- by notifying the user that the password was incorrect and they had x number of tries remaining. But for some reason when I copied/pasted the code into a different project, it didn't work the same. Newbie error on my side. It's working exactly perfectly now and I truly appreciate your help!

Here is my final code aside from some minor additions I will make to the batch files.

sPassword = Dialog.PasswordInput("Image must be validated", "Please enter your deployment code:", MB_ICONQUESTION);
if sPassword ~="" and sPassword ~="CANCEL" then
if sPassword == "derek" then
File.Open("AutoPlay\\Docs\\derek.bat", "", SW_SHOWNORMAL);
elseif sPassword == "joe" then
File.Open("AutoPlay\\Docs\\joe.bat", "", SW_SHOWNORMAL);
-- only way to cancel window start
elseif sPassword == "****" then
Application.Exit(0);
-- only way to cancel window end
elseif sPassword ~= "derek" and sPassword ~= "joe" then
nAttempt = nAttempt+1;
Dialog.Message("Error", "Number of Attempts : "..""..nAttempt.." of 1 million allowed", MB_OK, MB_ICONEXCLAMATION);
if nAttempt == 1000000 then
Application.Exit();
else
Page.Jump("Page1");
end
end

elseif sPassword == "CANCEL" then
Page.Jump("Page1");
elseif sPassword == "" then
Page.Jump("Page1");
end

Thanks,

Joe

Last edited by jhiltabidel; 12-05-2007 at 08:56 AM. Reason: Adding the final code
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Password Protection Desmond AutoPlay Media Studio 5.0 Examples 0 10-03-2003 04:25 PM
Reoccurring password Bruce AutoPlay Media Studio 4.0 6 06-04-2003 05:09 PM
password zeebaf AutoPlay Media Studio 4.0 6 04-28-2003 08:44 PM
INFO: Tips for Debugging Action Lists in AutoPlay Media Studio 4.0 Support AutoPlay Media Studio 4.0 Examples 0 10-03-2002 09:38 AM
SUF6.0.0.2 -- installer hangs. jassing Setup Factory 6.0 4 12-20-2001 12:28 AM


All times are GMT -6. The time now is 12:16 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software