Solved

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

Posted on 2006-07-20
3
241 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 137
notReplace  challenge 53 151
Doc'in system (example?) BA 7 120
How do I get Window Title of all opened process? 4 32
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

740 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