Need help with a FormCalc scripting
I am new to FormCalc and need some help. I am creating an interactive PDF in which I need a FormCalc script code for the following situation. I need to have a check box initate a script in another field. For example; I have one numeric field for quanity ordered (user input) and a check box for an optional add-on. Once the check box for the add-on is selected; I need a third field to reflect the price of the add-on * the numeric value in the quanity field.
ProductPrice Product Quanity Add-On Total Cost
Pd1 2 ($300) check box Product Price * Product Quanity + Add-On Price (if clicked) * Product Quanity
Can anyone help?
That was helpful but I still can't see to get it work. In the form I am creating The field that needs to autocalc. is to be triggered by the user clicking an add-on box. I have the add-on checkbox values set as 1=check and 0=unchecked. The idea is that when the that box is checked, the "ItemTotal" field to be calculated will be triggered to then take the Quanity field and mulitply by 300. Below is the script I tried to use and the error message returned when the Add-on box is checked.
if (Add-onBoxName == 1) then
Quantity * 300
Error message in Adobe Reader when box is checked:
Script failed (language is formcalc, context is xfa[0].form[0].topmostSubform[0].Page2[0].Add-onCheckBox[0])
script=if (Add-onCheckBox = = 1) then
ItemTotal = Quantity * 300
Error: syntax error near token '300' on line 4, column 0.
Similar Messages
-
[solved]Need help with a bash script for MOC conky artwork.
I need some help with a bash script for displaying artwork from MOC.
Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
mocp -Q %file
gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last '/'?)
A point in the right direction would be appreciated.
thanks, d
Last edited by dgz (2013-08-29 21:24:28)Xyne wrote:
You should also quote the variables and output in double quotes to make the code robust, e.g.
filename="$(mocp -Q %file)"
dirname="${filename%/*}"
cp "$dirname"/front.jpg ~/backup/art.jpg
Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
thanks for the tip.
here it is, anyhow:
#!/bin/bash
filename=$(mocp -Q %file)
dirname=${filename%/*}
cp ${dirname}/front.jpg ~/backup/art.jpg
then in conky:
$alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
thanks for the help.
Last edited by dgz (2013-08-29 21:26:32) -
Need help with PHP mail script [was: Can someone please help me?]
I'm trying to collect data from a form and email it. I'm using form2mail.php and the problem is that the email is not collecting the form info and it has the same email address in the From: and To: lines. I'm really stuck and would appreciate any help.
Here is the HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Contact Us</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {
font-size: 14px;
color: #000000;
body {
background-color: #FFFFFF;
body,td,th {
color: #CC3300;
.style3 {font-size: 14px; font-weight: bold; }
.style6 {font-size: 18px}
.style7 {font-size: 16px}
.style8 {font-size: 16px; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style9 {font-size: 16px; font-weight: bold; font-family: Verdana, Arial, Helvetica, sans-serif; }
.style10 {color: #000000}
-->
</style>
</head>
<body>
<div align="center"><img src="nav2.jpg" alt="nav bar" width="698" height="91" border="0" usemap="#Map2" />
<map name="Map2" id="Map2">
<area shape="rect" coords="560,9,684,38" href="accessories.html" />
<area shape="rect" coords="456,8,548,38" href="contact.html" />
<area shape="rect" coords="305,8,435,40" href="photog.html" />
<area shape="rect" coords="187,9,283,39" href="services.html" />
<area shape="rect" coords="81,10,167,39" href="aboutus.html" />
<area shape="rect" coords="5,10,68,39" href="index.html" />
</map>
<map name="Map" id="Map">
<area shape="rect" coords="9,9,69,39" href="index.html" />
<area shape="rect" coords="83,11,165,39" href="aboutus.html" />
<area shape="rect" coords="182,9,285,38" href="services.html" />
<area shape="rect" coords="436,14,560,37" href="contact.html" />
<area shape="rect" coords="563,14,682,38" href="accessories.html" />
</map>
</div>
<p> </p>
<form id="TheForm" name="TheForm" action="form2mail.php" method="post">
<p align="center" class="style2">P<span class="style1">lease fill out form below for a "free no obligation quote" then click submit.</span></p>
<p align="center" class="style3">(*Required Information)</p>
<div align="center">
<pre><strong><span class="style8">*Contact Name</span> </strong><input name="name" type="text" id="name" />
<span class="style8"><strong>
Business Name </strong></span><input name="bn" type="text" id="bn" />
<span class="style8"><strong>*Phone Number <input type="text" name="first" size="3" onFocus="this.value='';"
onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.second);" maxlength="3" value="###" /> - <input type="text" name="second" size="3" onFocus="this.value='';" onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.third);" maxlength="3" value="###" /> - <input type="text" name="third" size="4" onFocus="this.value='';" onKeyup="checkNumber(this.value); autoTab(this, document.TheForm.fourth);" maxlength="4" value="####"/> </strong></span>
<strong><span class="style1">*</span><span class="style8">Email Address</span> <input name="email" type="text" id="email" /> </strong> </pre>
<label><span class="style9">*Re-enter to confirm</span>
<input name="emx" type="text" id="emx" /></label><br /><br /><span class="style9">
<label></label>
</span>
<p><span class="style9">*Best time to call </span>
<select name="name1[]" multiple size="1" >
<option>8am-9am</option>
<option>9am-10am</option>
<option>10am-11am</option>
<option>11am-12pm</option>
<option>12pm-1pm</option>
<option>1pm-2pm</option>
<option>2pm-3pm</option>
<option>3pm-4pm</option>
<option>4pm-5pm</option>
<option>5pm-6pm</option>
<option>6pm-7pm</option>
<option>7pm-8pm</option>
</select>
<br />
<br />
<span class="style9">Type of Location</span>
<select name="name2[]" multiple size="1" >
<option>Residential</option>
<option>Commercial</option>
</select>
<br />
<br />
<span class="style1"><br />
<strong><br />
<span class="style6">*Type of Services Requested:</span></strong><br />
</span><strong><span class="style10">(check all that apply)</span><br />
</strong><br />
<span class="style7"><span class="style1"><strong>Janitorial cleaning</strong></span>
<input type="checkbox" name="checkbox[]" value="checkbox" multiple/>
<br />
</span><strong><br />
<span class="style8">Mobile Auto Detailing</span>
<input type="checkbox" name="checkbox2[]" value="checkbox" multiple/>
<br />
<br />
</strong><span class="style9">Moving/Hauling</span>
<input type="checkbox" name="checkbox3[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Pressure washing</span>
<input type="checkbox" name="checkbox4[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Window washing</span>
<input type="checkbox" name="checkbox5[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Window Tinting</span>
<input type="checkbox" name="checkbox6[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Boat cleaning</span>
<input type="checkbox" name="checkbox7[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">RV cleaning</span>
<input type="checkbox" name="checkbox8[]" value="checkbox" multiple/>
<br />
<br />
<span class="style9">Motorcycle cleaning</span>
<input type="checkbox" name="checkbox9[]" value="checkbox" multiple/>
<br />
<br />
<br />
<br />
<input name="SB" type="button" class="style9" value="Submit" onClick="sendOff();">
</p>
</div></label>
<script language="JavaScript1.2">
// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this header
var good;
function checkEmailAddress(field) {
// Note: The next expression must be all on one line...
// allow no spaces, linefeeds, or carriage returns!
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org) |(\..{2,2}))$)\b/gi);
if (goodEmail){
good = true
} else {
alert('Please enter a valid e-mail address.')
field.focus()
field.select()
good = false
function autoTab(startPoint,endPoint){
if (startPoint.getAttribute&&startPoint.value.length==startPoint.getAttribute("max length"))
endPoint.focus();
function checkNumber(phoneNumber){
var x=phoneNumber;
var phoneNumber=/(^\d+$)|(^\d+\.\d+$)/
if (phoneNumber.test(x))
testResult=true
else{
alert("Please enter a valid number.")
phoneNumber.focus();
phoneNumber.value="";
testResult=false
return (testResult)
function sendOff(){
namecheck = document.TheForm.name.value
if (namecheck.length <1) {
alert('Please enter your name.')
return
good = false
checkEmailAddress(document.TheForm.email)
if ((document.TheForm.email.value ==
document.TheForm.emx.value)&&(good)){
// This is where you put your action
// if name and email addresses are good.
// We show an alert box, here; but you can
// use a window.location= 'http://address'
// to call a subsequent html page,
// or a Perl script, etc.
window.location= 'form2mail.php';
if ((document.TheForm.email.value !=
document.TheForm.emx.value)&&(good)){
alert('Both e-mail address entries must match.')
</script>
</form>
<p> </p>
</body>
</html>
and here is the form2mail.php:
<?php
# You can use this script to submit your forms or to receive orders by email.
$MailToAddress = "[email protected]"; // your email address
$redirectURL = "http://www.chucksmobile.com/thankyou.html"; // the URL of the thank you page.
$MailSubject = "[Customer Contact Info]"; // the subject of the email
$sendHTML = FALSE; //set to "false" to receive Plain TEXT e-mail
$serverCheck = FALSE; // if, for some reason you can't send e-mails, set this to "false"
# copyright 2006 Web4Future.com =================== READ THIS ===================================================
# If you are asking for a name and an email address in your form, you can name the input fields "name" and "email".
# If you do this, the message will apear to come from that email address and you can simply click the reply button to answer it.
# To block an IP, simply add it to the blockip.txt text file.
# CHMOD 777 the blockip.txt file (run "CHMOD 777 blockip.txt", without the double quotes)
# This is needed because the script tries to block the IP that tried to hack it
# If you have a multiple selection box or multiple checkboxes, you MUST name the multiple list box or checkbox as "name[]" instead of just "name"
# you must also add "multiple" at the end of the tag like this: <select name="myselectname[]" multiple>
# you have to do the same with checkboxes
Web4Future Easiest Form2Mail (GPL).
Copyright (C) 1998-2006 Web4Future.com All Rights Reserved.
http://www.Web4Future.com/
This script was written by George L. & Calin S. from Web4Future.com
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.
# DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING ===================================================
$w4fver = "2.2";
$ip = ($_SERVER['HTTP_X_FORWARDED_FOR'] == "" ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR']);
//function blockIP
function blockip($ip) {
$handle = @fopen("blockip.txt", 'a');
@fwrite($handle, $ip."\n");
@fclose($handle);
$w4fx = stristr(file_get_contents('blockip.txt'),getenv('REMOTE_ADDR'));
if ($serverCheck) {
if (preg_match ("/".str_replace("www.", "", $_SERVER["SERVER_NAME"])."/i", $_SERVER["HTTP_REFERER"])) { $w4fy = TRUE; } else { $w4fy = FALSE; }
} else { $w4fy = TRUE; }
if (($w4fy === TRUE) && ($w4fx === FALSE)) {
$w4fMessage = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\"><html>\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"></head><body><font face=3Dverdana size=3D2>";
if (count($_GET) >0) {
reset($_GET);
while(list($key, $val) = each($_GET)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$vala = htmlspecialchars($vala);
if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
$w4fMessage .= "$vala, ";
$w4fMessage .= "<br>\n";
else {
$val = stripslashes($val);
if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) { blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }
else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }
} // end while
}//end if
else {
reset($_POST);
while(list($key, $val) = each($_POST)) {
$GLOBALS[$key] = $val;
if (is_array($val)) {
$w4fMessage .= "<b>$key:</b> ";
foreach ($val as $vala) {
$vala =stripslashes($vala);
$vala = htmlspecialchars($vala);
if (trim($vala)) { if (stristr($vala,"Content-Type:") || stristr($vala,"MIME-Version") || stristr($vala,"Content-Transfer-Encoding") || stristr($vala,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
$w4fMessage .= "$vala, ";
$w4fMessage .= "<br>\n";
else {
$val = stripslashes($val);
if (trim($val)) { if (stristr($val,"Content-Type:") || stristr($val,"MIME-Version") || stristr($val,"Content-Transfer-Encoding") || stristr($val,"bcc:")) {blockip($ip); die("ILLEGAL EXECUTION DETECTED!"); } }
if (($key == "Submit") || ($key == "submit")) { }
else { if ($val == "") { $w4fMessage .= "$key: - <br>\n"; }
else { $w4fMessage .= "<b>$key:</b> $val<br>\n"; }
} // end while
}//end else
$w4fMessage .= "<font size=3D1><br><br>\n Sender IP: ".$ip."</font></font></body></html>";
$w4f_what = array("/To:/i", "/Cc:/i", "/Bcc:/i","/Content-Type:/i","/\n/");
$name = preg_replace($w4f_what, "", $name);
$email = preg_replace($w4f_what, "", $email);
if (!$email) {$email = $MailToAddress;}
$mailHeader = "From: $name <$email>\r\n";
$mailHeader .= "Reply-To: $name <$email>\r\n";
$mailHeader .= "Message-ID: <". md5(rand()."".time()) ."@". ereg_replace("www.","",$_SERVER["SERVER_NAME"]) .">\r\n";
$mailHeader .= "MIME-Version: 1.0\r\n";
if ($sendHTML) {
$mailHeader .= "Content-Type: multipart/alternative;";
$mailHeader .= " boundary=\"----=_NextPart_000_000E_01C5256B.0AEFE730\"\r\n";
$mailHeader .= "X-Priority: 3\r\n";
$mailHeader .= "X-Mailer: PHP/" . phpversion()."\r\n";
$mailHeader .= "X-MimeOLE: Produced By Web4Future Easiest Form2Mail $w4fver\r\n";
if ($sendHTML) {
$mailMessage = "This is a multi-part message in MIME format.\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
$mailMessage .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730\r\n";
$mailMessage .= "Content-Type: text/html; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= "$w4fMessage\r\n\r\n";
$mailMessage .= "------=_NextPart_000_000E_01C5256B.0AEFE730--\r\n";
if ($sendHTML === FALSE) {
$mailHeader .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n";
$mailMessage .= trim(strip_tags($w4fMessage))."\r\n\r\n";
if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader)) { echo "Error sending e-mail!";}
else { header("Location: ".$redirectURL); }
} else { echo "<center><font face=verdana size=3 color=red><b>ILLEGAL EXECUTION DETECTED!</b></font></center>";}
?>
Thanks in advance,
Glenn
[Subject line edited by moderator to indicate nature of request]Using PHP to process an online form and send the input by email is very simple. The mail() function takes a minimum of three arguments, namely: the address the mail is being sent to, the subject line, and the body of the email as a single string. The reason some people use scripts like form2mail.php is because they don't have the knowledge or patience to validate the user input to make sure it's safe to send.
Rather than attempt to trawl through your complex form looking for the problems, I would suggest starting with a couple of simple tests.
First of all, create a PHP page called mailtest.php containing the following script:
<?php
$to = '[email protected]'; // use your own email address
$subject = 'PHP mail test';
$message = 'This is a test of the mail() function.';
$sent = mail($to, $subject, $message);
if ($sent) {
echo 'Mail was sent';
} else {
echo 'Problem sending mail';
?>
Save the script, upload it to your server, and load it into a browser. If you see "Mail is sent", you're in business. If not, it probably means that the hosting company insists on the fifth argument being supplied to mail(). This is your email address preceded by -f. Change the line of code that sends the mail to this:
$sent = mail($to, $subject, $message, null, '[email protected]');
Obviously, replace "[email protected]" with your own email address.
If this results in the mail being sent successfully, you will need to adapt the code in form2mail.php to accept the fifth parameter. You need to change the following line, which is a few lines from the end of the script:
if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader))
Change it to this:
if (!mail($MailToAddress, $MailSubject, $mailMessage,$mailHeader, '[email protected]'))
Again, use your own email address instead of "[email protected]".
Once you have determined whether you need the fifth argument, test form2mail.php with a very simple form like this:
<form id="form1" name="form1" method="post" action="form2mail.php">
<p>
<label for="name">Name:</label>
<input type="text" name="name" id="name" />
</p>
<p>
<label for="email">Email:</label>
<input type="text" name="email" id="email" />
</p>
<p>
<label>
<input type="checkbox" name="options[]" value="boat cleaning" id="options_0" />
Boat cleaning</label>
<br />
<label>
<input type="checkbox" name="options[]" value="RV cleaning" id="options_1" />
RV cleaning</label>
<br />
<label>
<input type="checkbox" name="options[]" value="motorcycle cleaning" id="options_2" />
Motorcycle cleaning</label>
</p>
<p>
<input type="submit" name="send" id="send" value="Submit" />
</p>
</form>
If that works, you can start to make the form more complex and add back your JavaScript validation. -
Need help with a basic script to resize image then resize the canvas
I am new to photoshop scripting, and have come across a need to force an image to be 8"x10" at 300dpi (whether it is vertical or horizontal)
I need to maintain the correct orientation in the file, so an Action will not work, I believe I have to implement a script to accomplish this.
I have the below script so far, but I am not certain of how to input the variables / paramters
doc = app.activeDocument;
if (doc.height > doc.width) doc.resizeImage("2400 pixels","3600 pixels", "300", "BICUBIC");
if (doc.height > doc.width) doc.resizeCanvas("2400 pixels","3000 pixels", "MIDDLECENTER");
if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
if (doc.height < doc.width) doc.resizeCanvas(3000,2400,"MIDDLECENTER");
When I run this script, I get the following error:
Error 1245: Illegal argument - argument 4
- Enumerated value expected
Line: 5
if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
The fact that its failing on lien 5 lets nme know that I have the "If" portions of my script correct, I just dont know how to accomplish the functions correctly.
Any help would be appreciated!
Thanks,
BrianI know I'm late here but it seems to me your trying to automate a 8"x10 or 10"x8 300DPI print.
To do that you must first crop your image to a 4:5 aspect ratio to prevent distortion unless your shooting with a 4" by 5" camera. I wrote a Plugin script a couple years ago that could help you do a centered crop. You could do the whole process by recording a simple Photoshop action that uses two Plugin Scripts only four steps would be needed.
Step 1 Menu File>Automate>AspectRatioSelection (My script based of Adobe Fit Image Plugin script) Set 4:5 Aspect ratio, center, Rectangle, Replace, no feather. Llike Fit Image this script woks on both Landscape and Portrait images. The Selection will be correct for the images orientation.
Step 2 Menu Image>Crop
Step 3 Menu File>Automate>Fit Image set 3000 PX height and 3000 PX width the Image will be Resample so its longest side will be 3000 pixels. Adobe Fit Image Plugin Script always uses BICUBIC resampling. I have a modified version of Fit Image that uses Bicubic Sharper whebndownsizing and BicubicSmoother when up sizing.
Step 4 Menu Image>Size un check resample set resolution to 300 DPI.
When you play the actions the Script Dialogs will not be displayed and the setting use when you recorded the action will ne used.
The Plugin Script are included in my crafting actions package:
http://www.mouseprints.net/old/dpr/JJMacksCraftingActions.zip
Contains:
Action Actions Palette Tips.txt
Action Creation Guidelines.txt
Action Dealing with Image Size.txt
Action Enhanced via Scripted Photoshop Functions.txt
CraftedActions.atn Sample Action set includes an example Watermarking action
Sample Actions.txt Photoshop CraftedActions set saved as a text file. This file has some additional comments I inserted describing how the actions work.
12 Scripts for actions
My other free Photoshop downloads cam be found here: http://www.mouseprints.net/Photoshop.html -
Need Help With Custom Calculation Script
Hey everyone. I'm using Acrobat Pro X and stumbling a bit on the syntax for the following equation. I need to add the value of "Cell1" & "Cell2" then add the value of "Cell3". However,the value of "Cell3" is entered by the user and specifies a percentage of the sum of "Cell1 & "Cell2". For example: If the user enters "3" into "Cell3" I need the returned value to be 3% of the sum of "Cell1" + "Cell2". If the user enters "9" into "Cell3" I need the returned value for "Cell3" to be 9% of the sum of "Cell1 & Cell2" and the end result needs to be the sum of "Cell1+Cell2+Cell3". In greater detail:
If "Cell1" = $500, "Cell2" = $500 and "Cell3" = "3" then I need the returned value to be $1030.00.
I hope this makes sense. Here's what I have so far but alas, it's not working. Any help would be GREATLY appreciated.
// Get first field value, as a number
var v1 = +getField("Cell1").value;
// Get second field value, as a number
var v2 = +getField("Cell2").value;
// Get processing field value, as a number
//var v3 = +getField("Cell3"/100).value;
// Calculate and set this field's value to the result
event.value = v3+(v1+v2);
Thanks,
SolanI posted an answer but realized it wasn't what you wanted. There is some confusion about what you want for Cell3. On the one hand, you say you want the user to enter a vaule in the field, but them you say you want its value to be calculated based on what the user enters and two other field values. It seems to me Cell3 should be the field that the user enters the percentage and the calculated field's (Cell4) script could then be:
// Get first field value, as a number
var v1 = +getField("Cell1").value;
// Get second field value, as a number
var v2 = +getField("Cell2").value;// Get processing field value, as a number
// Get the percentage
var v3 = +getField("Cell3").value;
// Calculate and set this field's value to the result
event.value = (1 + v3 / 100) * (v1 + v2); -
Need help with PHP mail script
I have created a log in system . In that when the user completes the registration process an auto reply(auto-reply@domain) will generate and sent this to users email id regarding about the user name and password (Lo gin Details). After formal approval from the admin the user will get a user activation mail with log in link.
But , my problem is these are work only for mail accounts from my domain only(test@domain). its not send any of above mentioned details to other mail services like gmail or yahoo etc.
i discussed this with some others, they said its the problem with your mail function configuration. but i didn't get any needful information as am a beginner in PHP scripting.
i have contacted this with my hosting service they said its the problem with php mail () function and use php mailer() instead mail().
please give me a solution for the same..
Here am ataching my code..
<?php
include 'dbc.php';
$err = array();
if($_POST['doRegister'] == 'Register')
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
if(empty($data['full_name']) || strlen($data['full_name']) < 4)
$err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name";
//header("Location: register.php?msg=$err");
//exit();
// Validate User Name
if (!isUserID($data['user_name'])) {
$err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
//header("Location: register.php?msg=$err");
//exit();
// Validate Email
if(!isEmail($data['usr_email'])) {
$err[] = "ERROR - Invalid email address.";
//header("Location: register.php?msg=$err");
//exit();
// Check User Passwords
if (!checkPwd($data['pwd'],$data['pwd2'])) {
$err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
//header("Location: register.php?msg=$err");
//exit();
$user_ip = $_SERVER['REMOTE_ADDR'];
// stores sha1 of password
$sha1pass = PwdHash($data['pwd']);
// Automatically collects the hostname or domain like example.com)
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
// Generates activation code simple 4 digit number
$activ_code = rand(1000,9999);
$usr_email = $data['usr_email'];
$user_name = $data['user_name'];
$rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error());
list($total) = mysql_fetch_row($rs_duplicate);
if ($total > 0)
$err[] = "ERROR - The username/email already exists. Please try again with different username and email.";
if(empty($err)) {
$sql_insert = "INSERT into `users`
(`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activa tion_code`,`country`,`user_name`
VALUES
('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]',' $data[web]'
,now(),'$user_ip','$activ_code','$data[country]','$user_name'
mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
$user_id = mysql_insert_id($link);
$md5_id = md5($user_id);
mysql_query("update users set md5_id='$md5_id' where id='$user_id'");
// echo "<h3>Thank You</h3> We received your submission.";
if($user_registration) {
$a_link = "
*****ACTIVATION LINK*****\n
http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
} else {
$a_link =
"Your account is *PENDING APPROVAL* and will be soon activated the administrator.
$message =
"Hello \n
Thank you for registering with us. Here are your login details...\n
User ID: $user_name
Email: $usr_email \n
Passwd: $data[pwd] \n
$a_link
Thank You
Administrator
$host_upper
THIS IS AN AUTOMATED RESPONSE.
***DO NOT RESPOND TO THIS EMAIL****
mail($usr_email, "Login Details", $message,
"From: \"Member Registration\" <auto-reply@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
header("Location: thankyou.php");
exit();
?>I have created a log in system . In that when the user completes the registration process an auto reply(auto-reply@domain) will generate and sent this to users email id regarding about the user name and password (Lo gin Details). After formal approval from the admin the user will get a user activation mail with log in link.
But , my problem is these are work only for mail accounts from my domain only(test@domain). its not send any of above mentioned details to other mail services like gmail or yahoo etc.
i discussed this with some others, they said its the problem with your mail function configuration. but i didn't get any needful information as am a beginner in PHP scripting.
i have contacted this with my hosting service they said its the problem with php mail () function and use php mailer() instead mail().
please give me a solution for the same..
Here am ataching my code..
<?php
include 'dbc.php';
$err = array();
if($_POST['doRegister'] == 'Register')
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
if(empty($data['full_name']) || strlen($data['full_name']) < 4)
$err[] = "ERROR - Invalid name. Please enter atleast 3 or more characters for your name";
//header("Location: register.php?msg=$err");
//exit();
// Validate User Name
if (!isUserID($data['user_name'])) {
$err[] = "ERROR - Invalid user name. It can contain alphabet, number and underscore.";
//header("Location: register.php?msg=$err");
//exit();
// Validate Email
if(!isEmail($data['usr_email'])) {
$err[] = "ERROR - Invalid email address.";
//header("Location: register.php?msg=$err");
//exit();
// Check User Passwords
if (!checkPwd($data['pwd'],$data['pwd2'])) {
$err[] = "ERROR - Invalid Password or mismatch. Enter 5 chars or more";
//header("Location: register.php?msg=$err");
//exit();
$user_ip = $_SERVER['REMOTE_ADDR'];
// stores sha1 of password
$sha1pass = PwdHash($data['pwd']);
// Automatically collects the hostname or domain like example.com)
$host = $_SERVER['HTTP_HOST'];
$host_upper = strtoupper($host);
$path = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
// Generates activation code simple 4 digit number
$activ_code = rand(1000,9999);
$usr_email = $data['usr_email'];
$user_name = $data['user_name'];
$rs_duplicate = mysql_query("select count(*) as total from users where user_email='$usr_email' OR user_name='$user_name'") or die(mysql_error());
list($total) = mysql_fetch_row($rs_duplicate);
if ($total > 0)
$err[] = "ERROR - The username/email already exists. Please try again with different username and email.";
if(empty($err)) {
$sql_insert = "INSERT into `users`
(`full_name`,`user_email`,`pwd`,`address`,`tel`,`fax`,`website`,`date`,`users_ip`,`activa tion_code`,`country`,`user_name`
VALUES
('$data[full_name]','$usr_email','$sha1pass','$data[address]','$data[tel]','$data[fax]',' $data[web]'
,now(),'$user_ip','$activ_code','$data[country]','$user_name'
mysql_query($sql_insert,$link) or die("Insertion Failed:" . mysql_error());
$user_id = mysql_insert_id($link);
$md5_id = md5($user_id);
mysql_query("update users set md5_id='$md5_id' where id='$user_id'");
// echo "<h3>Thank You</h3> We received your submission.";
if($user_registration) {
$a_link = "
*****ACTIVATION LINK*****\n
http://$host$path/activate.php?user=$md5_id&activ_code=$activ_code
} else {
$a_link =
"Your account is *PENDING APPROVAL* and will be soon activated the administrator.
$message =
"Hello \n
Thank you for registering with us. Here are your login details...\n
User ID: $user_name
Email: $usr_email \n
Passwd: $data[pwd] \n
$a_link
Thank You
Administrator
$host_upper
THIS IS AN AUTOMATED RESPONSE.
***DO NOT RESPOND TO THIS EMAIL****
mail($usr_email, "Login Details", $message,
"From: \"Member Registration\" <auto-reply@$host>\r\n" .
"X-Mailer: PHP/" . phpversion());
header("Location: thankyou.php");
exit();
?> -
Help! Need help with preflight package script
I am trying to write a package with Iceberg to push Office 2004 to 250 Macs. I need a preflight script with a condition that will stop my script if /Applications/Microsoft Office 2004 exists OR if OFFICE 2004 exists. Don't know if searching on the folder name is the best or if there is better way
If it doesn't exist I want it to continue with with placing Office 2004 in the /Applications folder.
I don't know how to do conditions (If, then, end)
PREFLIGHT SCRIPT
IF /Applications/Microsoft Office 2004 folder exist = STOP
IF /Applications/Microsoft Office 2004 folder doesn't exist continue with laying down files/folder in the package.
LAYDOWN FILES
LAY DOWN FILES IN ICEBERG FILE SECTION OF THE PACKAGE
POSTFLIGHT SCRIPT
#!/bin/sh
#Change to root directory
cd /
# Move Microsoft Office X folder to Messages Received folder
mv /Applications/Microsoft\ Office\ X /Messages\ Received
#Open Office 2004 Installer
open /Applications/Utilities/Installers/Office2004Installer
ALL Mac OS X (10.4.6)
ALL Mac OS X (10.4.6)
ALL Mac OS X (10.4.6)A simple condition (not using iceberg) would be:
#!/bin/sh
if [ -e "/Applications/Microsoft Office 2004.app" ]
then
echo "Microsoft Office 2004 exists, aborting installation"
exit 1
fi
open -a "/Applications/Utilities/Installers/Office2004Installer"
If Microsoft Office 2004 is installed then the script will exit with a message. If Microsoft Office 2004 is not there then the last line will be executed and the installer will open.
PowerBook G4 Mac OS X (10.4.8) MacBook Pro -
Need help with turingtest2's scripts
Hello,
I moved my files from C:/Users/Pat/My Music to S:/Users/Pat/My Music
I do not use iTunes to manage my files, so they are organized in my own way. I would like to keep that structure and point iTunes to the new drive without reorganizing the files into different folder structures.
I have come across turingtest2's scripts and I was planning to use ConsolidateByMoving, except that it is trying to use different folder names based on information stored in iTunes. See below:
Notice how the band name is being processed as 'Frost_' instead of 'Frost'
This is happening for most of my tracks and it will not import them the same way they were stored on my C:/.
I would like to copy them over exactly how they are stored and update iTunes at the same time.
I know I could simply do a 'replace all' on my iTunes Library.xml changing C:/Users/Pat to S:/Users/Pat, and then corrupt the .itl file, but I would like to preserve the metadata.
Any recommendations on how I might achieve this would be greatly appreciated. Perhaps I can alter a script?
Thanks!!Hi there. tt2 here at your service.
There are three approaches I can think of immediately.
One would be that I write a variation of my ConsolidateByMoving script that does a search and replace operation on part of the current path to come up with the new target path, instead of calculating the whole path from the tag properties. I already have two variants, one that generates file & folder names over 40 characters and uses different character substitutions, and another that imposes my own personal structure. I use the main iTunes\iTunes Media\<Media Kind> structure and then have my own rules for the finer detail. Adding a tweak like this should be fairly easy.
A second idea would be for you to move things where you want to and then use the FindTracks script to repair the brroken links. It is pretty good at locating files in non-standard layouts, but there is still a chance that you've arranged things in a way which it doesn't yet cope with.
The third option, which I consider superior in the long run, can be seen in my post make a split library portable. If I've understood correctly your iTunes media folder is effectively C:/Users/Pat/My Music while the library folder is inside it as C:/Users/Pat/My Music/iTunes. If you have it the other way around, with the media folder inside the iTunes library folder (neither of which have to be called iTunes or iTunes Media) then the library can be moved as a unit whatever the arrangement of tracks within the media folder and it won't break. It also becomes much easier to backup.
A fourth option would be to explain how to tweak the script so it contains your rules...
What might be best is to copy your current iTunes folder to S:\ as S:\iTunes and shift-start iTunes to connect to the library file S:\iTunes\iTunes Library.itl then go with the first option (when it is ready) such that it replaces C:\Users\Pat\My Music with S:\iTunes\iTunes Media\Music.
There will also be a need to consider what, if any, media or apps already exist within the iTunes folder and the current setting of the media folder in preferences.
What are your thoughts?
tt2 -
Need help with simple python script (renaming and moving folder)
I have this script for use with sabnzbd, what it does is rename all folders in the desired directory, replacing any spaces with dots (example: Movie 2011 HD -> Movie.2011.HD).
#!/usr/bin/env python2
workdir = '/media/stuff/movies' #### CHANGE this line to your movie directory
for path, dirnames, filenames in os.walk(workdir):
print "path:", path
for dirname in dirnames:
if dirname.find(' ') > -1 :
# Yes, a space in the directory name, so replace it:
newname = dirname.replace(' ','.')
fulldirname = path + '/' + dirname
fullnewname = path + '/' + newname
print "Rename" , fulldirname, " ", fullnewname
os.rename(fulldirname, fullnewname)
What I would like it to do is 1. rename only the movie I run the script on (instead of /media/stuff/movies as above, the entire movie folder), and then 2. move the movie into /media/stuff/movies. Or vice versa! (I'd just prefer not to have it run on the entire movie directory).
Appreciate any help!Just my two cents:
I would not use walkdir but as usual a combination of find and python.
A simplified version of the script could look like this:
#!/usr/bin/python
# -*- coding: utf8 -*-
import os, shutil
# Define target dir
target_dir = "/media/stuff/movies/"
# Loop through all found files
for source_file in os.popen ("find ."):
# Remove \n
source_file = source_file[:-1]
extension = source_file[-3:]
# Only process video files
if (extension == 'mkv') or (extension == 'avi') or (extension == 'mp4'):
target_file = source_file.split('/')
target = target_file[len(target_file)-1]
target = target.replace(' ','.')
shutil.copy (source_file, targetdir + target)
Of course you might first want to print out instead of really copy files. -
Need help with image push script please
I am playing around with some javascript for the push / pull image used on webcam sites. When i run one, it never refreshes the image in my browser when I change the image. It only does if I delete the image and then repost it. It seems my browser looks for the cache or something first. How can I make ANY browser force to load the image without deleting it first?
Here is the script I am using:
<SCRIPT>
<!-- ===================
browserType = navigator.appName;
newImage = new Image();
Srvr_IP= "http://127.0.0.1/myFile.jpg?";
var dly;
if (browserType == "Netscape") document.write('<IMG SRC="'+ Srvr_IP +'"
') else document.write('<IMG SRC="' + Srvr_IP +'" name=ZahidiTV2Web
Alt="Web Server is off. Please try later." border=1 >');
uniq= 1;
newImage.src= Srvr_IP + uniq;
SnapShot_Loop(4000);
function SnapShot_Loop(delay)
dly= delay
if( document.all) loadNewImage();
setTimeout("SnapShot_Loop(dly)",delay);
function loadNewImage()
Stamp = new Date();
uniq= Stamp.getTime();
document.images.ZahidiTV2Web.src= newImage.src;
newImage.src= Srvr_IP + uniq;
window.status = "Displaying live video ...";
</SCRIPT>
<P>
HelloThese forums are for Java, not JavaScript.
-
Need Help with running expect script on MAC OS
Hi Guys,
I'm having an issue with running an expect script on my Mac Mini with Mac OS x 10.7.5. I think the script is correct but the not sure why its not working.
The script is as below and also teh error from Xtern or terminal when i try to run it.
#!/usr/bin/expect
set telnetAddr "172.22.22.254"
set telnetAddr1 "172.22.22.252"
set username "ww"
set passwords "ww"
set enablepassword "ww"
spawn telnet $telnetAddr
expect "Username: "
send "username\r"
expect "Password: "
send "$passwords\r"
expect "Orange-ISRGW>"
send "enable\r"
expect "Password: "
send "$enablepassword\r"
expect "Orange-ISRGW#"
send "sh flash\r"
expect "Orange-ISRGW#"
send "delete flash:c1140-k9w7-tar.default.JAR\r"
expect "Delete flash:/c1140-k9w7-tar.default.JAR? [confirm]"
send "\r"
expect "Orange-ISRGW#"
send "exit/r"
interact
here is what happens when i try to run it. This is just a test script before i re-write it to do what i intened to use it for.
sh-3.2# ls -al Text-Script.txt
-rwxrwxrwx@ 1 root wheel 592 Dec 6 08:36 Text-Script.txt
sh-3.2# more Text-Script.txt
#/!/usr/bin/expect -f
set telnetAddr "172.22.22.254"
set username "ww"
set passwords "ww"
set enablepassword "ww"
spawn telnet $telnetAddr
expect "Username: "
send "username\r"
expect "Password: "
send "$passwords\r"
expect "Orange-ISRGW>"
send "enable\r"
expect "Password: "
send "$enablepassword\r"
expect "Orange-ISRGW#"
send "term length 0\r"
expect "Orange-ISRGW#"
send "sh flash\r"
expect "Orange-ISRGW#"
send "delete flash:c1140-k9w7-tar.default.JAR\r"
expect "Delete flash:/c1140-k9w7-tar.default.JAR? [confirm]"
send "\r"
expect "Orange-ISRGW#"
send "exit/r"
sh-3.2#
sh-3.2# pwd
/usr/bin
sh-3.2# Text-Script.txt
/usr/bin/Text-Script.txt: line 8: spawn: command not found
couldn't read file "Username: ": no such file or directory
/usr/bin/Text-Script.txt: line 10: send: command not found
": no such file or directory:
/usr/bin/Text-Script.txt: line 12: send: command not found
": no such file or directorySRGW>
/usr/bin/Text-Script.txt: line 14: send: command not found
couldn't read file "Password: ": no such file or directory
/usr/bin/Text-Script.txt: line 16: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 18: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 20: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 22: send: command not found
": no such file or directorylash:/c1140-k9w7-tar.default.JAR? [confirm]
/usr/bin/Text-Script.txt: line 24: send: command not found
": no such file or directorySRGW#
/usr/bin/Text-Script.txt: line 26: send: command not found
sh-3.2#
sh-3.2#
sh-3.2# ./Text-Script.txt
./Text-Script.txt: line 8: spawn: command not found
couldn't read file "Username: ": no such file or directory
./Text-Script.txt: line 10: send: command not found
": no such file or directory:
./Text-Script.txt: line 12: send: command not found
": no such file or directorySRGW>
./Text-Script.txt: line 14: send: command not found
couldn't read file "Password: ": no such file or directory
./Text-Script.txt: line 16: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 18: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 20: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 22: send: command not found
": no such file or directorylash:/c1140-k9w7-tar.default.JAR? [confirm]
./Text-Script.txt: line 24: send: command not found
": no such file or directorySRGW#
./Text-Script.txt: line 26: send: command not found
sh-3.2#Works like a Charm after making the change suggested ..
macminiserver:ExpectScript Tola$ more Text-Script.txt
#! /usr/bin/expect -f
set telnetAddr "172.22.22.254"
set username "ww"
set passwords "ww"
set enablepassword "ww"
spawn telnet $telnetAddr
expect "Username: "
send "$username\r"
expect "Password: "
send "$passwords\r"
expect "Orange-ISRGW>"
send "enable\r"
expect "Password: "
send "$enablepassword\r"
expect "Orange-ISRGW#"
send "term length 0\r"
expect "Orange-ISRGW#"
send "sh flash\r"
expect "Orange-ISRGW#"
send "delete flash:c1140-k9w7-tar.default.JAR\r"
send "\r"
expect "Orange-ISRGW#"
send "sh flash\r"
interact
macminiserver:ExpectScript Tola$ ./Text-Script.txt
spawn telnet 172.22.22.254
Trying 172.22.22.254...
Connected to 172.22.22.254.
Escape character is '^]'.
User Access Verification
Username: ww
Password:
Orange-ISRGW>enable
Password:
Orange-ISRGW#term length 0
Orange-ISRGW#sh flash
-#- --length-- -----date/time------ path
2 1440 Oct 24 2013 11:23:26 -07:00 vlan.dat
3 63714548 May 3 2010 11:49:40 -07:00 c2800nm-adventerprisek9_ivs_li-mz.151-1.T.bin
5 67871024 Nov 9 2012 19:05:24 -08:00 c2800nm-adventerprisek9-mz.151-4.M5.bin
124751872 bytes available (131600384 bytes used)
Orange-ISRGW#delete flash:c1140-k9w7-tar.default.JAR
Delete flash:/c1140-k9w7-tar.default.JAR? [confirm]
%Error deleting flash:/c1140-k9w7-tar.default.JAR (File not found)
Orange-ISRGW#sh flash
-#- --length-- -----date/time------ path
2 1440 Oct 24 2013 11:23:26 -07:00 vlan.dat
3 63714548 May 3 2010 11:49:40 -07:00 c2800nm-adventerprisek9_ivs_li-mz.151-1.T.bin
5 67871024 Nov 9 2012 19:05:24 -08:00 c2800nm-adventerprisek9-mz.151-4.M5.bin
124751872 bytes available (131600384 bytes used)
Orange-ISRGW# -
[SOLVED] Need help with simple a script.
Hello, Iam searching for a small script that sorts my folders in alphabetical order.
I want the script to create folder from A to Z and then move every folder that begins with A into the A folder etc etc..
I really hope anyone understands what im searching for here.
Last edited by nikihr (2009-09-01 20:25:33)scragar wrote:
brisbin33 wrote:
be careful, mv $I* will pick up your freshly created directory too;
i'd `mkdir ./sorted/$I` instead, then `mv ./sorted/* ./ && rm -r ./sorted` at the end.
you could also use
find ./ -maxdepth 1 -iname "$I*" -exec mv {} ./sorted/ \;
to do the actual move*
*note: untested .
While my `mv` code will throw an error the error will not stop the moving of the files, you'll just get 26 messages about being unable to move the directory to itself. I could probably find a way to avoid this that doesn't require the use of find(which I personally dislike) or a second dir, probably just using a file prefix like "_" or something. It would only be a small edit:
#!/bin/bash
for I in {a..z}; do
echo "Moving $I";
mkdir "_$I";
echo "mv $I* \"$(echo $I | tr [:lower:] [:upper:])\"* _$I/";
# mv $I* "$(echo $I | tr [:lower:] [:upper:])"* "_$I/";
mv "_$I" $I
done
well, i have to politely disagree: one, invoking find once is much better IMHO than mv with tr in a subshell. and two, my ./sorted/ idea adds one additional mv command and one additional rm command where you're _$I suggestion added 26 additional mv commands.... just sayin'
but we could also paint the bikeshed blue. .
anyways, i think the OP's got more than he bargained for, hopefully we'll see a [SOLVED] on this one soon. -
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) -
Need help with Java Script to perform a calculation in Adobe Acrobat Pro 9 form
I have a form (test) that I am creating in Adobe Acrobat Pro 9.
I need help creating custom Java Script so I can get the desired answer.
1) There are several questions in each group that require a numerical answer between 0-4
2) There is a total field set up to sum the answers from all above questions
3) The final "score" takes the answer from Step 2 above and divides by the total possible answer
Any help on what Java Script I need to complete this would be greatly appreciated!
I've attached a "spreadsheet" that shows it in more detail as well as what formulas I used in Excel to get the desired end result.
Thanks in advance.Have you tried the "The field is the average of:"?
-
Need Assistance With Custom Calculation Script
I need help with a custom calculation script in Acrobat Pro. I am trying to add the sum of fields A, B, C, D, E, F, and G together with the lesser value of fields H and I. What would be the script to enter for this result? Thank you.
event.value = Number(this.getField("A").value) + Number(this.getField("B").value) + Number(this.getField("C").value) + Number(this.getField("D").value) + Number(this.getField("E").value) + Number(this.getField("F").value) + Number(this.getField("G").value) + Math.min(Number(this.getField("H").value), Number(this.getField("I").value));
Maybe you are looking for
-
Su doesn't work anymore but sudo works
Hi all, I normally use my standard user account but when I'm installing with macports I routinely "su" into root to do things. Today I went on my machine and noticed that "su" wouldn't work. Before anyone decides to tell me that I don't need to use "
-
I have used my Apple Classic Ipod for music and photo storeage/playback. When prompted to download a new versionof Itunes (11.1.0) I did so but cannot now locate any facility for removing/adding photos. Is this a deliberate action on the part of the
-
Dear All, I have a question u2013 is it possible to post down payment without VAT posting? Currently our Vendor/Customer down payments produce VAT postings and when are cleared with final invoice. But according local requirements VAT posting must be
-
HT204022 photo stream album empty - photo stream in settings using 29.1 MB
How to delete?
-
Iweb said it published but cant see website in my browser
I created a Iweb page and I have a domain name. I am using ftp server, after imputing all my info it said I was successful in publishing my website. However when I type my domain name in my browser nothing comes up. It only says website is under cons