Help! applescript problem!
Help!
im 11 and i have been making a apple script and my if statements wont work!
here is my code!
say "Hello"
say "I am the computer"
say "Ask me any question!"
display dialog "Ask me a question" default answer "" buttons {"Send"} default button 1
if text returned of the result is "Who are you?" then
say "I am the computer aided Speech recognition system"
if text returned of the result is "Who are you?" then
say "I am the computer aided Speech recognition system"
else
say "Not a proper phrase"
end if
Your two if statement are identical, which makes me think you've just made an error copy/pasting your script.
In general, every 'if' statement requires a corresponding 'end if' statement. There must be one 'end if' for every 'if'.
Additionally, you can use 'else if' make a series of mutually-exclusive tests - i.e. if the first does not match, check another, and another, until you either find a match or run out of options. 'else if' statements don't have their own 'end if', but match with the original 'if' statement.
For example, single test:
if (someVariable is true) then
-- do some actions, e.g.:
display dialog "Yes"
end if
Single test with single 'else':
if (someVariable is true) then
-- do some actions, e.g.:
display dialog "Yes"
else
display dialog "No"
end if
In this case, if someVariable is not true you get the 'No' dialog. Compare this to the first example, where you wouldn't get any response at all.
Multiple cases:
if (someVariable is true) then
-- do some actions, e.g.:
display dialog "Yes"
else if (someVariable is false) then
display dialog "No"
else
display dialog "I have no idea what it is"
end if
In this example you test if someVariable is true.
If it is then you perform the first action (report 'Yes') and the script ends
If it is not, then you perform a second test to see if it is false. If this test passes then you report 'No' and the script end.
If someVariable is neither true nor false (e.g. maybe it's a numeric variable or a string) then the 'else' clause kicks in and you get the 'no idea' response.
Similar Messages
-
I downloaded my sons ipod 5g with the latest iOS and now when we try to sync it says we have no space, but there is nothing but a few apps on his ipod and he has plenty of space. The messege says that most of is space is taken up by video but there is no video or music on his ipod right now. I've tried to reset his ipod but that did not help the problem. What can I do?
Did you try to set it up again as new device?
How to back up your data and set up as a new device -
I assumed this would help my problem with not being able to open apps like Preview or TextEdit since I installed Mountain Lion. Instead, first I'm prompted to enter a password, then once I do that, I get an error box telling me the Library needs repairing. So I click on Repair, and once again I'm prompted for a password, which I enter, then the same error box opens, and so it goes. Can anyone help me with this problem? I'd greatly appreciate it.
ThorBack up all data. Don't continue unless you're sure you can restore from a backup, even if you're unable to log in.
This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
Step 1
If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
{ sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
Step 2 (optional)
Step 1 should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary, and if everything is working as expected after step 1.
Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
When the OS X Utilities screen appears, select
Utilities ▹ Terminal
from the menu bar. A Terminal window will open.
In the Terminal window, type this:
res
Press the tab key. The partial command you typed will automatically be completed to this:
resetpassword
Press return. A Reset Password window will open. You’re not going to reset a password.
Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
Select your username from the menu labeled Select the user account if not already selected.
Under Reset Home Directory Permissions and ACLs, click the Reset button.
Select
▹ Restart
from the menu bar. -
I have not been able to open up Lightroom on my computer for over a year now. Whenever I double click on it, this comes up - can anyone help? Problem signature: Problem Event Name:APPCRASH Application Name:lightroom.exe Application Version:3.4.1.10
First thing to try is the latest version of Lightroom (currently 5.6). If it don't crash, then problem solved - upgrade.
If Lr5 won't run on your machine, then Lr4 instead.
If both Lr5 and Lr4 crash on your machine, then at least you know it's a not a Lightroom version problem but something wonked in your system.
If you can't figure out how to resolve the crash on the system you have, then it's time for a new system (or try another converter/editor app).
PS - A few things to try:
* After re-installing new version, if that doesn't fix it, then get rid of all Lightroom-related data files (rename them so they can be restored), in case problem is in Lr data file.
* Remove all non-essential hardware in case problem is hardware/driver.
* Startup up machine with minimal software services.
* If still no go, consider updating driver software, including mainboard drivers and/or bios firmware if need be.
* Of course run all the system hardware and software diagnostics you can - problem could be failing disk or ram..
* Check system event logs for any clues.
If you don't know how to do some of these things - ask.
Do not say "you've tried everything" unless you want a lecture - there is most definitely something you haven't tried. It's like when you can't find your car keys - you haven't looked everywhere - there is somewhere you haven't looked!
PS - Has Lightroom EVER worked on your machine? what's changed since then..
Good luck,
Rob -
all other web browsers when i use on my net book show full web page but with Firefox i have to scroll side ways cant see full width of page sometimes Firefox will show full page but this is not often are the settings in Firefox to help this problem i have the latest version of Firefox 4.0.1
I have had a similar problem with my system. I just recently (within a week of this post) built a brand new desktop. I installed Windows 7 64-bit Home and had a clean install, no problems. Using IE downloaded an anti-virus program, and then, because it was the latest version, downloaded and installed Firefox 4.0. As I began to search the internet for other programs to install after about maybe 10-15 minutes my computer crashes. Blank screen (yet monitor was still receiving a signal from computer) and completely frozen (couldn't even change the caps and num lock on keyboard). I thought I perhaps forgot to reboot after an update so I did a manual reboot and it started up fine.
When ever I got on the internet (still using firefox) it would crash after anywhere between 5-15 minutes. Since I've had good experience with FF in the past I thought it must be either the drivers or a hardware problem. So in-between crashes I updated all the drivers. Still had the same problem. Took the computer to a friend who knows more about computers than I do, made sure all the drivers were updated, same problem. We thought that it might be a hardware problem (bad video card, chipset, overheating issues, etc.), but after my friend played around with my computer for a day he found that when he didn't start FF at all it worked fine, even after watching a movie, or going through a playlist on Youtube.
At the time of this posting I'm going to try to uninstall FF 4.0 and download and install FF 3.6.16 which is currently on my laptop and works like a dream. Hopefully that will do the trick, because I love using FF and would hate to have to switch to another browser. Hopefully Mozilla will work out the kinks with FF 4 so I can continue to use it.
I apologize for the lengthy post. Any feedback would be appreciated, but is not necessary. I will try and post back after I try FF 3.16.6. -
Someone who can say how to get Adpbe flash player version 11.2.202.197 to work together with Lion on mac mini. Support from Apple can obviously not help the problem and do not care if it works
Adobe flash player version 11.2.202.197 is for Windows Vista / Windows 7 / Vista 64 / Windows 7 64
Adobe Flash Player version 11.1.102.55 is the current version for Snow Leopard and Lion.
Adobe - Install Adobe Flash Player -
.problem is that icon of iblacklist in i tune is "disc phone" like One, named iblacklist, but on screen appear as "secret contact" not as iblacklist icon wich is contact like icon .please help .
iblacklist problem still , I download it again ,this was not helpfullHave you read my reply to one of your duplicate threads : https://discussions.apple.com/message/22774845#22774845 ?
-
can anyone help with problem updating iphone5s cant get anything only apple on screen sometimes screen flashes blue
Hey damien555,
Thanks for the question, I understand how frustrating this may be. It sounds like the update process may have been interrupted, and to resolve the issue, we’ll need to restore your device in recovery mode with iTunes:
If you can't update or restore your iOS device
http://support.apple.com/kb/HT1808
Thanks,
Matt M. -
Can you help with problems receiving faxes- powerbook g4?
Can I get help with problems receiving faxes on the powerbook G4?
Link for Download & Install & Setup & Activation problems may help
-Online Chat http://www.adobe.com/support/download-install/supportinfo/
More information needed for someone to help... please click below and provide the requested information
-Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840 -
Can you help with Problems that one of our users i having with regiistration of Premiere Pro?
Can you help with Problems that one of our users i having with registration of Premiere Pro?
Link for Download & Install & Setup & Activation problems may help
-Online Chat http://www.adobe.com/support/download-install/supportinfo/
More information needed for someone to help... please click below and provide the requested information
-Premiere Pro Video Editing Information FAQ http://forums.adobe.com/message/4200840 -
i have installed photoshop elements 12.
when I try use the editing features it said that i must login to Adobe to register the product.
but each time i try to it said there is a problem.
help
the problem stated that the internet is not connected, but that is not the case.I had the same issue and I'm running Windows 7. Tried working with technical support for several hours but they were no help. They just had me doing the same things over and over, offering no real answers. I finally got fed up and have decided to return my product for a full refund.
-
Help classpath problem j2sdk1.4.2_04
help classpath problem j2sdk1.4.2_04
how can i run the java program with specify the file location
such as :
-----this one is fine ok and return HelloWorld.class-----
[root@localhost root]javac /serverData/studentAC/s001/HelloWorld.java
-----but this one cause exception-----
[root@localhost root]java /serverData/studentAC/s001/HelloWorld
-----result-----
Exception in thred "main" java.lang.NoClassDefFoundError: /serverData/studentAC/s001/HelloWorld
[root@localhost root]
I have tried a lot of classpath setting:
I just want to compile and run the java program without specify the classpath only !! please help !!! and give suggest !! if you have this exp!!
# ---1
#PATH=/usr/java/j2sdk1.4.2_04/bin:$PATH:$HOME/bin:./
#export PATH
#export JAVA_HOME=/usr/java/j2sdk1.4.2_04/
#export #CLASSPATH=/usr/java/j2sdk1.4.2_04/lib/tools.jar:/usr/java/j2sdk1.4.2_04/jre/lib/rt.jar:./
# ---2
#set java environment
# Java Setup Section START
export JAVA_HOME="/usr/java/j2sdk1.4.2_04"
export JRE="$JAVA_HOME/jre"
export CLASSPATH="$JAVA_HOME/lib:$JRE/lib:$JAVA_HOME/lib/tools.jar:."
export PATH="$PATH:$JAVA_HOME/bin"
# Java Setup Section END
# ---3
#PATH=$PATH:/usr/java/j2sdk1.4.2_04/bin
#JAVA_HOME=/usr/java/j2sdk1.4.2_04/
#export PATH
# ---4
# Java Setup Section START
#JAVA_HOME=/usr/java/j2sdk1.4.2_04
#export JAVA_HOME
#CLASSPATH=$CLASSPATH:/usr/java/j2sdk1.4.2_04/lib:/usr/java/j2sdk1.4.2_04/jre/lib:./
#export CLASSPATH
#PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
#export PATH
# Java Setup Section END
# ---5
#export PATH=$PATH:/usr/java/j2sdk1.4.2_04/bin
#export JAVA_HOME=/usr/java/j2sdk1.4.2_04
#export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib:$CLASSPATH:.
# ---6
#====================================================
#export JAVA_HOME=/usr/java/j2sdk1.4.2_04
#export PATH=$JAVA_HOME/bin:$PATH
#export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib:$CLASSPATH
#====================================================I think this will work. java -classpath /serverData/studentAC/s001 HelloWorld
-
How do I unlock my iPad? Unable to get serial number since I can't open iPad to get serial number to get help fixing problem.
What do you need the serial number for to unlock the iPad? If the iPad is locked because you forgot the Passcode, you have to restore the device.
What are you trying to unlock?
Your serial number is written on the back of the iPad and on the box that the iPad came in. -
Never been able to watch TV shows,videos, without player freezing up,skipping,audio problems sounds being choppy. Please help fix problem? Can you auto repair or troubleshoot problem ?Thankyou.
Joaquin Rodriguezooo wrote:first thing I'd do is try changing your video output driver in either video players.
Did not help, same result.
Last edited by uppectle (2015-03-06 18:58:59) -
Help me! Airport and Applescript problem
Hi all!
I'm here for a very silly question. I need to activate a "computer-to-computer" airport connection
automatically.
I thought Applescript could help me.
The thing to do is to click OK in the dialog box that appears when you click "create network"
Here what I've done:
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
tell menu bar item 1
click
tell menu 1
click menu item 7
tell window "Computer-to-Computer"
click button 1
end tell
end tell
end tell
end tell
end tell
end tell
The Dialog Window appears but Applescript return an error:
NSreceiverEvaluationScriptError:4
What I can do?
Please helpme to solve this small script!
Many thankks in advance and all the best
PaulThe "Computer-to-Computer" window isn't a part of the menu, so you need to take that statement out of the "tell menu bar" statement:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;"
title="this text can be pasted into the Script Editor">
tell application "System Events" to tell process "SystemUIServer"
tell menu bar 1
set menu_extras to value of attribute "AXDescription" of menu bar items
repeat with the_menu from 1 to the count of menu_extras
if item the_menu of menu_extras is "Airport Menu Extra" then exit repeat
end repeat
tell menu bar item the_menu
click
delay 0.5
click menu item "Create Network…" of front menu
delay 0.5
end tell
end tell
click button "OK" of window "Computer-to-Computer"
end tell
</pre>
Note that the menu extra can change location and the number of items in it can vary.
Maybe you are looking for
-
Safari problem: when I switch back into safari from another application, the menu bar comes up but no tabs or windows. What's going on? Just started yesterday. I have found a workaround: when I Command Tab back to safari, I hit command T to open
-
Select Query Date Problem?
Hi, I using 10g and here is my sample query which brings nothing. I know there are records in the database. It must be related with my date conversions. SELECT a.gm_cd, a.draw_cd, NVL(b.cpns, 0) cpns, NVL(b.clms, 0) clms, NVL(b.amn, 0) amn FROM (SELE
-
How do I bulk upload documents using PowerShell and extract metadata from file name?
I have a requirement to upload a bunch of documents into a document library. Based on the content type, the rules of updating the metadata is different...the one giving me trouble is to extract the metadata from the file name. If I have a file name l
-
hi please give me the additional concepts inrtoduced in ECC6.0 in the areas of GL,AR,AP and asset accounting against 4.7E seenu..
-
Wifi signal but no internet on iPod
hello, my ipod touch (4th generation) has stopped connecting to the internet since yesterday. For 6 months before then i have had no problems like this. The wifi signal is full but it won't connect to any websites or aps. it will work for a few minut