Help with shell script: Find Recently Modified Directories
I'm trying to do something that appears to be beyond my capacity to figure out on my own. I'm hoping that someone more skilled than I at scripting can help.
Challenge
I'm trying to build a script that finds directories and gzips each individually, but only if they've been modified within the last, say, 7 days.
Context
The idea is to create a set of gzipped directories that can then be uploaded to a remote server for backup and archival purposes. Since the parent directory is 8+ GB in size, and 99% of the contents does not change from week to week, I want to identify, zip, and upload only the directories that have been modified recently. (Uploading is outside the scope of this script).
*Cut to the Chase*
In plain english, my script might look like:
1) find sub-folders contained within "~/Sites/" that have been modified within the last 7 days; do not go more than 1 level deep (i.e., return only the top level folders within ~/Sites/)
2) loop through the returned list and gzip each directory
I'm hoping that this can be done easily. Automator doesn't provide filters that are granular enough to do this, so I'm thinking bash is the way to go. Any help would be most appreciated, and will be rewarded with all kinds of good karma. =)
-Steve
OK, here is an untested and possibly syntactically incorrect Perl script:
#!/usr/bin/perl -w
use strict;
my $siteDir = "$ENV{HOME}/Sites";
# Get all the top-level contents of the Sites directory.
opendir(SITES, $siteDir) or die "Couldn't open $siteDir folder.
my @siteContents = readdir SITES;
closedir SITES;
# Reset my script startup time to be 7 days ago.
$^T = time - (6060*247);
# Now find all the modified directories since then.
my @modifiedSiteDirs = grep { -d "$siteDir/$_" and -M "$siteDir/$_" < 7 } @siteDirs;
foreach my $modifiedSiteDir (@modifiedSiteDirs)
system qq{tar zcf "$modifiedSiteDir.tar.gz" $modifiedSiteDir};
Actually, I did just test it with only a printout instead of executing tar and it works. I'm not sure of the path to tar on MacOS X. You may have to add that.
Similar Messages
-
Can anyone here help me (getting my feet wet) with an addition to a profile (applmgr) that I am trying to make - in the form of a shell script.
I have the following lines in the profile file - but each time I log into the server as applmgr, I get the error following
if $HOSTNAME=hostname1
tnen
. /u01/xxees/EBST/apps/apps_st/appl/APPSEBST_$HOST.env
fi
if $HOSTNAME=hostname2
./u01/xxees/EBST2/apps/apps_st/appl/APPSEBST_$HOST.env
fi
The error message I am getting us
-bash: /local/ebsuser/applmgr/.profile: line 39: syntax error near unexpected token `fi'
-bash: /local/ebsuser/applmgr/.profile: line 39: `fi'
Thank you all.
Edited by: 864641 on Jun 13, 2012 1:49 PMFrom the Error Message at line Number 38, I feel that, the file /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOST.env (where $HOST can be "hostname01" or "hostname02") has been modified and has unmatched if.
Also, If you are using the variable HOSTNAME, I feel that the env file should be like /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env in which case your script will be like:
if [$HOSTNAME == "hostname01"]; then
. /u01/xxees/EBSTEST/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
fi
if [$HOSTNAME == "hostname02"]; then
. /u01/xxees/EBSTEST2/apps/apps_st/appl/APPSEBST_$HOSTNAME.env
fi
Hope that this two things will help in resolving the issue. -
HELP with Shell scripting!!!
Hello all,
I'm very new to shell scripting and I'm trying to learn a little more as I go on. I'm trying to write a shell script to create a symbolic link to an application and have it moved to the current user's desktop. I've been doing some testing with the default applications installed on Leopard here is what I have so far...
ls -s /Applications/Chess.app
I've trying using cp commands, but I continue to get error messages. The above script does create a symbolic link to my home directory, but I want to then move it from the home directory to the current user's desktop. Can anyone lead me any further?
Thanks in advance for any help!I'm also having a problem making my shell script unix executable. I have tried chmod +x path/to/script and then I killall Finder but nothing happens. Am I doing something wrong?
Are you trying to make your script "Double-Clickable"?
Then you still need to do the
chmod +x /path/to/script
But that will just make it something you can run from a shell.
If you want double-clickable, you can create an Automator app
Applications -> Automator -> Run Shell Script
Or you can download the free Platypus utility that will make any script a double-clickable applications.
Or you can name your script
myscript.command
where the .command is the important part, which the Finder will treat as something it should execute as a shell script when double-clicked.
And no killing Finder. They will work without messing with the Finder.
Personally, I prefer the Automator app or Platypus. Well I also work a lot in the shell, and I execute scripts as script in the shell all the time, so I only create a lot more scripts that get executed as commands than I do double-clickable scripts. -
Need help with shell scripting and Patching
Hello all,
I am a very new Oracle DBA and I just have an interview where i have been ask two questions that i have no idea of what it is
1/ What is shell scripting and how do you do shell scripting?
2/ What is Patching and how do you do patching?
Can some one help to have a very good understanding of these tow questions?
Thanks a lot1/ What is shell scripting and how do you do shell scripting?shell accept command from you (via keyboard) and execute them. But if you use command one by one (sequence of 'n' number of commands) , the you can store this sequence of command to text file and tell the shell to execute this text file instead of entering the commands. This is know as shell script.
Shell script defined as:
"Shell Script is series of command written in plain text file. Shell script is just like batch file in MS-DOS
for example:- for taking backup, health check and doing some task Operating system level or Oracle database level we can create shell script and schedule a cron job
2/ What is Patching and how do you do patching?for example ,in windows while using sometimes you might face an issue/error and it gives pop up error message would like to send/report this error to microsoft? microsoft will send you a fix for that. lot of fixes for errors/bugs are released as patches.( n number of patches with newer features are releases as new version)
likewise in oracle for resolving bugs we should have to apply patch.
patch is basically a fix for a bug/bugs. we need to use opatch utility to apply the paches.
hope, this helps you -
Checking database availability with shell script
can anyone help with a script that checks for database availability before 10 P.M and 7 A.M at 5 minites interval and starts a SQL Load of a table once the db is available.
I have no Shell script experience at all but I can amend an already written script.
Please Help !!Dear Timothy,
Within the Oracle software you have installed on your machine, there is a script called "dbstart" within the <ORACLE_HOME>/bin directory. This script provided by Oracle can be easily modified to check whether the server is up and should help solve your problem.
Ciao! -
Need help with photoshop to find TGA
Need help with photoshop to find TGA on same as because I cant find it there or is it a download you need to get it. And its for photoshop element 12.
Yeah, I thought it was dumb to remove it, too. See:
Save as TGA File ? [Photoshop Elements 12]
for the workaround. -
Need to enable Usage Tracking With Shell Script
Hi All
I have patch 11.1.1.6.7 installed in system. I have Redhat linux 6 sytem
Can we enable usage tracking with shell script ? if yes how ?
Thanks
Samit BaghlaHi Samit,
No you can not as per my info because everything to be configured for the usage tracking is via repository and enterprise manager. You need to invoke it in em and rpd you need to do modelling. I still did not understand that why you want to create the shell script !!
Thanks,
Amol
(Please mark this answer, if you found correct) -
SQL in Connection with shell scripts
Hello everyone,
I have a conceptual question:
If people like to implement their SQL-Scripts attached on a shell script(Ruby, Perl, or even OS-Shell), what are actually the benefits doing this? Can someone please give me a szenario, which is very effectively if we do it with combination with shell-script.
My second question: does oracle sql developer support this shell combination?
Thank you..Wrapping sql script in a shell script provides flexibility. Shell can provide better parameter validation than SQL, better output handling, and better error trapping. Personally I would have the sql script separately for purist modularisation reasons, but you can merge the two.
e.g.
getdate.sql
select sysdate from dual;getdate.sh can look like this
sqlplus user/pwd @getdateor
sqlplus user/pwd <<EOSQL
@getdate
EOSQLor
sqlplus user/pwd <<EOSQL
select sysdate from dual;
exit
EOSQLMy preference would be for either of the first two.
You can use various shell facilities to capture the output of the sql statement for use elsewhere. Variations of the above example can be use to get the current database date and time into the shell environment for use in other queries, or in the shell itself.
You can run SQL Developer from the command line, but the tool of choice for command line is SQL Plus. -
So , I edited the ITunes.java as described in the Admin guide.Copied the .class to my cgi folder in the server.I copied the itunesu file from the shell folder of the sample code.I have modified it accordingly.But when I run it in browser(Firefox) as ..../cgi-bin/itunesu it just gives me a blank page.Nothing shows up.I ran the ITunes.java file locally and it generates an HTML output, which I copied and created a new html.After I run this HTML file, it opens my itunes, but again it says page not found and url contains https://www.xxx.edu/cgi-bin/itunesu?destination=xxx.edu where xxx is my institution name.Not sure if I am supposed to display my institution name in forum.
The admin guide says on page 15 step 4.Copy the itunes.class file and other itunes file to your web server's cgi-bin directory.
I am not quiet sure what does other itunes file mean??
This is how my .java file looks.
import java.io.*;
import java.net.*;
import java.security.*;
import java.util.*;
* The <CODE>ITunesU</CODE> class permits the secure transmission
* of user credentials and identity between an institution's
* authentication and authorization system and iTunes U.
* The code in this class can be tested by
* running it with the following commands:
* <PRE>
* javac ITunesU.java
* java ITunesU</PRE>
* Changes to values defined in this class' main() method must
* be made before it will succesfully communicate with iTunes U.
public class ITunesU extends Object {
* Generate the HMAC-SHA256 signature of a message string, as defined in
* RFC 2104.
* @param message The string to sign.
* @param key The bytes of the key to sign it with.
* @return A hexadecimal representation of the signature.
public String hmacSHA256(String message, byte[] key) {
// Start by getting an object to generate SHA-256 hashes with.
MessageDigest sha256 = null;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new java.lang.AssertionError(
this.getClass().getName()
+ ".hmacSHA256(): SHA-256 algorithm not found!");
// Hash the key if necessary to make it fit in a block (see RFC 2104).
if (key.length > 64) {
sha256.update(key);
key = sha256.digest();
sha256.reset();
// Pad the key bytes to a block (see RFC 2104).
byte block[] = new byte[64];
for (int i = 0; i < key.length; ++i) block = key;
for (int i = key.length; i < block.length; ++i) block = 0;
// Calculate the inner hash, defined in RFC 2104 as
// SHA-256(KEY ^ IPAD + MESSAGE)), where IPAD is 64 bytes of 0x36.
for (int i = 0; i < 64; ++i) block ^= 0x36;
sha256.update(block);
try {
sha256.update(message.getBytes("UTF-8"));
} catch (UnsupportedEncodingException e) {
throw new java.lang.AssertionError(
"ITunesU.hmacSH256(): UTF-8 encoding not supported!");
byte[] hash = sha256.digest();
sha256.reset();
// Calculate the outer hash, defined in RFC 2104 as
// SHA-256(KEY ^ OPAD + INNER_HASH), where OPAD is 64 bytes of 0x5c.
for (int i = 0; i < 64; ++i) block ^= (0x36 ^ 0x5c);
sha256.update(block);
sha256.update(hash);
hash = sha256.digest();
// The outer hash is the message signature...
// convert its bytes to hexadecimals.
char[] hexadecimals = new char[hash.length * 2];
for (int i = 0; i < hash.length; ++i) {
for (int j = 0; j < 2; ++j) {
int value = (hash >> (4 - 4 * j)) & 0xf;
char base = (value < 10) ? ('0') : ('a' - 10);
hexadecimals[i * 2 + j] = (char)(base + value);
// Return a hexadecimal string representation of the message signature.
return new String(hexadecimals);
* Combine user credentials into an appropriately formatted string.
* @param credentials An array of credential strings. Credential
* strings may contain any character but ';'
* (semicolon), '\\' (backslash), and control
* characters (with ASCII codes 0-31 and 127).
* @return <CODE>null</CODE> if and only if any of the credential strings
* are invalid.
public String getCredentialsString(String[] credentials) {
// Create a buffer with which to generate the credentials string.
StringBuffer buffer = new StringBuffer();
// Verify and add each credential to the buffer.
if (credentials != null) {
for (int i = 0; i < credentials.length; ++i) {
if (i > 0) buffer.append(';');
for (int j = 0, n = credentials.length(); j < n; ++j) {
char c = credentials.charAt(j);
if (c != ';' && c != '\\' && c >= ' ' && c != 127) {
buffer.append(c);
} else {
return null;
// Return the credentials string.
return buffer.toString();
* Combine user identity information into an appropriately formatted string.
* @param displayName The user's name (optional).
* @param emailAddress The user's email address (optional).
* @param username The user's username (optional).
* @param userIdentifier A unique identifier for the user (optional).
* @return A non-<CODE>null</CODE> user identity string.
public String getIdentityString(String displayName, String emailAddress,
String username, String userIdentifier) {
// Create a buffer with which to generate the identity string.
StringBuffer buffer = new StringBuffer();
// Define the values and delimiters of each of the string's elements.
String[] values = { displayName, emailAddress,
username, userIdentifier };
char[][] delimiters = { { '"', '"' }, { '<'(', ')' }, { '[', ']' } };
// Add each element to the buffer, escaping
// and delimiting them appropriately.
for (int i = 0; i < values.length; ++i) {
if (values != null) {
if (buffer.length() > 0) buffer.append(' ');
buffer.append(delimiters[0]);
for (int j = 0, n = values.length(); j < n; ++j) {
char c = values.charAt(j);
if (c == delimiters[1] || c == '\\') buffer.append('\\');
buffer.append(c);
buffer.append(delimiters[1]);
// Return the generated string.
return buffer.toString();
* Generate an iTunes U digital signature for a user's credentials
* and identity. Signatures are usually sent to iTunes U along
* with the credentials, identity, and a time stamp to warrant
* to iTunes U that the credential and identity values are
* officially sanctioned. For such uses, it will usually makes
* more sense to use an authorization token obtained from the
* {@link #getAuthorizationToken(java.lang.String, java.lang.String, java.util.Date, byte[])}
* method than to use a signature directly: Authorization
* tokens include the signature but also the credentials, identity,
* and time stamp, and have those conveniently packaged in
* a format that is easy to send to iTunes U over HTTPS.
* @param credentials The user's credentials string, as
* obtained from getCredentialsString().
* @param identity The user's identity string, as
* obtained from getIdentityString().
* @param time Signature time stamp.
* @param key The bytes of your institution's iTunes U shared secret key.
* @return A hexadecimal representation of the signature.
public String getSignature(String credentials, String identity,
Date time, byte[] key) {
// Create a buffer in which to format the data to sign.
StringBuffer buffer = new StringBuffer();
// Generate the data to sign.
try {
// Start with the appropriately encoded credentials.
buffer.append("credentials=");
buffer.append(URLEncoder.encode(credentials, "UTF-8"));
// Add the appropriately encoded identity information.
buffer.append("&identity=");
buffer.append(URLEncoder.encode(identity, "UTF-8"));
// Add the appropriately formatted time stamp. Note that
// the time stamp is expressed in seconds, not milliseconds.
buffer.append("&time=");
buffer.append(time.getTime() / 1000);
} catch (UnsupportedEncodingException e) {
// UTF-8 encoding support is required.
throw new java.lang.AssertionError(
"ITunesU.getSignature(): UTF-8 encoding not supported!");
// Generate and return the signature.
String signature = this.hmacSHA256(buffer.toString(), key);
return signature;
* Generate and sign an authorization token that you can use to securely
* communicate to iTunes U a user's credentials and identity. The token
* includes all the data you need to communicate to iTunes U as well as
* a creation time stamp and a digital signature for the data and time.
* @param credentials The user's credentials string, as
* obtained from getCredentialsString().
* @param identity The user's identity string, as
* obtained from getIdentityString().
* @param time Token time stamp. The token will only be valid from
* its time stamp time and for a short time thereafter
* (usually 90 seconds).
* @param key The bytes of your institution's iTunes U shared secret key.
* @return The authorization token. The returned token will
* be URL-encoded and can be sent to iTunes U with
* a form
* submission. iTunes U will typically respond with
* HTML that should be sent to the user's browser.
public String getAuthorizationToken(String credentials, String identity,
Date time, byte[] key) {
// Create a buffer with which to generate the authorization token.
StringBuffer buffer = new StringBuffer();
// Generate the authorization token.
try {
// Start with the appropriately encoded credentials.
buffer.append("credentials=");
buffer.append(URLEncoder.encode(credentials, "UTF-8"));
// Add the appropriately encoded identity information.
buffer.append("&identity=");
buffer.append(URLEncoder.encode(identity, "UTF-8"));
// Add the appropriately formatted time stamp. Note that
// the time stamp is expressed in seconds, not milliseconds.
buffer.append("&time=");
buffer.append(time.getTime() / 1000);
// Generate and add the token signature.
String data = buffer.toString();
buffer.append("&signature=");
buffer.append(this.hmacSHA256(data, key));
} catch (UnsupportedEncodingException e) {
// UTF-8 encoding support is required.
throw new java.lang.AssertionError(
"ITunesU.getAuthorizationToken(): "
+ "UTF-8 encoding not supported!");
// Return the signed authorization token.
return buffer.toString();
* Send a request for an action to iTunes U with an authorization token.
* @param url URL defining how to communicate with iTunes U and
* identifying which iTunes U action to invoke and which iTunes
* U page or item to apply the action to. Such URLs have a
* format like <CODE>[PREFIX]/[ACTION]/[DESTINATION]</CODE>,
* where <CODE>[PREFIX]</CODE> is a value like
* "https://deimos.apple.com/WebObjects/Core.woa" which defines
* how to communicate with iTunes U, <CODE>[ACTION]</CODE>
* is a value like "Browse" which identifies which iTunes U
* action to invoke, and <CODE>[DESTINATION]</CODE> is a value
* like "example.edu" which identifies which iTunes U page
* or item to apply the action to. The destination string
* "example.edu" refers to the root page of the iTunes U site
* identified by the domain "example.edu". Destination strings
* for other items within that site contain the site domain
* followed by numbers separated by periods. For example:
* "example.edu.123.456.0789". You can find these
* strings in the items' URLs, which you can obtain from
* iTunes. See the iTunes U documentation for details.
* @param token Authorization token generated by getAuthorizationToken().
* @return The iTunes U response, which may be HTML or
* text depending on the type of action invoked.
public String invokeAction(String url, String token) {
// Send a request to iTunes U and record the response.
StringBuffer response = null;
try {
// Verify that the communication will be over SSL.
if (!url.startsWith("https")) {
throw new MalformedURLException(
"ITunesU.invokeAction(): URL \""
+ url + "\" does not use HTTPS.");
// Create a connection to the requested iTunes U URL.
HttpURLConnection connection =
(HttpURLConnection)new URL(url).openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty(
"Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
// Send the authorization token to iTunes U.
connection.connect();
OutputStream output = connection.getOutputStream();
output.write(token.getBytes("UTF-8"));
output.flush();
output.close();
// Read iTunes U's response.
response = new StringBuffer();
InputStream input = connection.getInputStream();
Reader reader = new InputStreamReader(input, "UTF-8");
reader = new BufferedReader(reader);
char[] buffer = new char[16 * 1024];
for (int n = 0; n >= 0;) {
n = reader.read(buffer, 0, buffer.length);
if (n > 0) response.append(buffer, 0, n);
// Clean up.
input.close();
connection.disconnect();
} catch (UnsupportedEncodingException e) {
// ITunes U requires UTF-8 and ASCII encoding support.
throw new java.lang.AssertionError(
"ITunesU.invokeAction(): UTF-8 encoding not supported!");
} catch (IOException e) {
// Report communication problems.
throw new java.lang.AssertionError(
"ITunesU.invokeAction(): I/O Exception " + e);
// Return the response received from iTunes U.
return response.toString();
* iTunes U credential and identity transmission sample. When your
* itunes U site is initially created, Apple will send your institution's
* technical contact a welcome email with a link to an iTunes U page
* containing the following information, which you will need to customize
* this method's code for your site:
<DD><DL><DT>
* Information:<DD><CODE>
* Site URL</CODE> - The URL to your site in iTunes U. The last
* component of that URL, after the last slash,
* is a domain name that uniquely identifies your
* site within iTunes U.<DD><CODE>
* shared secret</CODE> - A secret key known only to you and Apple that
* allows you to control who has access to your
* site and what access they have to it.<DD><CODE>
* debug suffix</CODE> - A suffix you can append to your site URL
* to obtain debugging information about the
* transmission of credentials and identity
* information from your institution's
* authentication and authorization services
* to iTunes U.<DD><CODE>
* administrator credential</CODE> - The credential string to assign
* to users who should have the
* permission to administer your
* iTunes U site.</DL></DD>
<DD>
* Once you have substitute the information above in this method's code
* as indicated in the code's comments, this method will connect
* to iTunes U and obtain from it the HTML that needs to be returned to a
* user's web browser to have a particular page or item in your iTunes U
* site displayed to that user in iTunes. You can modify this method to
* instead output the URL that would need to be opened to have that page
* or item displayed in iTunes.</DD>
public static void main(String argv[]) {
// Define your site's information. Replace these
// values with ones appropriate for your site.
String siteURL =
"https://deimos.apple.com/WebObjects/Core.woa/Browse/xxx.edu" ;
String debugSuffix = "/abc123";
String sharedSecret = "some key";
String administratorCredential =
"Administrator@urn:mace:itunesu.com:sites:xxx.edu";
// Define the user information. Replace the credentials with the
// credentials you want to grant to the current user, and the
// optional identity information with the identity of that user.
// For initial testing and site setup, use the singe administrator
// credential defined when your iTunes U site was created. Once
// you have access to your iTunes U site, you will be able to define
// additional credentials and the iTunes U access they provide.
String[] credentialsArray = { administratorCredential };
String displayName = "my name";
String emailAddress = "my [email protected]";
String username = "mylogin";
String userIdentifier = "1243";
// Define the iTunes U page to browse. Use the domain name that
// uniquely identifies your site in iTunes U to browse to that site's
// root page; use a destination string extracted from an iTunes U URL
// to browse to another iTunes U page; or use a destination string
// supplied as the "destination" parameter if this program is being
// invoked as a part of the login web service for your iTunes U site.
String siteDomain = siteURL.substring(siteURL.lastIndexOf('/') + 1);
String destination = siteDomain;
// Append your site's debug suffix to the destination if you want
// to receive an HTML page providing information about the
// transmission of credentials and identity between this program
// and iTunes U. Uncomment the following line for testing only.
//destination = destination + debugSuffix;
// Use an ITunesU instance to format the credentials and identity
// strings and to generate an authorization token for them.
ITunesU iTunesU = new ITunesU();
String identity = iTunesU.getIdentityString(displayName, emailAddress,
username, userIdentifier);
String credentials = iTunesU.getCredentialsString(credentialsArray);
Date now = new Date();
byte[] key = null;
try {
key = sharedSecret.getBytes("US-ASCII");
} catch (UnsupportedEncodingException e) {
throw new java.lang.AssertionError(
"ITunesU.hmacSH256(): US-ASCII encoding not supported!");
String token = iTunesU.getAuthorizationToken(credentials, identity,
now, key);
// Use the authorization token to connect to iTunes U and obtain
// from it the HTML that needs to be returned to a user's web
// browser to have a particular page or item in your iTunes U
// site displayed to that user in iTunes. Replace "/Browse/" in
// the code below with "/API/GetBrowseURL/" if you instead want
// to return the URL that would need to be opened to have that
// page or item displayed in iTunes.
String prefix = siteURL.substring(0, siteURL.indexOf(".woa/") + 4);
String url = prefix + "/Browse/" + destination;
String results = iTunesU.invokeAction(url, token);
System.out.println(results);
The itunes file from Shell folder has been modified as follows
DISPLAY_NAME= "myname"
EMAIL_ADDRESS="[email protected]"
USERNAME="mylogin"
USER_IDENTIFIER="1243"
all the other things in that file have been untouched.
I also generated the debug which looks like this
iTunes U Access Debugging
Received
Destination xxx.edu
Identity "my name" <[email protected]> (mylogin) [1243]
Credentials Administrator@urn:mace:itunesu.com:sites:xxx.edu
Time 1196706873
Signature 533870b8jshdidk333lfsf6a3143a55c132ec548a4d545bd79322402e8e2596e4
Analysis
The destination string is valid and the corresponding destination item was found.
The identity string is valid and provides the following information:
Display Name my name
Email Address [email protected]
Username mylogin
User Identifier 1243
The credential string is valid and contains the following recognized credential:
1. Administrator@urn:mace:itunesu.com:sites:xxx.edu
The time string is valid and corresponds to 2007-12-03 18:34:33Z.
The signature string is valid.
Access
Because the received signature and time were valid, the received identity and credentials were accepted by iTunes U.
In addition, the following 2 credentials were automatically added by iTunes U:
1. All@urn:mace:itunesu.com:sites:xxx.edu
2. Authenticated@urn:mace:itunesu.com:sites:xxx.edu
With these credentials, you have browsing, downloading, uploading, and editing access to the requested destination.
I am pretty new to this, and working on this for the first time.If someone could guide me through this would be pretty helpful.This is only going to work under IE !
Go to your page template :
Modify the definition, make sur you have this :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>#TITLE#</title>
#HEAD#
<Script language = javascript>
Browser = navigator.appName
Net = Browser.indexOf("Netscape")
Micro = Browser.indexOf("Microsoft")
Netscape = false
IE = false
if(Net >= 0) {Netscape = true}
if(Micro >= 0) {IE = true}
function XYpos() {
if (IE == true) {
xPos = event.screenX
yPos = event.screenY
alert(xPos + " left " + yPos + " down")
else if (Netscape == true) {alert("Script won't work: " + "\n" + "You're using Netscape")}
</script>
Modify the body definition, make sure you have this :
<body #ONLOAD# onMouseDown = XYpos()>
I didnt try it but it make sens to me... tell me if it works!
Flex
Homepage : http://www.insum.ca
InSum Solutions' blog : http://insum-apex.blogspot.com -
Help with Apple Script rewrite
I can't wrap my brain around applescript. I found this program mp3gain. It is written in applescript. I just need it to go to folder abc download and run, then save it to a folder names abc done. I can reset the db from the script. Any help would be great. All the itunes stuff can be deleted.
-- MacMP3Gain.applescript
-- MacMP3Gain
-- Created by Bery Rinaldo on Tue Jan 14 2003.
-- Copyright (c) 2003-2005 Bery Rinaldo. All rights reserved.
-- This AppleScript is used to wrap the command line version of mp3gain with a quaint GUI.
-- This program is free software; you can redistribute it and/or modify it under the terms
-- of the GNU General Public License as published by the Free Software Foundation; either
-- version 2 of the License, or (at your option) any later version.
-- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
-- without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License along with this program; if not,
-- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-- This program includes a binary version of aacgain downloaded from here
-- http://www.hydrogenaudio.org/forums/index.php?act=Attach&type=post&id=1461
-- aacgain version 1.4.0, derived from mp3gain version 1.4.6
-- copyright(c) 2001-2004 by Glen Sawyer
-- AAC support copyright(c) 2004 David Lasker, Altos Design, Inc.
-- uses mpglib, which can be found at http://www.mpg123.de
-- AAC support uses faad2 (http://www.audiocoding.com), and
-- mpeg4ip's mp4v2 (http://www.mpeg4ip.net)
-- Check out the MP3Gain/AACgain web sites:
-- http://mp3gain.sourceforge.net/
-- http://altosdesign.com/aacgain/
-- Version 1.0 - Initial release
-- Version 1.01 - Added status updates to display while mp3gain is running
-- Version 1.1 - 13-Feb-2003 - Added iTunes playlist support
-- Version 1.2 - 18-Feb-2003 - Added "Process Sub-folders" option to process all folders below the selected folder.
-- Version 1.3 - 20-Feb-2003 - Fixed program hang when "Allow Clipping" checkbox was unchecked.
-- Version 1.4 - 23-Feb-2003 - Added target MP3 Gain dB value, added preferences file support for all controls
-- Version 1.5 - 26-Feb-2003 - Integrate "Be Nice" feature from Michael Heinz. Added "Cancel" feature.
-- Version 1.6 - 28-Feb-2003 - Minor GUI tweaks to "Be Nice" an "Target" buttons to disable while running.
-- Version 1.7 - 01-Nov-2003 - Update to mp3gain 1.4.3, use -k (autoClip) option when "Allow Clipping" is unchecked
-- Version 1.8 - 09-Nov-2003 - Update run_mp3gain.pl to handle iTunes 4 playlists
-- Version 1.9 - 23-Aug-2005 - Update for Tiger & AAC
property ref_folder : ""
property ref_playlist : ""
property running : false
property mp3gain : ""
property run_mp3gain : ""
on clicked theObject
if name of theObject is "Start" then
if running is true then
set title of button "Start" of window "MainWindow" to "Start"
try
set pids to do shell script "ps -auxww | egrep \"" & run_mp3gain & "|" & aacgain & "\" | grep -v grep | awk '{ print $2 }' | xargs kill"
end try
set running to false
tell progress indicator "BusyBar" of window "MainWindow" to stop
set visible of progress indicator "BusyBar" of window "MainWindow" to false
tell window "MainWindow" to update
set contents of text field "StatusMessage" of window "MainWindow" to "Processing aborted."
set enabled of button "Start" of window "MainWindow" to false
set enabled of button "Choose Folder" of window "MainWindow" to true
set enabled of button "Choose Playlist" of window "MainWindow" to true
set enabled of button "Clip" of window "MainWindow" to true
set enabled of button "Sub" of window "MainWindow" to true
set enabled of button "Target" of window "MainWindow" to true
set enabled of button "Nice" of window "MainWindow" to true
set targetchecked to state of button "Target" of window "MainWindow" as integer
if targetchecked = 1 then
set enabled of text field "TargetValue" of window "MainWindow" to true
set targetvalue to 75
try
set targetvalue to contents of default entry "TargetValue" of user defaults as integer
end try
set contents of text field "TargetValue" of window "MainWindow" to targetvalue
else
set enabled of text field "TargetValue" of window "MainWindow" to false
set contents of text field "TargetValue" of window "MainWindow" to 89
end if
set enabled of matrix "ARmatrix" of window "MainWindow" to true
set ref_folder to ""
set contents of text field "FolderPath" of window "MainWindow" to "No folder selected"
set ref_playlist to ""
set contents of text field "PlaylistName" of window "MainWindow" to "No playlist selected"
tell window "MainWindow" to update
else
set clip to (state of button "Clip" of window "MainWindow") as integer
set albumradio to current row of matrix "ARmatrix" of window "MainWindow"
set options to " -q "
if clip = 1 then
set options to options & "-c "
else
set options to options & "-k "
end if
if albumradio = 1 then
set options to options & "-a "
else
set options to options & "-r "
end if
set nicechecked to state of button "Nice" of window "MainWindow" as integer
set targetchecked to state of button "Target" of window "MainWindow" as integer
if targetchecked = 1 then
set targetdb to integer value of text field "TargetValue" of window "MainWindow"
set targetparam to targetdb - 89
set options to options & "-m " & (targetparam as string) & " "
end if
set can_run to false
if ref_playlist is not equal to "" then
set the playlist_text to ""
tell application "iTunes"
set the track_count to the count of tracks of playlist ref_playlist
repeat with z from 1 to the track_count
tell track z of playlist ref_playlist
copy {database ID} to {dbid}
end tell
set the playlist_text to the playlist_text & (dbid as string) & ","
end repeat
end tell
activate
if track_count = 0 then
display dialog "The playlist is empty." buttons {"OK"}
else
set options to options & "-P " & playlist_text
set can_run to true
end if
else
set folder_path to POSIX path of ref_folder
set sub to (state of button "Sub" of window "MainWindow") as integer
if sub = 1 then
set options to options & "-S -F \"" & folder_path & "\""
set can_run to true
else
set command to "cd \"" & folder_path & "\" ; ls *.mp3 *.m4a 2> /dev/null"
set output to do shell script command
if output is equal to "" then
display dialog "No MP3/M4A files were found in the specified folder." buttons {"OK"}
else
set options to options & "-F \"" & folder_path & "\""
set can_run to true
end if
end if
end if
if can_run is equal to true then
set enabled of button "Start" of window "MainWindow" to false
set enabled of button "Choose Folder" of window "MainWindow" to false
set enabled of button "Choose Playlist" of window "MainWindow" to false
set enabled of button "Clip" of window "MainWindow" to false
set enabled of button "Sub" of window "MainWindow" to false
set enabled of button "Target" of window "MainWindow" to false
set enabled of button "Nice" of window "MainWindow" to false
set enabled of text field "TargetValue" of window "MainWindow" to false
set enabled of matrix "ARmatrix" of window "MainWindow" to false
set visible of progress indicator "BusyBar" of window "MainWindow" to true
set uses threaded animation of progress indicator "BusyBar" of window "MainWindow" to true
tell progress indicator "BusyBar" of window "MainWindow" to start
tell window "MainWindow" to update
if nicechecked = 1 then
set command to "nice -n 1 "
else
set command to ""
end if
set command to command & "\"" & run_mp3gain & "\" " & options & " > /tmp/.mp3gain_output 2>&1"
--display dialog command
try
ignoring application responses
do shell script command & "&"
end ignoring
end try
set running to true
set title of button "Start" of window "MainWindow" to "Cancel"
set enabled of button "Start" of window "MainWindow" to true
tell window "MainWindow" to update
end if
end if
else if name of theObject is "Choose Playlist" then
tell application "iTunes"
set allPlaylists to name of user playlists
end tell
activate
set playlist_choice to choose from list allPlaylists with prompt "Which playlist?" multiple selections allowed 0
if playlist_choice is false then --nothing selected, just stop
set ref_playlist to ""
set contents of text field "PlaylistName" of window "MainWindow" to "No playlist selected."
else
set ref_playlist to playlist_choice as string
set contents of text field "PlaylistName" of window "MainWindow" to ref_playlist
set ref_folder to ""
set contents of text field "FolderPath" of window "MainWindow" to ""
set state of button "Sub" of window "MainWindow" to false
set enabled of button "Sub" of window "MainWindow" to false
set enabled of button "Start" of window "MainWindow" to true
tell window "MainWindow" to update
end if
else if name of theObject is "Sub" then
set ischecked to state of button "Sub" of window "MainWindow" as integer
try
set contents of default entry "Sub" of user defaults to ischecked
end try
else if name of theObject is "Clip" then
set ischecked to state of button "Clip" of window "MainWindow" as integer
try
set contents of default entry "Clip" of user defaults to ischecked
end try
else if name of theObject is "Nice" then
set nicechecked to state of button "Nice" of window "MainWindow" as integer
try
set contents of default entry "Nice" of user defaults to nicechecked
end try
else if name of theObject is "Target" then
set targetchecked to state of button "Target" of window "MainWindow" as integer
try
set contents of default entry "Target" of user defaults to targetchecked
end try
if targetchecked = 1 then
set enabled of text field "TargetValue" of window "MainWindow" to true
set targetvalue to 89
try
set targetvalue to contents of default entry "TargetValue" of user defaults as integer
end try
set contents of text field "TargetValue" of window "MainWindow" to targetvalue
else
set enabled of text field "TargetValue" of window "MainWindow" to false
set contents of text field "TargetValue" of window "MainWindow" to 89
end if
else if name of theObject is "ARmatrix" then
set albumradio to current row of matrix "ARmatrix" of window "MainWindow" as integer
try
set contents of default entry "AlbumRadio" of user defaults to albumradio
end try
else if name of theObject is "Choose Folder" then
set ref_folder to choose folder with prompt "Choose the folder where the MP3/M4A files are stored"
set contents of text field "FolderPath" of window "MainWindow" to ref_folder as string
set ref_playlist to ""
set contents of text field "PlaylistName" of window "MainWindow" to ""
set state of button "Sub" of window "MainWindow" to true
set enabled of button "Sub" of window "MainWindow" to true
set enabled of button "Start" of window "MainWindow" to true
tell window "MainWindow" to update
end if
end clicked
on will finish launching theObject
-- display dialog "IN the will finish launching thing"
set running to false
set mypath to POSIX path of (path to me as string)
set aacgain to mypath & "Contents/Resources/aacgain"
set run_mp3gain to mypath & "Contents/Resources/run_mp3gain.pl"
try
make new default entry at end of default entries of user defaults with properties {name:"AlbumRadio", contents:1}
end try
set albumradio to 1
try
set albumradio to contents of default entry "AlbumRadio" of user defaults as integer
end try
set current row of matrix "ARmatrix" of window "MainWindow" to albumradio
my getpreferencebutton("Clip")
my getpreferencebutton("Sub")
my getpreferencebutton("Target")
my getpreferencebutton("Nice")
try
make new default entry at end of default entries of user defaults with properties {name:"TargetValue", contents:89}
end try
set targetvalue to 89
try
set targetvalue to contents of default entry "TargetValue" of user defaults as integer
end try
set contents of text field "TargetValue" of window "MainWindow" to targetvalue
set targetchecked to state of button "Target" of window "MainWindow" as integer
if targetchecked = 1 then
set enabled of text field "TargetValue" of window "MainWindow" to true
else
set enabled of text field "TargetValue" of window "MainWindow" to false
set contents of text field "TargetValue" of window "MainWindow" to 89
end if
set visible of progress indicator "BusyBar" of window "MainWindow" to false
tell window "MainWindow" to update
set visible of window "MainWindow" to true
end will finish launching
on will close theObject
quit
end will close
on changed theObject
set targetdb to integer value of text field "TargetValue" of window "MainWindow"
try
set contents of default entry "TargetValue" of user defaults to targetdb
end try
end changed
on idle
-- display dialog "idle " & running
if running is true then
set psout to ""
set stout to ""
try
set psout to do shell script "ps -auxww | grep \"" & run_mp3gain & "\" | grep -v grep"
set stout to do shell script "grep -a -v '^$' /tmp/.mp3gain_output | tail -1"
end try
if stout = "" then
if ref_playlist is not equal to "" then
set stout to "Processing iTunes playlist " & ref_playlist & " ..."
else
set stout to "Processing folder " & ref_folder & " ..."
end if
else
set stlen to length of stout
if stlen > 75 then
set firstpart to (characters 1 through 30 of stout) as string
set startlast to stlen - 30
set lastpart to (characters startlast through stlen of stout) as string
set stout to firstpart & "..." & lastpart
end if
end if
set contents of text field "StatusMessage" of window "MainWindow" to stout
tell window "MainWindow" to update
if psout is equal to "" then
set running to false
set title of button "Start" of window "MainWindow" to "Start"
tell progress indicator "BusyBar" of window "MainWindow" to stop
set visible of progress indicator "BusyBar" of window "MainWindow" to false
tell window "MainWindow" to update
set contents of text field "StatusMessage" of window "MainWindow" to "Processing complete."
set enabled of button "Start" of window "MainWindow" to false
set enabled of button "Choose Folder" of window "MainWindow" to true
set enabled of button "Choose Playlist" of window "MainWindow" to true
set enabled of button "Clip" of window "MainWindow" to true
set enabled of button "Sub" of window "MainWindow" to true
set enabled of button "Target" of window "MainWindow" to true
set enabled of button "Nice" of window "MainWindow" to true
set targetchecked to state of button "Target" of window "MainWindow" as integer
if targetchecked = 1 then
set enabled of text field "TargetValue" of window "MainWindow" to true
else
set enabled of text field "TargetValue" of window "MainWindow" to false
set contents of text field "TargetValue" of window "MainWindow" to 89
end if
set enabled of matrix "ARmatrix" of window "MainWindow" to true
set ref_folder to ""
set contents of text field "FolderPath" of window "MainWindow" to "No folder selected"
set ref_playlist to ""
set contents of text field "PlaylistName" of window "MainWindow" to "No playlist selected"
tell window "MainWindow" to update
end if
end if
return 1
end idle
on will quit theObject
if running is true then
try
set pids to do shell script "ps -auxww | egrep \"" & run_mp3gain & "|" & aacgain & "\" | grep -v grep | awk '{ print $2 }' | xargs kill"
end try
end if
end will quit
on getpreferencebutton(buttonname)
try
-- this is how to initialize the preferences mechanism...it will not reset the value if one exists already
make new default entry at end of default entries of user defaults with properties {name:buttonname, contents:0}
end try
set value to 0
try
set value to contents of default entry buttonname of user defaults as integer
end try
if value = 1 then
set state of button buttonname of window "MainWindow" to true
else
set state of button buttonname of window "MainWindow" to false
end if
end getpreferencebuttonhi riker123
it is written in applescript, but it is written for AppleScript Studio & Xcode which has now been superseded by AppleScriptObjC & Xcode, used under OSX 10.6
Looking at your Mac specs you could use AppleScript Studio & Xcode
to set this code up, you will find a copy of Xcode on your OSX installer disk.
Not to discourage you but Xcode needs a bit of work to get the hang off,
but that's part of the fun.
Budgie -
Hi,
I have a requirement need a help.
Requirement states like this:
I need to write a shell script through which I need to search a huge lines code and to find out following information :
1. Total No of lines of the code
2. No of DML statements (select,update,insert, delete) used like how many SELECT, How many UPDATE etc used in it.
3. No of base apps tables referenced like How many tables starting with "CMF_" is present.
4. No of procedure calls like how many procedures starting with "PROC_" used.
Can anyone help me in this ? I need to script.
My Unix version is :
$ uname -a
SunOS appsnet 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
Thanks in advance
[email protected]What you need here is a AWK script. This script will read the input as the source file (as command line
argument or as standard input), and process each like of the file read to look for the different patterns
in that line (looking for example if the line contans "SELECT " or "INSERT " etc...) and increment its
corresponding count. At the end of the script in the END section you can get the number of lines with the
NR awk inbuilt variable.
Hope this helps.
Hi,
I have a requirement need a help.
Requirement states like this:
I need to write a shell script through which I need to search a huge lines code and to find out following information :
1. Total No of lines of the code
2. No of DML statements (select,update,insert, delete) used like how many SELECT, How many UPDATE etc used in it.
3. No of base apps tables referenced like How many tables starting with "CMF_" is present.
4. No of procedure calls like how many procedures starting with "PROC_" used.
Can anyone help me in this ? I need to script.
My Unix version is :
$ uname -a
SunOS appsnet 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-4
Thanks in advance
[email protected] -
Help with a script for elder friend
First off, with apologies, I am not a script familar person at all. I have an elderly friend who is switching to Mac for the first time. I wanted a way to close all open programs, with a prompt to save any open files and then run a Time Machine backup and shut down - preferably without restarting next day with any windows opening automatically. Time Machine is set to run every hour but she's a writer and could lose work if Time Machine doesn't run before shutting down for the night. So I searched and found some small scripts that I tried to put together. I think it works but after Time Machine runs it waits a very long time before shutting down. I'm wondering if some of you kind folks could refine this for me. (I do realize that automator has a quit all programs that I can save as an app but I'm trying to make this a one step 'app' process.)
So what I have is this:
tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}
try
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
set this_process to item i of the process_list
if this_process is not in white_list then
tell application this_process
quit
end tell
end if
end repeat
on error
tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try
do shell script "/bin/bash -c '/System/Library/CoreServices/backupd.bundle/Contents/Resources/backupd-helper > /dev/null 2>&1 &'"
repeat
delay 5
if not IsProcRunning("backupd") then
ignoring application responses
tell application "Finder" to shut down
end ignoring
exit repeat
end if
end repeat
on IsProcRunning(theProc)
try
do shell script "ps auxc | grep \"" & theProc & "\""
return true
on error
return false
end try
end IsProcRunning
.... frankly I don't understand most of this in reality but it's a need I'd like to help her with on her Mac Mini.
Many Thanks,
BrendaFirst off, you're overthinking this. There's no reason why your friend would lose any data by not backing up prior to shutdown (unless she has a flaky hard drive that needs to be replaced). Assuming she's saving her work when she quits her apps, she should be fine.
Second, trying to auto-quit applications is dangerous. You don't check to see if any files need to be saved (there's no easy way to make that check anyway), and that in itself could cause data loss.
Third, time machine has its own command line utility: tmutil. There's no reason to script backupd.
Last, if I remember correctly, whether or not apps and windows reopen at startup can be set on a system-wide or per-application basis.
Give a clearer and more specific description of the goals you're trying to accomplish: what kind of apps are likely to be open, which of them will/might need to save data, what you want the machine to look like on restart, all with details. That would help a lot. -
Help with two scripts - Mounting remote DMG and Checking which network I'm connected to
Hey guys, I need some help with two separate scripts:
1. The first script I'm trying to create to mount a DMG stored remotely on another Mac using an AppleScript or shell script. Using the following:
set cmd to "hdiutil mount 'afp://username:[email protected]/Lion/Users/username/Desktop/Test.sparseim age'"
do shell script cmd
results in the following error:
error "hdiutil: mount failed - not recognized" number 1
I'm not very experienced regarding AppleScript or using hdiutil, could somebody point out what's wrong with my script?
2. The second script I'm working on to try and essentially prevent the 'Could Not Find Server' Finder dialog when a network mount is unavailable. I guess what I'd like it to do is detect which network I'm connected to, and if I'm connected to the correct network, then mount the shares, otherwise just fail silently without any errors. From the searching I've done, using try statements should do this, but they do not, and I'm still presented with an error dialog after the server cannot be found.
Does anybody have any suggestions on this script? Also, I've seen some tips regarding detecting which wireless network the Mac is connected to, which could work, but what about when connected via Ethernet?
Thanks!Edit: I need to clarify on my first script request:
I need to mount the DMG on the remote Mac, not on the Mac I'm running the script from. -
When I run this script from within the applescript edito I get the popup dialog. For some reason it is not finding the file. I know it exists.
try
tell application "Finder"
if exists file "SavedIP.log" in "/Library/Logs" then
set savedIP to do shell script "cat /Library/Logs/SavedIP.log"
end if
end tell
on error errmsg
display dialog errmsg
end try
Thank you for any help.While it's often a good idea to check for files before reading them, it can cause confusion especially when trying to mix Mac-style (colon-delimited) and UNIX-style (slash-delimited) paths, as you've seen.
An alternative is to not bother checking - just read the file and catch any errors that occur (such as the file not existing):
try
set SavedIP to do shell script "cat /Library/Logs/SavedIP.log"
on error
-- file does not exist
end try
In this case the assumption is that the file does exist, but if it doesn't (or if some other error occurs) then you can trap that case in the 'on error' block, and deal with it accordingly. -
I need help with this script please ASAP
So I need this to work properly, but when ran and the correct answer is chosen the app quits but when the wrong answer is chosen the app goes on to the next question. I need help with this ASAP, it is due tommorow. Thank you so much for the help if you can.
The script (Sorry if it's a bit long):
#------------Startup-------------
display dialog "Social Studies Exchange Trviva Game by Justin Parzik" buttons {"Take the Quiz", "Cyaaaa"} default button 1
set Lolz to (button returned of the result)
if Lolz is "Cyaaaa" then
killapp()
else if Lolz is "Take the Quiz" then
do shell script "say -v samantha Ok starting in 3…2…1…GO!"
#------------Question 1-----------
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 2--------
display dialog "Most children were taught
to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------------Question 3---------
display dialog "In the 1730s and 1740s, a religious movement called the_______swept through the colonies." buttons {"Glorius Revolution", "Great Awakening", "The Enlightenment"}
set A3 to (button returned of the result)
if A3 is "Great Awakening" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-----------Question 4--------
display dialog "_______ was
a famous American Enlightenment figure." buttons {"Ben Franklin", "George Washington", "Jesus"}
set A4 to (button returned of the result)
if A4 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 5-------
display dialog "______ ownership gave colonists political rights as well as prosperity." buttons {"Land", "Dog", "Slave"}
set A5 to (button returned of the result)
if A5 is "Land" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 6--------
display dialog "The first step toward guaranteeing these rights came in 1215. That
year, a group of English noblemen forced King John to accept the…" buttons {"Declaration of Independence", "Magna Carta", "Constitution"}
set A6 to (button returned of the result)
if A6 is "Magna Carta" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#----------Question 7--------
display dialog "England's cheif lawmaking body was" buttons {"the Senate", "Parliament", "King George"}
set A7 to (button returned of the result)
if A7 is "Parliament" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 8-----
display dialog "Pariliament decided to overthrow _______ for not respecting their rights" buttons {"King James II", "King George", "King Elizabeth"}
set A8 to (button returned of the result)
if A8 is "King James II" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 9------
display dialog "Parliament named ___ and ___ as England's new monarchs in something called ____." buttons {"William/Mary/Glorius Revolution", "Adam/Eve/Great Awakening", "Johhny/Mr.Laphalm/Burning of the hand ceremony"}
set A9 to (button returned of the result)
if A9 is "William/Mary/Glorius Revolution" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 10-----
display dialog "After accepting the throne William and Mary agreed in 1689 to uphold the English Bill of _____." buttons {"Money", "Colonies", "Rights"}
set A10 to (button returned of the result)
if A10 is "Rights" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 11------
display dialog "By the late 1600s French explorers had claimed the ___ River Valey" buttons {"Mississippi", "Ohio", "Hudson"}
set A11 to (button returned of the result)
if A11 is "Ohio" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------Question 12---------
display dialog "______ was sent to ask the French to leave 'English Land'." buttons {"Johhny Tremain", "George Washington", "Paul Revere"}
set A12 to (button returned of the result)
if A12 is "George Washington" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#---------Question 13-------
display dialog "_____ proposed the Albany Plan of Union" buttons {"George Washingon", "Ben Franklin", "John Hancock"}
set A13 to (button returned of the result)
if A13 is "Ben Franklin" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#--------Question 14------
display dialog "The __________ declared that England owned all of North America east of the Mississippi" buttons {"Proclomation of England", "Treaty of Paris", "Pontiac Treaty"}
set A14 to (button returned of the result)
if A14 is "" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#-------Question 15-------
display dialog "Braddock was sent to New England so he could ______" buttons {"Command an attack against French", "Scalp the French", "Kill the colonists"}
set A15 to (button returned of the result)
if A15 is "Command an attack against French" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
#------TheLolQuestion-----
display dialog "____ is the name of the teacher who runs this class." buttons {"Mr.White", "Mr.John", "Paul Revere"} default button 1
set LOOL to (button returned of the result)
if LOOL is "Mr.White" then
do shell script "say -v samantha Congratulations…you…have…common…sense"
else
do shell script "say -v alex Do…you…have…eyes?"
#------END------
display dialog "I hope you enjoyed the quiz!" buttons {"I did!", "It was horrible"}
set endmenu to (button returned of the result)
if endmenu is "I did!" then
do shell script "say -v samantha Your awesome"
else
do shell script "say -v alex Go outside and run a lap"
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end if
end ifUse code such as:
display dialog "Around age 11, many boys left their fathers to become…" buttons {"Scholars", "Warriors", "Apprentices"}
set A1 to (button returned of the result)
if A1 is "Apprentices" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
#----------Question 2--------
display dialog "Most children were taught to read so that they could understand the…" buttons {"Music of Mozart", "Bible", "art of cooking"}
set A2 to (button returned of the result)
if A2 is "Bible" then
do shell script "say -v samantha Correct Answer"
else
do shell script "say -v samantha Wrong Answer"
return
end if
(90444)
Maybe you are looking for
-
I did the etre check and these were the results. I don't know if this is helpful or not. Hardware Information: MacBook Pro (13-inch, Mid 2012) MacBook Pro - model: MacBookPro9,2 1 2.5 GHz Intel Core i5 CPU: 2 cores
-
Photoshop CS4 11.0.1 and 11.0.2 Updaters Crash in 10.6.4
I am unable to update a volume license copy of CS4 Photoshop 11.0 to anything newer. Adobe Updater 6 claims there are no updates (after searching for less than 1 second) and the manual 11.0.1 and 11.0.2 updaters initially run but both crash when I cl
-
Suggestion for improvement of Nokia N9
I don't know about everyone else, but I love my Nokia N9, but recently I have had to switch phone to the Samsung Galaxy S3. Main reasons for the change - Storage space and apps. 1. I would suggest having a expandable slot for Micro SD to increase sto
-
Hi Gurus, i am getting problm with changee editor in sap script. when i do some changes in scrip it not saving new changes . can any one tel me how modifty text in change editor and how save text in change ediot. Ramesh
-
Reducing a photo to fit into my mum's 100th birthday invitation.
The printers told me to reduce the photo to 25 MB and it should be on a PDF. I have put the photo into a PDF & the message is still the same. I don't know what I'm doing, for a start. I get a box in Photoshop saying stuff like "pixel dimensions 71