Creating Basic Calculator Script - Needs help
I'd like to create a basic calculator script that makes doing calculations a bit easier from the command line. Normally i do:
echo "32*24" | bc
So I built a bash script that I can just type "calc 32*24":
bc << EOF
scale=4
$@
quit
EOF
And it works ok until i try to use parenthesis:
calc (1+49)/5
bash: syntax error near unexpected token `1+49'
if I use parenthesis, directly in the bc command it does ok:
bc
bc 1.06...
(1+49)/5
10
I've tried putting $@ in quotes but not luck. Looks like bash isn't transferring the parenthesis. How can I get the bash script to pass theparenthesis?
Dusty wrote:This is why I always have at least one terminal in an IPython session.
+1!
I normally use a standard python instance in the same way but have just installed ipython and am having a look at it now. Looks cool!
Similar Messages
-
Premiere Pro CC updated - crashes almost immediately on my mac OS X Yosemite 10.10.3. Crashes at startup, crashes with media import, crashes when creating a sequence. NEED HELP FAST> I have tried many troubleshooting solutions I found online nothing has worked.
Hi,
Sorry to hear about the experience. Please provide your computer configuration details.
Memory, Processor, Graphics card, Exact version of Premiere Pro, Error message that you are get. If you can post screenshots of the error report that would be helpful.
Thanks,
Rameez -
Indesign CS5.5 Relink Script needs help
Hi, I'm trying to relink images in an InDesign CS5.5 file to a different server using a script. This is what I have so far, but when I run the script I get errors and can't relink because "Either the file does not exist, you do not have permission, or the file may be in use by another application". Does anyone know how to make this script work? I'm fairly new to scripting.
Here is the script I have:
tell application "Adobe InDesign CS5.5"
tell document 1
set linkList to links
set errInfo to "" -- We'll display error if we can't relink an item
repeat with x in linkList
if (x's status) is not normal then -- I usually check for any link that has an error
-- This should only return an AppleScript path with ":" separators
set linkPath to (x's file path) as string
if "Volumes/Calendars_2013 FPO" is in linkPath then
set AppleScript's text item delimiters to "Volumes/Calendars_2013 FPO"
set linkPath to (linkPath's text items) -- Create a list of text items
set AppleScript's text item delimiters to "Volumes/Calendars_2013"
set linkPath to (linkPath as string) -- Concatenate with new path
set AppleScript's text item delimiters to "" -- Reset TIDs
try
-- Need to make our string (path) into an alias path
relink x to alias linkPath
try
update x -- This can be helpful
end try
on error err
-- We'll store link name if error occurs
set errInfo to (errInfo & return & x's name)
end try
end if
end if
end repeat
-- If an error occurs while trying to relink, we'll display it
if (count errInfo) > 0 then display dialog ("Can't relink:" & errInfo)
end tell
end tell
--HectorI just tried adding collens to the end of the folder path. For some reason the script skipped the relink line. Below is the code with your update. I'm thinking its not finding the images because the script needs to make a list of all the images and choose the one that matches the missing image.
tell application "Adobe InDesign CS5.5"
tell document 1
set linkList to links
set errInfo to "" -- We'll display error if we can't relink an item
repeat with x in linkList
if (x's status) is not normal then -- I usually check for any link that has an error
-- This should only return an AppleScript path with ":" separators
set linkPath to (x's file path) as string
if "Calendars_2013 FPO:" is in linkPath then
set AppleScript's text item delimiters to "Calendars_2013 FPO:"
set linkPath to (linkPath's text items) -- Create a list of text items
set AppleScript's text item delimiters to "Calendars_2013:"
set linkPath to (linkPath as string) -- Concatenate with new path
set AppleScript's text item delimiters to "" -- Reset TIDs
try
-- Need to make our string (path) into an alias path
relink x to alias linkPath
try
update x -- This can be helpful
end try
on error err
-- We'll store link name if error occurs
set errInfo to (errInfo & return & x's name)
end try
end if
end if
end repeat
-- If an error occurs while trying to relink, we'll display it
if (count errInfo) > 0 then display dialog ("Can't relink:" & errInfo)
end tell
end tell
--Thanks for you help -
Optmization of calculation script Please help urgent
hi all,
I know three ways to tackle the block creation issue.
1. Set CreateBlockon equation.
2. try some data copy.
3. calcualte a member via sparse dimension.
I have a calc as shown below:
Set CACHE HIGH;
Set UPDATECALC OFF;
SET AGGMISSG ON;
FIX( @Relative("Entity",0),
@Relative("Business Unit",0)
@Relative("Branch",0),
&CurScenario,
&CurVersion,
&CurYr,
"M00",
"P00000",
"I000"
FIX("AAAA")
"DH" = "Gross Sales"->"External sales"->"MEU" * "Freight Out Percent"->"U000"->"D00000"->"B000"->"00";
ENDFIX
ENDFIX
This is the third method that i mentioned above i am trying to apply to this calc that is calcualtion it via sparse dimesion as first 2 are not working good.
"AAAAA" is dense dimesion member in accounts and rest every member is sparse.
The member gross sales, External sales and MEU are all dynamic calc.
This Calc run for 45 mins just to calculate one account and i have 4 accounts that need to be calculated by this in the same manner and i am trying to optimize this script so that i can reduce its run time.
However i made another copy of this script in the following way:
Set CACHE HIGH;
Set UPDATECALC OFF;
SET AGGMISSG ON;
FIX( @Relative("Entity",0),
@Relative("Business Unit",0)
@Relative("Branch",0),
&CurScenario,
&CurVersion,
&CurYr,
"M00",
"P00000",
"I000"
"DH"
IF (@ISMBR("AAAAA"))
@CALCMODE(BLOCK);
@CALCMODE (Bottomup);
"DH"= @Round((("Gross Sales"->"External Sales"->"MEU") * ("Freight In Percent"->"U000"->"D00000"->"B000"->"00")),2);
ElSEIF (@ISMBR("BBBBB"))
@CALCMODE(BLOCK);
@CALCMODE (Bottomup);
"DH"= @Round((("Gross Sales"->"External Sales"->"MEU") * ("Freight Out Percent"->"U000"->"D00000"->"B000"->"00")),2);
ENDIF
ENDFIX
In th above version of the script it runs very fast but dont calculate any value :( for the account "AAAAA" & "BBBB"
I have tried almost every way to do this and running short of ideas to optmize this.
Is there any other way in which i can tackle the block creation issue or a way in which i can bring down the run time of this calculation
Any suggestion regarding this would be great
Thanks for help!
Edited by: user4958421 on Jun 29, 2009 10:18 AM
Edited by: user4958421 on Jun 29, 2009 10:18 AMFor block creation issue:
SET CREATEBLOCKONEQ equation will only work if the left side of an assignment statement is sparse.
If the left side of an assignment is dense, you need to use SET CREATENONMISSINGBLK ON.
For example:
1.
FIX("DH")
SET CREATENONMISSINGBLK ON;
"AAAAA" = "Gross Sales"->"External sales"->"MEU" * "Freight Out Percent"->"U000"->"D00000"->"B000"->"00";
ENDFIX
With the above, try to fix as little as possible. For example: do you really need to run the above
formula for @Relative("Entity",0),@Relative("Business Unit",0), and @Relative("Branch",0)? Or
actually the above formula is only needed for specific entity, business units and branch.
2.
FIX("AAAA")
SET CREATEBLOCKONEQ ON;
"DH" = "Gross Sales"->"External sales"->"MEU" * "Freight Out Percent"->"U000"->"D00000"->"B000"->"00";
ENDFIX
Another technique you can try:
3.
FIX("AAAA")
"DH" = 0;
"DH" = "Gross Sales"->"External sales"->"MEU" * "Freight Out Percent"->"U000"->"D00000"->"B000"->"00";
ENDFIX
And, you can also consider to change member "AAAA" to dynamic calc, and
put the formula in the member. With this, you will not have calculation performance issue.
If you use a calc like this:
Sales (
IF (@ISMBR(Jan))
Sales=100;
ENDIF)
You do not need to repeat sales, so,
it will be:
Sales (
IF (@ISMBR(Jan))
100;
ENDIF) -
Working on slug script, need help!
Okay, this is not my script, one that I found online. The script works by allowing the user to set placeholders within the document and tag each placeholder with specific information such as DATE, TIME, FILENAME, etc.
The current placeholders that are setup for this script are:
{FILE}
{FILEPATH}
{FILENAME}
{FILEEXT}
{DATE}
{TIME}
I would like to add a few more placeholders, which is where I need some help. I would like to add a placeholder for the username or hostname, meaning computer name. {HOSTNAME}
I would also like to add a placeholder for colors used in the document listed in this format: PANTONE 186C, PANTONE 281C, BLACK, CYAN, MAGENTA, YELLOW, or as color swatches.
Also, is it possible to create a placeholder that will produce an interface allowing user input? Say you wanted a placeholder for Designer, and a dialog popped up asking for input.
Thanks for any help!
Here is the script:
var language="en"; // "de" fuer Deutsch
var WR="WR-DateAndTime v0.9\n\n";
var AIversion=version.slice(0,2);
if (language == "de") {
var format_preset = "{FILENAME}{FILEEXT} ({DATE} - {TIME})";
var MSG_unsetmark = WR+"Dieses Objekt ist als aktuelles Datum/Uhrzeit markiert, soll die Markierung aufgehoben werden?";
var MSG_setmark = WR+"Soll dieses Textobjekt als aktuelles Datum/Uhrzeit markiert werden?";
var MSG_askformat = WR+"Soll das Textobjekt als Datum/Uhrzeit formatiert werden? Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_editformat = WR+"Datums-/Uhrzeitformat bearbeiten (Leer = entfernen). Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_notexto = WR+"Kein Textobjekt!";
var MSG_selectedmany = "Zum Markieren als aktuelles Datum/Uhrzeit darf nur ein Textobjekt ausgew\xE4hlt sein und falls Sie die Daten aktualisieren wollen, darf kein Objekt ausgew\xE4hlt sein.";
var MSG_nodocs = WR+"Kein Dokument ge\xF6ffnet."
var Timeformat = 24;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "dd.mm.yyyy";
} else {
var format_preset = "{FILENAME} ({DATE}, {TIME})";
var MSG_unsetmark = WR+"This object is marked as actual date'n'time, do you want to remove the mark?";
var MSG_setmark = WR+"Do you want to mark the selected textobject as actual date'n'time?";
var MSG_askformat = WR+"Do you want to mark the textobject as actual date'n'time? Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_editformat = WR+"Edit date'n'time (empty = remove). Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_notexto = WR+"No textobject!";
var MSG_selectedmany = "To mark as actual date'n'time, you have to select only one textobject. If you want to update the date'n'time-objects, there must be no object selected.";
var MSG_nodocs = WR+"You have no open document."
var Timeformat = 12;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "mm/dd/yyyy";
var error=0;
if (documents.length<1) {
error++;
alert(MSG_nodocs)
if (error < 1) {
date_n_time();
function TodayDate()
var Today = new Date();
var Day = Today.getDate();
var Month = Today.getMonth() + 1;
var Year = Today.getYear();
var PreMon = ((Month < 10) ? "0" : "");
var PreDay = ((Day < 10) ? "0" : "");
if(Year < 999) Year += 1900;
var theDate = Dateformat.replace(/dd/,PreDay+Day);
theDate = theDate.replace(/mm/,PreMon+Month);
theDate = theDate.replace(/d/,Day);
theDate = theDate.replace(/m/,Month);
theDate = theDate.replace(/yyyy/,Year);
theDate = theDate.replace(/yy/,Year.toString().substr(2,2));
return theDate;
function TodayTime()
var Today = new Date();
var Hours = Today.getHours();
var Minutes = Today.getMinutes();
var Suffix = "";
if (Timeformat == 12) {
if (Hours >= 12 ) {
Suffix = PM;
} else {
Suffix = AM;
if (Hours >= 13) {
Hours = Hours - 12;
if (Hours < 1) {
Hours = Hours + 12;
var PreHour = ((Hours < 10) ? "0" : "");
var PreMin = ((Minutes < 10) ? "0" : "");
return PreHour+Hours+TimeSep+PreMin+Minutes+Suffix;
function DateUpdate(Name) {
var docpath = activeDocument.path.fsName;
var docname = activeDocument.name.replace(/(.*?)(?:\.([^.]+))?$/,'$1');
var extension = activeDocument.name.replace(/(.*?)(?:(\.[^.]+))?$/,'$2');
if (docpath.slice(2,3) == "\\") {
docsep = "\\";
} else {
docsep = ":";
var content = Name.slice(11);
var content = content.replace(/\{FILE\}/,docpath+docsep+docname);
var content = content.replace(/\{FILEPATH\}/,docpath);
var content = content.replace(/\{FILENAME\}/,docname);
var content = content.replace(/\{FILEEXT\}/,extension);
var content = content.replace(/\{DATE\}/,TodayDate());
var content = content.replace(/\{TIME\}/,TodayTime());
return content;
function date_n_time()
if (selection.length == 1) {
if (selection[0].typename == "TextArtItem" || selection[0].typename == "TextFrame") {
if (selection[0].name.slice(0,11) == "actualDate:") {
dateformat = selection[0].name.slice(11);
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_unsetmark );
} else {
dateformat = prompt(MSG_editformat, dateformat);
if(dateformat != "" && Check) {
selection[0].contents = selection[0].name.slice(11);
selection[0].name="";
selection[0].selected = false;
if(dateformat == "" && !Check) {
selection[0].name="";
selection[0].selected = false;
if(dateformat && dateformat !="" && !Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
} else {
dateformat = selection[0].contents;
if(dateformat.search(/\{DATE\}/) == -1 && dateformat.search(/\{TIME\}/) == -1 && dateformat.search(/\{FILE[A-Z]*\}/) == -1) dateformat = format_preset;
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_setmark );
} else {
dateformat = prompt(MSG_askformat, dateformat);
if (dateformat || Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
selection[0].selected = false;
} else {
alert ( MSG_notexto );
} else if (selection.length > 1) {
alert ( MSG_selectedmany );
} else {
if (AIversion == "10") {
var textArtItems = activeDocument.textArtItems;
for (var i = 0 ; i < textArtItems.length; i++)
if (textArtItems[i].name.slice(0,11) == "actualDate:") {
textArtItems[i].selected = true;
textArtItems[i].contents = DateUpdate(textArtItems[i].name);
} else {
var textFrames = activeDocument.textFrames;
for (var i = 0 ; i < textFrames.length; i++)
if (textFrames[i].name.slice(0,11) == "actualDate:") {
textFrames[i].selected = true;
textFrames[i].contents = DateUpdate(textFrames[i].name);Okay, here is the entire script with credit lines.
//////////////////////////////////////////////////////////// english //
// -=> WR-DateAndTime <=-
// A Javascript for Adobe Illustrator
// by Wolfgang Reszel ([email protected])
// Version 0.9 from 22.9.2011
// This script inserts the actual date or the actual time to a
// predefined position in the document.
// To define the position, you'll have to create an textobject and
// execute this script while the object is selected. The whole object
// has to be selected and not words or letters. You can mark more
// objects, if you select each object separate and execute
// the script on it.
// With the placeholders {DATE} and {TIME} you are able to define a
// particular point, where the date or the time should be replaced.
// If there is no placeholder in the textobject
// "{FILENAME}{FILEEXT} ({DATE}, {TIME})" will be used as standard placeholders.
// To update the date and time execute this script without any object
// selected.
// There are some additional placeholders:
// {FILE} - complete document-filename with path
// {FILEPATH} - only the documents filepath
// {FILENAME} - the filename of the document
// {FILEEXT} - the file extension of the document inclusive dot
// On my system this script can't see the path of the document, when
// it was opened directly from windows Explorer (double click).
// In Illustrator CS it is now possible to edit a DateAndTime-Object.
// To enable the english messages and date-format change the "de"
// into "en" in line 90.
// Sorry for my bad english. For any corrections send an email to:
// [email protected]
//////////////////////////////////////////////////////////// Deutsch //
// -=> WR-DateAndTime <=-
// Ein Javascript fuer Adobe Illustrator
// von Wolfgang Reszel ([email protected])
// Version 0.9 vom 30.9.2011
// Dieses Skript fuegt das aktuelle Datum und die aktuelle Uhrzeit an
// eine vorher bestimmte Stelle im Dokument ein.
// Um eine Stelle zu bestimmen, muss man ein Textobjekt erzeugen, es
// markieren und dann dieses Skript aufrufen. Es muss das gesamte Objekt
// ausgewaehlt sein, nicht etwa Buchstaben oder Woerter. Es lassen sich
// nacheinander auch mehrere Objekte als Datum/Uhrzeit markieren.
// Mit den Platzhaltern {DATE} und {TIME} (in geschweiften Klammern)
// kann man bestimmen, wo genau im Text das Datum und die Uhrzeit
// erscheinen soll. Sind die Platzhalter nicht vorhanden, wird
// automatisch "{FILENAME}{FILEEXT} ({DATE} - {TIME})" verwendet.
// Zum Aktualisieren des Datums/Uhrzeit muss man dieses Skript aufrufen
// wenn kein Objekt ausgewaehlt ist.
// Es gibt noch einige zusaetzliche Platzhalter:
// {FILE} - kompletter Dateiname mit Pfad
// {FILEPATH} - nur der Verzeichnispfad des Dokuments
// {FILENAME} - der Dateiname des Dokuments
// {FILEEXT} - die Dateiendung des Dokuments inklusive Punkt
// Auf meinem System kann der Pfad nicht ermittelt werden, wenn das
// Dokument vom Windows Explorer geoeffnet wird (Doppel-Klick).
// InÿIllustrator CSÿkann man nun ein Datum/Uhrzeit-Objekt bearbeiten.
// Um dieses Skript mit deutschen Meldungen und Datumsformat zu
// versehen, muss in Zeile 90 das "en" durch ein "de" ersetzt werden.
// Verbesserungsvorschlaege an: [email protected]
//$.bp();
var language="en"; // "de" fuer Deutsch
var WR="WR-DateAndTime v0.9\n\n";
var AIversion=version.slice(0,2);
if (language == "de") {
var format_preset = "{FILENAME}{FILEEXT} ({DATE} - {TIME})";
var MSG_unsetmark = WR+"Dieses Objekt ist als aktuelles Datum/Uhrzeit markiert, soll die Markierung aufgehoben werden?";
var MSG_setmark = WR+"Soll dieses Textobjekt als aktuelles Datum/Uhrzeit markiert werden?";
var MSG_askformat = WR+"Soll das Textobjekt als Datum/Uhrzeit formatiert werden? Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_editformat = WR+"Datums-/Uhrzeitformat bearbeiten (Leer = entfernen). Formate:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} und {FILEEXT}:"
var MSG_notexto = WR+"Kein Textobjekt!";
var MSG_selectedmany = "Zum Markieren als aktuelles Datum/Uhrzeit darf nur ein Textobjekt ausgew\xE4hlt sein und falls Sie die Daten aktualisieren wollen, darf kein Objekt ausgew\xE4hlt sein.";
var MSG_nodocs = WR+"Kein Dokument ge\xF6ffnet."
var Timeformat = 24;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "dd.mm.yyyy";
} else {
var format_preset = "{FILENAME} ({DATE}, {TIME})";
var MSG_unsetmark = WR+"This object is marked as actual date'n'time, do you want to remove the mark?";
var MSG_setmark = WR+"Do you want to mark the selected textobject as actual date'n'time?";
var MSG_askformat = WR+"Do you want to mark the textobject as actual date'n'time? Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_editformat = WR+"Edit date'n'time (empty = remove). Formats:\n{DATE}, {TIME}, {FILE}, {FILEPATH}, {FILENAME} and {FILEEXT}:"
var MSG_notexto = WR+"No textobject!";
var MSG_selectedmany = "To mark as actual date'n'time, you have to select only one textobject. If you want to update the date'n'time-objects, there must be no object selected.";
var MSG_nodocs = WR+"You have no open document."
var Timeformat = 12;
var TimeSep = ":";
var AM = " am";
var PM = " pm";
var Dateformat = "mm/dd/yyyy";
var error=0;
if (documents.length<1) {
error++;
alert(MSG_nodocs)
if (error < 1) {
date_n_time();
function TodayDate()
var Today = new Date();
var Day = Today.getDate();
var Month = Today.getMonth() + 1;
var Year = Today.getYear();
var PreMon = ((Month < 10) ? "0" : "");
var PreDay = ((Day < 10) ? "0" : "");
if(Year < 999) Year += 1900;
var theDate = Dateformat.replace(/dd/,PreDay+Day);
theDate = theDate.replace(/mm/,PreMon+Month);
theDate = theDate.replace(/d/,Day);
theDate = theDate.replace(/m/,Month);
theDate = theDate.replace(/yyyy/,Year);
theDate = theDate.replace(/yy/,Year.toString().substr(2,2));
return theDate;
function TodayTime()
var Today = new Date();
var Hours = Today.getHours();
var Minutes = Today.getMinutes();
var Suffix = "";
if (Timeformat == 12) {
if (Hours >= 12 ) {
Suffix = PM;
} else {
Suffix = AM;
if (Hours >= 13) {
Hours = Hours - 12;
if (Hours < 1) {
Hours = Hours + 12;
var PreHour = ((Hours < 10) ? "0" : "");
var PreMin = ((Minutes < 10) ? "0" : "");
return PreHour+Hours+TimeSep+PreMin+Minutes+Suffix;
function DateUpdate(Name) {
var docpath = activeDocument.path.fsName;
var docname = activeDocument.name.replace(/(.*?)(?:\.([^.]+))?$/,'$1');
var extension = activeDocument.name.replace(/(.*?)(?:(\.[^.]+))?$/,'$2');
if (docpath.slice(2,3) == "\\") {
docsep = "\\";
} else {
docsep = ":";
var content = Name.slice(11);
var content = content.replace(/\{FILE\}/,docpath+docsep+docname);
var content = content.replace(/\{FILEPATH\}/,docpath);
var content = content.replace(/\{FILENAME\}/,docname);
var content = content.replace(/\{FILEEXT\}/,extension);
var content = content.replace(/\{DATE\}/,TodayDate());
var content = content.replace(/\{TIME\}/,TodayTime());
return content;
function date_n_time()
if (selection.length == 1) {
if (selection[0].typename == "TextArtItem" || selection[0].typename == "TextFrame") {
if (selection[0].name.slice(0,11) == "actualDate:") {
dateformat = selection[0].name.slice(11);
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_unsetmark );
} else {
dateformat = prompt(MSG_editformat, dateformat);
if(dateformat != "" && Check) {
selection[0].contents = selection[0].name.slice(11);
selection[0].name="";
selection[0].selected = false;
if(dateformat == "" && !Check) {
selection[0].name="";
selection[0].selected = false;
if(dateformat && dateformat !="" && !Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
} else {
dateformat = selection[0].contents;
if(dateformat.search(/\{DATE\}/) == -1 && dateformat.search(/\{TIME\}/) == -1 && dateformat.search(/\{FILE[A-Z]*\}/) == -1) dateformat = format_preset;
Check = false;
if (AIversion == "10") {
Check = confirm( MSG_setmark );
} else {
dateformat = prompt(MSG_askformat, dateformat);
if (dateformat || Check) {
selection[0].name="actualDate:"+dateformat;
selection[0].contents = DateUpdate(selection[0].name);
selection[0].selected = false;
} else {
alert ( MSG_notexto );
} else if (selection.length > 1) {
alert ( MSG_selectedmany );
} else {
if (AIversion == "10") {
var textArtItems = activeDocument.textArtItems;
for (var i = 0 ; i < textArtItems.length; i++)
if (textArtItems[i].name.slice(0,11) == "actualDate:") {
textArtItems[i].selected = true;
textArtItems[i].contents = DateUpdate(textArtItems[i].name);
} else {
var textFrames = activeDocument.textFrames;
for (var i = 0 ; i < textFrames.length; i++)
if (textFrames[i].name.slice(0,11) == "actualDate:") {
textFrames[i].selected = true;
textFrames[i].contents = DateUpdate(textFrames[i].name); -
Hi, I could use some help creating a CBT in flash - I would
like to have different links and use a controller (template built)
to create an easy way to navigate from page to page. Thing is, I
don't know where to start!! I used one of the templates that are
pre-built in flash as a starting point. I have modified the look to
the way I want - now...I don't know where to go from there - do I
need to use different scenes to display my information? what is the
best way to go about this. Any suggestions?Hi Debi,
Fireworks was designed for web graphics, not for print graphics. You'll save yourself a lot of trouble by designing material for print in Adobe Illustrator. If you don't currently have a copy of Illustrator, download the trial version and rebuild your postcard in it. -
OMB Script: Need help to spot what's wrong
I have been trying to find out why the outer foreach loop in the following OMB script (log follows) doesn't go to the next iteration. It just exits after getting the lineage for the first target table (i.e., stderr has nothing). Same behavior against different modules. I am too new to Tcl to know what debugging tool is at my disposal. Any help will be appreciated:
set OMBLOG c:/temp/Lineage.tcl.log
# connect to the OWB repository
OMBCONNECT xxx/xxx@xxx:1521:xxx USE REPOSITORY 'OWB_REP_OWN';
# change context to the module
OMBCC 'xxx/xxx/xxx';
set tableList {}
set tableList [OMBLIST TABLES '.*_FINAL']
set i 1
foreach tableName $tableList {
set columnList {}
set columnList [OMBRETRIEVE TABLE '$tableName' GET COLUMNS]
set j 1
foreach columnName $columnList {
OMBLINEAGE DEPENDENCYTYPE 'DATAFLOW' TABLE '$tableName' COLUMN '$columnName';
incr j
incr i
OMBDISCONNECT;
The first few lines on the log are:
OMBLIST TABLES '.*_FINAL'
AE_FINAL CM_FINAL CO_FINAL DA_FINAL DM_FINAL DP_FINAL DS_FINAL DV_FINAL EG_FINAL EX_FINAL IE_FINAL LB_FINAL LS_FINAL MH_FINAL ML_FINAL PC_FINAL PE_FINAL PP_FINAL PR_FINAL QS_FINAL RELREC_FINAL RS_FINAL SC_FINAL SG_FINAL SS_FINAL SUPPAE_FINAL SUPPDS_FINAL SUPPMH_FINAL SUPPPE_FINAL SUPPQUAL_FINAL SU_FINAL VS_FINAL
OMBRETRIEVE TABLE 'AE_FINAL' GET COLUMNS
STUDYID DOMAIN USUBJID AESEQ AEGRPID AEREFID AESPID AETERM AEMODIFY AEDECOD AECAT AESCAT AEOCCUR AEBODSYS AELOC AESEV AESER AEACN AEACNOTH AEREL AERELNST AEPATT AEOUT AESCAN AESCONG AESDISAB AESDTH AESHOSP AESLIFE AESOD AESMIE AECONTRT AETOXGR AESTDTC AEENDTC AESTDY AEENDY AEDUR AEENRF VISITNUM VISIT OCTA_SEQ
OMBLINEAGE DEPENDENCYTYPE 'DATAFLOW' TABLE 'AE_FINAL' COLUMN 'STUDYID'
{{COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID} {MAPPING /xxx/xxx_C0402_DEV/AE_FINAL_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_FINAL/STUDYID}} {{ATTRIBUTE /xxx/AE_AE_PM/PROT} {MAPPING /xxx/xxx_C0402_DEV/AE_INTERIM_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID}} {{COLUMN /xxx/xxx_C0402_DEV/AE_SOURCE/PROT} {MAPPING /xxx/xxx_C0402_DEV/AE_INTERIM_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID}} {{ATTRIBUTE /xxx/AE_AE_PM/PROT} {MAPPING /xxx/xxx_C0402_DEV/AE_INTERIM_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID}} {{COLUMN /xxx/xxx_C0402_DEV/AE_SOURCE/PROT} {MAPPING /xxx/xxx_C0402_DEV/AE_INTERIM_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID}} {{ATTRIBUTE /xxx/AE_AE_PM/PROT} {MAPPING /xxx/xxx_C0402_DEV/AE_INTERIM_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID}} {{COLUMN /xxx/xxx_C0402_DEV/AE_SOURCE/PROT} {MAPPING /xxx/xxx_C0402_DEV/AE_INTERIM_MAP} {COLUMN /xxx/xxx_C0402_DEV/AE_AE_INTERIM/STUDYID}} {{COLUMN /xxx/xxx_DEV/AE_SOURCE/PROT} {MAPPING /xxx/xxx_DEV/AE_INTERIM_MAP} {ATTRIBUTE /xxx/AE_AE_PM/PROT}}I haven't looked in too much detail, but I think you are missing some brackets. You need to close brackets before you increment the loop. Try:
foreach columnName $columnList {
OMBLINEAGE DEPENDENCYTYPE 'DATAFLOW' TABLE '$tableName' COLUMN '$columnName';}
incr j
You will need to do the same thing at the other points in your script. -
Hi Everyone,
I'm trying to get a simple task scheduler script to work for me and can't get the command I need passed to the scheduler to evaluate properly.
Here's the script:
###Create a new task running $Command and execute it Daily at 6am.
$TaskName = Read-Host 'What would you like this job to be named?'
$Proto = Read-Host 'What is the protocol? (FTP/FTPS/SFTP)'
$User = Read-Host 'What is the user name?'
$Pwd = Read-Host 'What is the password?'
$Server = Read-Host 'What is the server address?'
$NetworkDir = Read-Host 'Please input the network location of the file(s) you wish to send. Refer to documentation for more details.'
$RemoteDir = Read-Host 'Please input the REMOTE directory to which you will upload your files. If there is none please input a slash'
$Command = 'winscp.com /command "option batch abort" "option confirm off" "open $Proto://$User:$Pwd@$Server" "put $NetworkDir $RemoteDir" "exit"'
$TaskAction = New-ScheduledTaskAction -Execute "$Command"
$TaskTrigger = New-ScheduledTaskTrigger -Daily -At 6am
Register-ScheduledTask -Action $TaskAction -Trigger $Tasktrigger -TaskName "$TaskName" -User "Administrator" -RunLevel Highest
Write-Host "$TaskName created to run Daily at $TaskStartTime"
What's messing up is the $Command creation, the command needs to have the quotes around "option blah blah", but if I wrap the whole line in single quotes the variables that are evaluated for the "open blah blah" strings (which also need
to be inside quotes) and the "put blah blah" string are not being evaluated properly.
I've dorked about with different bracketing and quoting but can't nail the syntax down, could someone point me in the right direction? My Google-fu seems to be lacking when it comes to nailing down this issue.
ThanksHmmn, closer. I'm getting this error now:
+ $Command = $tmpl -f $User, $Pwd, $Server, $NetworkDir, $RemoteDir
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (winscp.com /com...t {4} {5}" exit:String) [], RuntimeException
+ FullyQualifiedErrorId : FormatError
And the command being added to the new task looks like this:
winscp.com /command "option batch abort" "option confirm off" "open ($Proto)://($User):($Pwd)@($Server)" "put $NetworkDir $RemoteDir" "exit"
Here's the current state of the script. I get what you're doing to try to bypass the quotes issue, using an array. I'm just not awesome at this yet sooooooo...
$TaskName = Read-Host 'What would you like this job to be named?'
$Proto = Read-Host 'What is the protocol? (FTP/FTPS/SFTP)'
$User = Read-Host 'What is the user name?'
$Pwd = Read-Host 'What is the password?'
$Server = Read-Host 'What is the server address?'
$NetworkDir = Read-Host 'Please input the network location of the file(s) you wish to send. Refer to documentation for more details.'
$RemoteDir = Read-Host 'Please input the REMOTE directory to which you will upload your files. If there is none please input a slash'
$tmpl = 'winscp.com /command "option batch abort" "option confirm off" "open {0}://{1}:{2}@{3}" "put {4} {5}" exit'
$Command = $tmpl -f $User, $Pwd, $Server, $NetworkDir, $RemoteDir
$TaskAction = New-ScheduledTaskAction -Execute $Command
$TaskTrigger = New-ScheduledTaskTrigger -Daily -At 6am
Register-ScheduledTask -Action $TaskAction -Trigger $Tasktrigger -TaskName "$TaskName" -User "Administrator" -RunLevel Highest
Write-Host "$TaskName created to run Daily at $TaskStartTime" -
Create a back button - need help
Hello JHS Team,
I am using JHeadStart 10.1.2.
I need to create a back button in a specific UIX page on my application.
I'm new to JHeadstart and I really need some help from you. Can anyone help me???
ThanksAtena,
You can add the button to your page post-generation, using the UIX Visual editor. Make sure you uncheck the Generate Pages switch for this group in your application structure file to protect your change upon regeneration.
May be an unsollicited advice:
I understand that you are new to ADF, JDeveloper and UIX. UIX is superseded by ADF Faces in JDeveloper 10.1.3, and based on the JSF standard.
UIX will not be further developed, JSF and ADF Faces are the technologies to use going forward. Therefore, I would recommend to consider to switch for your application development to JDeveloper and JHeadstart 10.1.3. For JDeveloper/ADF 10.1.3, there is an excellent developers guide available, that provides a lot of useful information, in particular when you are new to the ADF Framework.
Note that a JHeadstart 10.1.2 UIX generated application can easily be migrated to 10.1.3, you will only need to redo your post-generayion changes. So may be you can try to stick (close) to 100% generation for now, and migrate to 10.1.3 at your earliest convenience.
Steven Davelaar,
JHeadstart Team. -
Simple hide a layer script need help
Hi,
This will be an easy one for someone. I’m new to scripting so please be patient. All I need to do is have a script that hide a layer named "L2_NonTranslatedParts". I have tried to piece together some code but I have failed. Can anyone help? I'm also not sure why we are defineing "watermark" as a var. It was in the code I cut up.
var myDoc = app.documents.item(0);
var L2_NonTranslatedParts = "Watermark";
try{app.activeDocument.layers.item(L2_NonTranslatedParts).visible = false;}
catch(_){alert("Can't find layer: " + L2_NonTranslatedParts);exit();};Yes, that is a good question. Really
app.activeDocument.layers.item("L2_NonTranslatedParts").visible = false;
should be sufficient. -
Creating breakout game. Need help with thread starting.
Howdy. As the title says, I've got an assignment to make a breakout game. So far it's going alright, but I've run into a rather large snag...I can't get it to animate :P I've got my main applet, then I created a class heirarchy for the paddle, ball, and brick objects. For this question, lets just focus on the ball object.
This is my applet code so far (it is not even close to being done, so don't laugh :P )
import java.awt.*;
import javax.swing.*;
import java.util.*;
* Class BreakoutApplet - Plays a simple game of Breakout.
* @author Kris Nelson
* @version November 10, 2004
public class BreakoutApplet extends JApplet implements Runnable
protected Brick brick; // creates an object of class brick
protected Ball ball; // creates an object of class ball
protected Paddle paddle; // creates an object of class paddle
protected boolean running; // tells the program whether or not the thread is running
protected ArrayList brickArray = new ArrayList(); // stores all the bricks in the game
protected Thread timer; // the thread which controls the animation for the applet
* Called by the browser or applet viewer to inform this JApplet that it
* has been loaded into the system. It is always called before the first
* time that the start method is called.
public void init()
// this is a workaround for a security conflict with some browsers
// including some versions of Netscape & Internet Explorer which do
// not allow access to the AWT system event queue which JApplets do
// on startup to check access. May not be necessary with your browser.
JRootPane rootPane = this.getRootPane();
rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
createBricks(); // creates the games array of bricks
ball = new Ball(400, 400, 2, 2); // sets the values for the ball
paddle = new Paddle(300, 660, 2); // sets the values for the paddle
// !!!!!!! have tried placing ball.start() here
* Paint method for applet.
* @param g the Graphics object for this applet
public void paint(Graphics g)
// draws the background, border, and all the games objects
g.setColor(Color.lightGray); // sets the drawing color to light gray
g.fillRect(0, 0, 600, 700); // displays the game screens background
displayBorder(g); // displays the game screens border
displayBricks(g); // displays the array of bricks
ball.display(g); // displays the ball
paddle.display(g); // displays the paddle
* Creates the games array of bricks
public void createBricks()
int colorNumber = 1; // starts the color of the bricks at orange
double yPosition = 100; // starts the bricks y screen position at 100
for(int i = 0; i < 4; i++)
double xPosition = 12; // starts the bricks x screen position at 12
for(int j = 0; j < 8; j++)
if(colorNumber == 0)
colorNumber = 1; // sets the color of the bricks to orange
else
colorNumber = 0; // sets the color of the bricks to green
brickArray.add(brick = new Brick(xPosition, yPosition, colorNumber)); // adds a brick to the current container in the brick array
xPosition = xPosition + brick.getWidth(); // move the bricks x screen position to the next column
yPosition = yPosition + brick.getHeight(); // moves the bricks y screen position to the next row
if(colorNumber == 0)
colorNumber = 1; // sets the color of the bricks to orange
else
colorNumber = 0; // sets the color of the bricks to green
* Displays the game screens border
* @param g the Graphics object for this applet
public void displayBorder(Graphics g)
g.setColor(Color.black); // sets the drawing color to black
g.fillRect(0, 0, 600, 24); // draws a border on the top of the screen
g.fillRect(0, 0, 12, 700); // draws a border on the left of the screen
g.fillRect(588, 0, 12, 700); // draws a border on the right of the screen
* Displays the array of bricks on the screen
* @param g the Graphics object for this applet
public void displayBricks(Graphics g)
Brick currentBrick; // holds the brick data from the current ArrayList container
for(int i = 0; i < 32; i++)
currentBrick = (Brick)(brickArray.get(i)); // grabs the brick data from the current ArrayList container
currentBrick.display(g); // displays the current brick
* Called by the browser or applet viewer to inform this JApplet that it
* should start its execution. It is called after the init method and
* each time the JApplet is revisited in a Web page.
public void start()
if(timer == null)
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
* Runs the code that controls the animation
public void run()
do{
repaint(); // redraws the screen
try{
timer.sleep(100); // puts the thread to sleep for 100 milliseconds
} catch(InterruptedException e) {running = false;}
// !!!!!!! have tried placing ball.start() here
} while(running);
timer = null; // destroys the timer thread
* Called by the browser or applet viewer to inform this JApplet that
* it should stop its execution. It is called when the Web page that
* contains this JApplet has been replaced by another page, and also
* just before the JApplet is to be destroyed.
public void stop()
running = false; // tells the program that the thread is now done
}These are the bits of code for my class heirarchy, just to (hopefully) make it easier to follow.
import java.awt.*;
* The parent class of all the games objects.
* @author Kris Nelson
* @version November 9, 2004
public class Sprite
protected double screenX, screenY; // stores the x and y location of the object
* Constructor for objects of class Sprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
public Sprite(double xPosition, double yPosition)
screenX = xPosition; // sets the initial x screen position
screenY = yPosition; // sets the initial y screen position
* Sets new x and y screen locations for an object
* @param newX the new x screen location
* @param newY the new y screen location
public void setScreenXY(double newX, double newY)
screenX = newX; // sets the new x screen location
screenY = newY; // sets the new y screen location
* Sends back the current x screen location
* @return the current x screen location
public double getScreenX()
return screenX; // returns the current x screen location
* Sends back the current y screen location
* @return the current y screen location
public double getScreenY()
return screenY; // returns the current y screen location
import java.awt.*;
* Parent class of any game object that moves.
* @author Kris Nelson
* @version November 9, 2004
public class MovingSprite extends Sprite implements Runnable
protected double speedX, speedY; // stores the speed of an object in the x and y directions
protected Thread timer; // the thread which controls animation for all moving objects
protected boolean running; // tells the program whether or not the thread is running
* Constructor for objects of class MovingSprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public MovingSprite(double xPosition, double yPosition, double xSpeedValue, double ySpeedValue)
super(xPosition, yPosition); // passes the initial screen positions to Sprite
speedX = xSpeedValue; // sets the speed in the x direction
speedY = ySpeedValue; // sets the speed in the y direction
* Sends back the speed in the x direction
* @return the speed in the x direction
public double getSpeedX()
return speedX; // returns the speed in the x direction
* Sends back the speed in the y direction
* @return the speed in the y direction
public double getSpeedY()
return speedY; // returns the speed in the y direction
* Starts the thread in order to start animation
public void start()
if(timer == null)
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
* Empty since the child objects have their own run methods
public void run()
* Stops the thread from running
public void stop()
running = false; // tells the program that the thread is now done
import java.awt.*;
* Creates a single ball who's purpose is to bounce around and destroy the bricks.
* @author Kris Nelson
* @version November 10, 2004
public class Ball extends MovingSprite
protected static final double BALL_WIDTH = 15; // sets the width of the ball
protected static final double BALL_HEIGHT = 15; // sets the height of the ball
* Constructor for objects of class Ball
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public Ball(double xPosition, double yPosition, double xSpeedValue, double ySpeedValue)
super(xPosition, yPosition, xSpeedValue, ySpeedValue); // passes the initial screen positions and ball speeds to MovingSprite
// !!!!!!!! have tried placing timer.start() here
* Displays a ball onto the screen
* @param g the Graphics object for this applet
public void display(Graphics g)
g.setColor(Color.blue); // sets the balls color
g.fillOval((int)(screenX), (int)(screenY), (int)(BALL_WIDTH), (int)(BALL_HEIGHT)); // displays the ball
* Runs the code that controls the balls animation
public void run()
do{
try{
timer.sleep(100); // puts the thread to sleep for 100 milliseconds
} catch(InterruptedException e) {running = false;}
screenX = screenX + speedX;
screenY = screenY + speedY; // this is VERY SIMPLE BALL MOVEMENT FOR TESTING PURPOSES, WILL BE CHANGED LATER
} while(running);
}Sorry if that was too much code. I'm just trying to make this easier to follow.
I placed a // !!!!!!!!!!!!! comment in the places where I have tried starting the ball thread.
So basically, everything is running fine, except that I'm not at all sure of where to start the ball Thread, and thus can't start anything moving. If someone could tell me where I should be starting the thread, I would REALLY appriciate it. Thank you :D
- KrisSome advice.
1. the start method on the ball should be called from the start method on the applet and should in turn call the start method on the sprite's thread.
2. the run method of the Moveable sprite should have been declare abstract
3. don't implement borders manually. There's a java.awt.Border class for that.
4. probably, you don't want to have the game invoke each sprite by name; just make a big list of all the sprites and invoke all of them every time
5. do you really need provision for a non-circular ball? this isn't rugby.
6. I don't think you ever had a threading problem, just a display problem.
7. Don't write comments like this: ball.display(g); // displays the ballHere's my (even more simplified version):import java.awt.*;
import javax.swing.*;
import java.util.*;
* Class BreakoutApplet - Plays a simple game of Breakout.
* @author Kris Nelson, modified by Michael Lorton
* @version November 10, 2004
public class BreakoutApplet extends JApplet implements Runnable {
protected Ball ball;
protected Paddle paddle;
public boolean running; // tells the program whether or not the thread is running
protected Thread timer; // the thread which controls the animation for the applet
public void init() {
// this is a workaround for a security conflict with some browsers
// including some versions of Netscape & Internet Explorer which do
// not allow access to the AWT system event queue which JApplets do
// on startup to check access. May not be necessary with your browser.
getRootPane().putClientProperty("defeatSystemEventQueueCheck",
Boolean.TRUE);
ball = new Ball(this, GAMEWIDTH / 2, GAMEHEIGHT / 2, 5, 5);
public final static int GAMEWIDTH = 600;
public final static int GAMEHEIGHT = 400;
public void paint(Graphics g) {
g.setColor(Color.lightGray);
g.fillRect(0, 0,
GAMEWIDTH, GAMEHEIGHT);
ball.display(g); // displays the ball
* Called by the browser or applet viewer to inform this JApplet that it
* should start its execution. It is called after the init method and
* each time the JApplet is revisited in a Web page.
public void start() {
if(timer == null) {
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
ball.start();
* Runs the code that controls the animation
public void run() {
do{
repaint(); // redraws the screen
try{
Thread.sleep(100);
} catch(InterruptedException e) {running = false;}
} while(running);
public void stop() {
running = false;
abstract class Sprite {
protected double screenX, screenY; // stores the x and y location of the object
protected final BreakoutApplet parent;
* Constructor for objects of class Sprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
public Sprite(BreakoutApplet parent, double xPosition, double yPosition) {
this.parent = parent;
screenX = xPosition; // sets the initial x screen position
screenY = yPosition; // sets the initial y screen position
* Sets new x and y screen locations for an object
* @param newX the new x screen location
* @param newY the new y screen location
public void setScreenXY(double newX, double newY) {
screenX = newX; // sets the new x screen location
screenY = newY; // sets the new y screen location
* Sends back the current x screen location
* @return the current x screen location
public double getScreenX() {
return screenX; // returns the current x screen location
* Sends back the current y screen location
* @return the current y screen location
public double getScreenY() {
return screenY; // returns the current y screen location
abstract public void display(Graphics g);
* Parent class of any game object that moves.
* @author Kris Nelson
* @version November 9, 2004
abstract class MovingSprite extends Sprite implements Runnable {
protected double speedX, speedY; // stores the speed of an object in the x and y directions
protected Thread timer; // the thread which controls animation for all moving objects
protected boolean running; // tells the program whether or not the thread is running
* Constructor for objects of class MovingSprite
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public MovingSprite(BreakoutApplet parent,
double xPosition, double yPosition,
double xSpeedValue, double ySpeedValue) {
super(parent, xPosition, yPosition);
speedX = xSpeedValue; // sets the speed in the x direction
speedY = ySpeedValue; // sets the speed in the y direction
* Starts the thread in order to start animation
public void start() {
if(timer == null) {
timer = new Thread(this); // creates a new object of type Thread
timer.start(); // starts the new thread
running = true; // tells the program that the new thread is running
* Runs the code that controls the balls animation
public void run() {
while (parent.running) {
try{
Thread.sleep(100);
} catch(InterruptedException e) {
System.err.println(e);
step();
abstract protected void step();
* Creates a single ball whose purpose is to bounce around and destroy the bricks.
* @author Kris Nelson
* @version November 10, 2004
class Ball extends MovingSprite {
protected static final int BALL_DIAMETER = 15;
* Constructor for objects of class Ball
* @param xPosition the initial x screen position
* @param yPosition the initial y screen position
* @param xSpeedValue the speed in the x direction
* @param ySpeedValue the speed in the y direction
public Ball(BreakoutApplet parent,
double xPosition, double yPosition,
double xSpeedValue, double ySpeedValue) {
super(parent, xPosition, yPosition, xSpeedValue, ySpeedValue);
* Displays a ball onto the screen
* @param g the Graphics object for this applet
public void display(Graphics g) {
g.setColor(Color.blue);
g.fillOval((int)(screenX),
(int)(screenY),
BALL_DIAMETER, BALL_DIAMETER);
protected void step() {
screenX = screenX + speedX;
if (screenX < 0) {
screenX = -screenX;
speedX = -speedX;
else if ((screenX + BALL_DIAMETER)> BreakoutApplet.GAMEWIDTH) {
screenX = 2*(BreakoutApplet.GAMEWIDTH - BALL_DIAMETER) - screenX;
speedX = -speedX;
screenY = screenY + speedY;
if (screenY < 0) {
screenY = -screenY;
speedY = -speedY;
else if ((screenY + BALL_DIAMETER) > BreakoutApplet.GAMEHEIGHT) {
screenY = 2*(BreakoutApplet.GAMEHEIGHT - BALL_DIAMETER) - screenY;
speedY = -speedY;
} -
Can't create Word Document report - need help
Hi,
I have been trying to create a report using a word document. I downloaded an example from ni.com that has Export_Info.vi. When I try to run it I get this error:
Error 1003 occurred at Open VI Reference in New Report.vi->Export_Info.vi
I traced the error back to New Report.vi which is a VI that comes with the LabView package. There is a Open VI reference that when it tries to open Word_Open.vi gives an error. So for some reason I can not open Word_Open.vi without an error, and it comes with the Report generation office library.
Does anyone know what could the problem be?
I tried reinstalling everything and i still keep getting the same error. This makes it impossible to create a report now.
Any help would be VERY appreciated.
Thank youYes I have it installed. When I went to open up Word_Open.vi it opened with an error and it said that the property was not valid.
I attached a screenshot of the block diagram for Wor_Open.vi with an error message.
Thank you
Attachments:
word open.jpg 115 KB -
Issue with calculation script - please help
There is a script that I am working on that needs to track the changes made by the user on the data form and push the entered value down proportionally to the lower levels.
It’s a signal dimensional spread. It needs to spread the parent level values entered by the users for the product dimension to below levels. The Products are in rows.
The issue is that the users can enter their data at any level for the product dimension i.e. either at Level 0 product members, Level 1 product members or at Level 2 product members. I am using two accounts A & B in sync to track the changes made.
The structure of Product dimension that shows up on the form is similar to this –
~ Products (The user can enter starting at this level and also the below levels)
~ Product A
~ Product A1 (Level 0)
~ Product A2 (Level 0)
~ Product A3 (Level 0)
~ Product B (Level 0)
~ Product C (Level 0)
~ Product D
~ Product D1 (Level 0)
~ Product D2 (Level 0)
This is what I came up with so far but it’s not working in all the cases yet. Please give your suggestions to modify this script further to make it work the right way.
FIX(P, Y, H, E, B, D, C, V, C, S, @Relative(“Products”,-1))
Account(
IF(“AccountA”->@Parent(@Currmbr(“Product”)) <> “AccountB”->@Parent(@Currmbr(“Product”)))
AccountA=AccountB->@Currmbr(“Product”)/AccountB->@Parent(@Currmbr(“Product”)))*AccountA ->@Parent(@Currmbr(“Product”));
ENDIF;
ENDFIX;
FIX(P, Y, H, E, B, D, C, V, C, S, @Relative(“Products”,0))
Account(
IF(“AccountA”->@Parent(@Currmbr(“Product”)) <> “AccountB”->@Parent(@Currmbr(“Product”)))
AccountA=AccountB->@Currmbr(“Product”)/AccountB->@Parent(@Currmbr(“Product”)))*AccountA ->@Parent(@Currmbr(“Product”));
ENDIF;
ENDFIX;
This is not working right in all cases and I am sure I am going wrong somewhere. Please let me know your ideas on how can this be achieved.
Thanks in advance.
-Krrish
Edited by: 928844 on Apr 19, 2012 11:23 AMWell... sort of fixed it. Apparently my system doesn't like editing images with a color depth of 16bit. If I convert it down to 8 when I'm converting it from RAW, then it allows me to add layers... Is this normal?
Thank you for your time,
-Tony -
[AS] Beast of a script needs help converting from Quark 8 to InDesign CS5
First off, THANK YOU for even reading this post. Here's the dilema. I work in a publishing company that used an AppleScript from Quark 8 to automate our pagination from set text we pull from our sales reps worksheets. About 8 months ago we switched fully to InDesign CS5, but have had to hold onto Quark 8 to be able to keep running our pagination. I'd like to see if the geniuses (yes, I've been trolling these forums looking to solve this myself and seen some great problems fixed) on these forums can help me figure out the proper conversion I would need to be able to leave Quark 8 in the rearview.
Here's our current code... (I warned you it was a beast)
set Ad_Props to {¬
{Ad_Label:"SPREAD – ", Ad_Width:2.495, Ad_Height:1.62, Ad_Text_Angle:0}, ¬
{Ad_Label:"FULL – ", Ad_Width:1.225, Ad_Height:1.62, Ad_Text_Angle:0}, ¬
{Ad_Label:"SPREAD – ", Ad_Width:2.495, Ad_Height:1.62, Ad_Text_Angle:0}, ¬
{Ad_Label:"JUNIOR – ", Ad_Width:0.90625, Ad_Height:1.62, Ad_Text_Angle:0}, ¬
{Ad_Label:"1/2H – ", Ad_Width:1.225, Ad_Height:0.785, Ad_Text_Angle:0}, ¬
{Ad_Label:"1/2V – ", Ad_Width:0.5875, Ad_Height:1.62, Ad_Text_Angle:90}, ¬
{Ad_Label:"1/3V – ", Ad_Width:0.5875, Ad_Height:1.2025, Ad_Text_Angle:90}, ¬
{Ad_Label:"1/4 – ", Ad_Width:0.5875, Ad_Height:0.785, Ad_Text_Angle:0}, ¬
{Ad_Label:"1/4 Strip – ", Ad_Width:0.26875, Ad_Height:1.62, Ad_Text_Angle:90}, ¬
{Ad_Label:"1/8H – ", Ad_Width:0.5875, Ad_Height:0.3675, Ad_Text_Angle:0}, ¬
{Ad_Label:"1/8V – ", Ad_Width:0.26875, Ad_Height:0.785, Ad_Text_Angle:90}, ¬
{Ad_Label:"Junior (GOLF) – ", Ad_Width:0.8, Ad_Height:1.62, Ad_Text_Angle:0}, ¬
{Ad_Label:"1/3V (GOLF) – ", Ad_Width:0.375, Ad_Height:1.62, Ad_Text_Angle:90}, ¬
{Ad_Label:"1/3sq. (GOLF) – ", Ad_Width:0.8, Ad_Height:0.785, Ad_Text_Angle:0}, ¬
{Ad_Label:"1/6V (GOLF) – ", Ad_Width:0.375, Ad_Height:0.785, Ad_Text_Angle:90}, ¬
{Ad_Label:"Directory Listing Only – ", Ad_Width:0.3, Ad_Height:0.3, Ad_Text_Angle:0}, ¬
{Ad_Label:"INSERT (# in notes) – ", Ad_Width:0.3, Ad_Height:0.3, Ad_Text_Angle:0}, ¬
{Ad_Label:"Other (See Notes) – ", Ad_Width:0.3, Ad_Height:0.3, Ad_Text_Angle:0}, ¬
{Ad_Label:"------------ – ", Ad_Width:0.3, Ad_Height:0.3, Ad_Text_Angle:0}}
set Position_Width to number
set Position_Width to 11.375
set Position_Height to number
set Position_Height to 1.875
set Jump_Height to number
set Jump_Height to 0
set Variable_Count to number
set Variable_Count to 0
set Variable_Height to number
set Variable_Height to (1.875 + (1.62 * Variable_Count))
set Last_Ad to number
set Last_Ad to 0
tell application "QuarkXPress"
activate
try
display dialog "WARNING: This version of 'Dummy Square Maker' runs much slower than the last version, a confirmation will tell you when you are finished. Please be patient." & return & return & "Make sure to have the text box selected" buttons {"Cancel", "Accept"} default button 2 with icon caution
set ThisBox to object reference of current box
tell story 1 of ThisBox
set (every paragraph where it is return) to ""
set style sheet of every text to null
set style sheet of every text to "DUMMY TEXTS"
repeat with i from 1 to (count of paragraphs)
try
tell paragraph i
set ThePage to my get_CurrentPage()
try
if it contains " – " then
set style sheet to "AD SIZE"
set Ad_Size to contents
set {This_Width, This_Height, this_angle} to {"", "", ""}
repeat with This_Ad in Ad_Props
if Ad_Size contains (Ad_Label of This_Ad) then
set This_Width to Ad_Width of This_Ad
set This_Height to Ad_Height of This_Ad
set this_angle to Ad_Text_Angle of This_Ad
exit repeat
end if
end repeat
set Ad_Box to my Make_Box(ThePage, {1.875, 10.875, This_Height + 1.875, This_Width + 10.875}, this_angle)
duplicate contents to (end of Ad_Box)
else if it contains "—" then
set style sheet to "AD REP/PLACEMENT"
duplicate contents to (end of Ad_Box)
else if it starts with "©" then
set style sheet to "AD REP/PLACEMENT"
delete (character 1)
duplicate contents to end of Ad_Box
if Position_Width ≤ 19.75 then
set Jump_Height to Jump_Height + This_Height
(*_________________This is where Ad Boxes Stack_________________*)
if (Jump_Height ≤ 1.62) then
set origin of bounds of Ad_Box to {Position_Height, Position_Width}
set Position_Height to Position_Height + This_Height
(*_________________This is where Ad Boxes more right_________________*)
else
set Position_Height to Variable_Height
(*set Position_Width to Position_Width + This_Width + 0.05*)
set Position_Width to Position_Width + Last_Ad + 0.05
set origin of bounds of Ad_Box to {Position_Height, Position_Width}
set Jump_Height to This_Height
set Position_Height to Variable_Height + This_Height
end if
set Last_Ad to This_Width
(*_________________This is where New Row appears_________________*)
else
set Position_Width to 11.375
set Variable_Count to Variable_Count + 1
set Variable_Height to (1.875 + (1.62 * Variable_Count))
set Position_Height to Variable_Height
set origin of bounds of Ad_Box to {Position_Height, Position_Width}
set Position_Height to Position_Height + This_Height
set Jump_Height to This_Height
set Last_Ad to This_Width
end if
else
duplicate contents to (end of Ad_Box)
end if
end try
end tell
on error errmsg number errnum
display dialog "There has been an error " & "[" & i & "] (" & errmsg & " [" & errnum & "])" buttons {"Okay"} default button 1 with icon stop
end try
end repeat
delete contents
set style sheet of every text to null
end tell
beep 2
display dialog "Automation Finished" & return & return & "IMPORTANT NOTE: Color your Ad Squares according to Sales Rep, and select them all and 'BRING TO FRONT [F5]', this is VITAL." buttons {"Okay"} default button 1 with icon stop
on error errmsg number errnum
beep 3
if errnum ≠ -128 then
beep
display dialog errmsg & " [" & errnum & "]" buttons {"OK"} default button 1 with icon stop
end if
end try
end tell
on Make_Box(ThePage, TheBounds, this_angle)
local ThePage, TheBounds, this_angle
tell application "QuarkXPress"
tell page ThePage of document 1
set Ad_Box to make new text box at end with properties {bounds:TheBounds, vertical justification:centered, color:"Rep_Other", shade:100, opacity:10, text angle:this_angle, frame:{style:solid line, color:"Black", shade:60, width:0.1}}
end tell
end tell
(*end tell*)
return Ad_Box
end Make_Box
on get_CurrentPage()
tell application "QuarkXPress"
tell document 1
return page number of current page
end tell
end tell
end get_CurrentPageHi,
I think with this, you can already make good progress in your work.
Good luck!
global mydocument
tell application "Adobe InDesign CS5.5"
set mydocument to active document
tell mydocument
set myParaStyle to paragraph style "DUMMY TEXTS"
tell page 1
set TheBounds to {0, 0, 20, 50}
set Ad_Box to make text frame
tell Ad_Box
set geometric bounds to TheBounds
set vertical justification of text frame preferences to center align
set contents to "This is the contents"
end tell
set myStory to parent story of Ad_Box
set applied paragraph style of every paragraph of myStory to myParaStyle
end tell
end tell
end tell
Your two handlers then look like this:
on Make_Box(ThePage, TheBounds, this_angle)
local ThePage, TheBounds, this_angle
tell application "Adobe InDesign CS5.5"
tell page ThePage of mydocument
set Ad_Box to make text frame
tell Ad_Box
set geometric bounds to TheBounds
set vertical justification of text frame preferences to center align
end tell
end tell
end tell
return Ad_Box
end Make_Box
on get_CurrentPage(CurrentTextFrame)
tell application "Adobe InDesign CS5.5"
tell mydocument
return name of parent page of parent page of CurrentTextFrame
end tell
end tell
end get_CurrentPage
Shorter version:
on get_CurrentPage(CurrentTextFrame)
tell mydocument of application "Adobe InDesign CS5.5"
return name of parent page of parent page of CurrentTextFrame
end tell
end get_CurrentPage
Ce message a été modifié par: OlivierBerquin -
Problem with script – NEED HELP
HELP!!! why isn't the script working?
on adding folder items to thefolder after receiving theAddedItems
repeat with eachitem in theAddedItems
set theSender to "me<[email protected]>"
set recipCommon to "Files"
set recipAddress to (choose from list {"User 1", "User 2", "User 3"} with prompt "Select a recipient :") as text
if result is "User 1" then
set recipAddress to {"User 1 <[email protected]>"}
else if result is "User 2" then
set recipAddress to {"User 2 <[email protected]>"}
else if result is "User 3" then
set recipAddress to {"User 3 <[email protected]>", "[email protected]>"}
end if
set msgText to " type body copy here "
tell application "Mail"
set newmessage to make new outgoing message with properties {content:msgText & return}
tell newmessage
set sender to theSender
tell application "Finder" to set theSubject to name of eachitem
set subject to theSubject
repeat with eachRecipient in recipAddress
make new to recipient at end of to recipients with properties {name:recipCommon, address:eachrecipAddress}
end repeat
end tell
send newmessage
end tell
end repeat
end adding folder items toHELP......
!!!Everything works in the below script except it doesn't send the email?!!!
on adding folder items to thefolder after receiving theAddedItems
repeat with eachitem in theAddedItems
set theSender to "me<[email protected]>"
set recipCommon to "Files"
set recipAddress to (choose from list {"User 1", "User 2", "User 3"} with prompt "Select a recipient :") as text
if result is "User 1" then
set recipAddress to {"User 1 <[email protected]>"}
else if result is "User 2" then
set recipAddress to {"User 2 <[email protected]>"}
else if result is "User 3" then
set recipAddress to {"User 3 <[email protected]>", "[email protected]>"}
end if
set msgText to " type body copy here "
tell application "Mail"
set newmessage to make new outgoing message with properties {content:msgText & return}
tell newmessage
set visible to true
set sender to theSender
tell application "Finder" to set theSubject to name of eachitem
set subject to theSubject
repeat with eachRecipient in recipAddress
make new to recipient at end of to recipients with properties {name:recipCommon, address:eachRecipient}
end repeat
repeat with eachRecipient in recipAddress
make new to recipient at end of to recipient with properties {name:recipCommon, address:recipAddress}
set eachRecipient to contents of eachRecipient
end repeat
end tell
Maybe you are looking for
-
No Data Found: Exception in SQL inside PL/SQL block
Hi Friends I am trying to execute an SQL SELECT stmt inside a PL/SQL block. But when i execute the procedure, it gives me No Data Found Exception. I know it is because no row is fetched in the query, but the condition of the SELECT query i have speci
-
I have tried resetting my password Resetting my router And turned my phone off and on several times
-
XP SP3 toolbar retains the symbol in Home and Back areas, Win7 now has the words instead. Other areas seem to do the same. Both work properly. Another problem which may be relevant is that the appearance of my ISP website front page on XP has not bee
-
How to modify material number in MM01
Hi Guru, I want to modify material number in MM01 according to the material group selected by the user. For example if material group 100 is selected, the material number should be 100xxxxx, 200 is selected, number should be 200xxxxx. I tried coding
-
LMS 3.1 Device Discovery issue
Hello, I have been getting myself familiar with LMS, but can't figure out why I am having issues seeing some devices. I can't find any solution to my problem on other posts. I have a server farm connected to my core switch, both can see each other vi