Solved

Apple Script that directs users to a page if a code is entered that is not specified

Posted on 2006-07-20
3
239 Views
Last Modified: 2013-12-26
     Im using the following script to ask users to enter a code and direct them a local HTML page according to what they enter.  what I need to do now is direct them to a "default page" if the user enters a code that I have not specified, a "catch all."

so if a user entered "gfkhjygfk" I would send them to "default.html."  The code I have now does not do anything if an unrecognized code is entered, it just just closes.

I would also like to a version that could display an error message such as " you have entered an un recognizable code, please try again"

here is part of the code I have so far:

        if gowhere is equal to " " then
            open location "file:///site/index01.html"
      else if gowhere is equal to "aaa" then
            open location "file:///site/index02.html"
      else if gowhere is equal to "bbb" then
            open location "file:///site/index02.html"
      else if gowhere is equal to "ccc" then
            open location "file:///site/index003.html"
      else if gowhere is equal to "admin" then
            open location "file:///site/admin/index04.html"
      end if
0
Comment
Question by:arobquinna
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
slyong earned 500 total points
ID: 17150836
Hi,

This is the modified script for you:

set iamnotdone to true
tell application "Finder"
  activate
  display dialog "Where do you want to go today?" default answer ""
  set gowhere to text returned of result
end tell

repeat while iamnotdone
  tell application "Safari"
    activate
    if gowhere is equal to "apple" then
      open location "http://www.apple.com/"
      set iamnotdone to false
    else if gowhere is equal to "yahoo" then
      open location "http://www.yahoo.com/"
      set iamnotdone to false
    else if gowhere is euqal to "google" then
      open location "http://www.google.com/"
      set iamnotdone to false
    end if
  end tell

  if iamnotdone then
    tell application "Finder"
      activate
      display dialog "I can't send you there, try again" default answer ""
      set gowhere to text returned of result
    end tell
  end if
end repeat
0
 

Author Comment

by:arobquinna
ID: 17150860
yes!! that is it bro!

Thanks again!!
0
 
LVL 24

Expert Comment

by:slyong
ID: 17150865
no worries glad to be of help
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question