Solved

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

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

760 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now