How to run scripts in Numbers?
In Yvan Koenig's script, the instructions say
"Save the script as a Script: numberInLetters.scpt
Move the newly created application into the folder:
<startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Numbers:
Maybe you would have to create the folder Numbers and even the folder Applications by yourself.
Put the cursor in the cell which contains the number to translate.
menu Scripts > Numbers > numberInLetters"
What I have done so far:
placed a script in that location
checked option in AppleScript Editor "Show Script menu in menu bar"
closed and opened Numbers since doing all that
Still no Script menu.
What else do I need to do to get the Script menu to display in Numbers?
Hi kharisma,
This is what did with the script:
Selected everything from (* to --[/SCRIPT] (omitting {code} )
Pressed command-C to Copy.
Opened AppleScript Editor.
Went AppleScript Editor > Preferences.
Checked "show Script menu in Menu bar"
Closed preferences.
Clicked in the script area and Pasted.
Went File > Save to open the Save Dialogue.
Chose Script from the File Format: popup menu.
Navigated to the Desktop and clicked Save.
Switched to Finder and opened a Finder window.
Pointed the window to the Desktop. Sorted by Date to bring the newly saved file to the top.
(Later repeated the steps above, saving the same script as an Application with the name Num2wdsResults. Moved both to the folder noted below.)
Clicked otside the window to deslelect it.
Pressed and held the option key.
Went Go > Library to open my user Library.
Released option key.
Navigated/constructed path to Library > Scripts > Applications > Numbers.
Dragged newly saved file to the newly made Numbers folder.
Launched Numbers (which opened a new blank document)
Entered numbers in A2 through A11.
Selected each in turn and went Script menu > Numbers2words
(or on alternate rows, Script menu > num2wds)
Resuts as shown. Note the limitations demonstrated in the yellow rows.
The script may be saved as either a Script or an Application. Both produce the same results.
To run either from within Numbers, select a cell containing a number, then select the script from the Script menu in Numbers.
Regards,
Barry
Similar Messages
-
How to run script file ( unix script file like ksh or sh file) using Java
How to run script file ( unix script file like ksh or sh file) using Java Program?.
I am using the following code snippet to run the simple commands like top or ls ,etc....
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec("top");
Thanks In Adavance
-SivaString [] { "ksh" , "-c" , "script", "arg 1", "arg 2", "arg 3"}
-
I would like to know how to run scripts with xgrid.
From the Xgrid Admin manual, page 37, I created a file and added
!#/bin/sh
/bin/echo "Hello, World!"
saved the file, and gave chmod 755 hello.sh
When I run at the command line, "Hello, World" is displayed. But as Apple mentioned in the same page of the manual, I did this at the command line
xgrid -h localhost -p mypassword job submit hello.sh
Job id is displayed. Say it is 67.
I could see in the Admin interface that job is sumbitted and running. After finishing, at the command line I did a
xgrid -h localhost -p mypassword job results -id 67
Nothing is displayed. Am I doing right or missing something ?
Appreciate any help.A little comment: add to your bashrc file (in /etc/)
export XGRIDCONTROLLERHOSTNAME=yourcontroller
export XGRIDCONTROLLERPASSWORD=yourpass
so that you don't need to use -h and -p options all the time.
Am I wrong or shouldn't your commands be -job (notice the dash before job)?
I suppose because otherwise you would get a help page. Also, I suppose your beggining of file is #! instead of the inverse...
Did you try using run instead of submit? You should see the output right away.
What is the status of the job in Xgrid Admin? What happens if you use -so to direct the output to some file? -
Hi
eBS
DB: 11.1.7
APS: R12.1.2
Does anyone who can guide me how to run script for .sql
I need command on how to execute this |
Run the script poxrespo.sql in the PO_TOP/sql directory
ThanksDoes anyone who can guide me how to run script for .sql
I need command on how to execute this |
Run the script poxrespo.sql in the PO_TOP/sql directoryConnect as apps user to SQL*Plus as run the script.
Make sure COMMIT is issued -- Release Notifications Error - ORA-20002 2018 Unable To Generate The Notification Content [ID 342734.1
Thanks,
Hussein -
Hi all,
I am facing problem in running oracle scripts in HP-Unix..
In nohup option i can`t able to use @ symbol...
can anyone suggest me how to run ???its urgent
In solaris i usually run like below
nohup sqlplus -s data/data @script.sql &
but i cant do the same in HP-Unix please some one tell me how to run??Hello Kirupa,
this is from the HPUX FAQ, maybe it helps:
Subject: 8.14 Why can't I type an '@' character?
If you do a 'stty -a' and you will see that your 'kill' character is
set to '@'. You need to set your 'kill' character to be something
other than the '@' character by doing something like 'stty kill '^U''.
You should add this to your .profile or .cshrc file.
Kind regards -
OSD: How to run script(it's In package) without download
I has a hta script need to run before "Partition Disk", but this script is in a package, if I want to run it, it need to download to harddisk. so it will fail, because no partition.
So how to run directly this script in network, without download to C drive.
PS: I think I can put this script into boot image, but it is not easy to maintain. So I want to run directly in network
06/30:
Thank you for everyone support!
My Hta will warn users that the following operations will format data.So "Create a temporary partition on the disk"--It is not for my requirement.
As Narcoticoo mentioned, I want to use "Package Share Settings" to share folder, so how to map this folder with automatically recognize
DP?
just like \\%DP%\htaThank you for everyone support!
As Narcoticoo mentioned, I want to use "Package Share Settings" to share folder, so how to map
this folder with automatically recognize DP?
just like \\%DP%\hta
Is there this variable? -
Cron job : how to run scripts as cron job
Hi friend,
Sorry one very small question ..
Can someone tell me how can i run scripts as cron job .. on HP UX.
thanks
ashishHi Ashish,
open one telnet session.
crontab -e
then give the periodicity day and time
like below
05 00 * * 1-6 /usr/local/bin/database_backup.sh
and now create the script file with the command or script to execute.
Regards
Ashok Dalai -
How to run script on Adobe Acrobat 9 Pro
HI all i'm new to Adobe Acrobat 9 Pro Scripting, and I'm hoping someone can help me how i can run any javascript on Adobe Acrobat 9 Pro. I have no idea which place (location) take script then run.
Like Adobe InDesign CS4 script location=>
Application>Adobe InDesign CS4>Scripts>Scripts Panel>JavaScript
Run Path =>
Window>Automation>Script then run
Any insight is appreciated!
Thank you so much adv.
[email address removed by host]“All scripts are executed in response to a particular event. There are several types of events.” (Adobe, 2006, p. 40). You may want to execute your script as a console event. In this case, use the JavaScript Debugger console (Adobe, 2006, p. 21). For more information, read the manual Acrobat has provided online: Developing Acrobat Applications (Adobe, 2006).
John
Works Cited
Adobe Systems Incorporated. (2006). Adobe® Acrobat® SDK 8.0 Developing Acrobat Applications Using JavaScript for Microsoft® Windows® and Mac OS®. Edition 1.0, November 2006. Retrieved on Jan. 5, 2012 at http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/js_devel oper_guide.pdf. -
How to run script on selected files in Bridge
I have a script that takes an open Photoshop document and saves it to four different resolutions in different folders. I'd like to be able to select files in Bridge and run the script on the selected files instead of having to do it each image individually in PS. Anyone know how to do this? Thanks!
EricMarkWalsh wrote:
A fairly easy way, you can add your script to the 'Scripts' menu, then create an action that calls this script (use 'Insert Menu Item' to add to your action) and call this action through a batch in Bridge. One issue with this, though, is that it does require creating an action to specifically call the script, I don't know if you can call the script directly from Bridge.
I haven't scripted Bridge at all myself, but I believe you should also be able to rewrite your script to get the selection in Bridge, and process those files in Photoshop.
If your script is set up to process one file at a time, the Bridge/Batch technique is the simplest way to do it.
If your script needs to know what all of the files are before it can begin processing, you have to add a Menu element in Bridge and have it call your action/script in Photoshop. A bit more complicated, but there are a lot of examples of this at ps-scripts.com.
-X -
How to run script file Oracle XE?
Hi there,
I'm new here. I've just started on a tutorial (i.e. ADF) and it requires me to run a script, i.e.
SQLPLUS>Start <tutorial_install>\scripts\build.sql
How do I run this in Oracle XE?
The content of the build.sql is included below.
The build.sql also calls other sql scripts in the same directory.
I can't seem to get this to run in the SQL command prompt in Oracle XE. Can you please help?
Thanks,
Will
build.sql contains the following...
REM Main build Script for the SRDemo schema, objects and demo data
REM To be run from SQL*Plus conected as a DBA
REM Note you can also run this SQL install from ANT
REM Schema Owner SRDEMO is parameterized to allow for simpler workshop /
REM classroom setup where only one shared server is available
REM $Id: build.sql,v 1.5 2005/12/22 22:46:41 duncan Exp $
SET FEEDBACK 1
SET NUMWIDTH 10
SET LINESIZE 132
SET TRIMSPOOL ON
SET TAB OFF
SET PAGESIZE 999
SET ECHO OFF
SPOOL SRDemo_Install.log
REM Define the changable data
DEFINE DEMO_SCHEMA = SRDEMO
DEFINE DEMO_SCHEMA_PASSWORD = ORACLE
REM Create the schema owner - this can fail if the
REM Script has alreadt been run, but that's OK as the first
REM Step of the createSchemaObjects is to drop the existing objects just in case
@@createSchema &&DEMO_SCHEMA &&DEMO_SCHEMA_PASSWORD
REM connect to user account and invoke the scripts that create schema objects.
CONNECT &&DEMO_SCHEMA/&&DEMO_SCHEMA_PASSWORD
@@createSchemaObjects
REM Add the triggers needed for the ADF BC version of the Demo
@@createSequenceTriggers
REM Add the sample data to the tables
@@populateSchemaTables
REM And Commit all that
commit;
REM Report Back
Prompt What OBJECTS were created?
column object_name format a30
column object_type format a30
select object_type,
object_name
from user_objects
group by object_type, object_name
order by object_type desc, object_name
Prompt ------------------------------------------------------
Prompt
Prompt Are there any INVALID OBJECTS?
select object_type,
object_name
from user_objects
where status='INVALID'
group by object_type, object_name
order by object_type desc, object_name
Prompt Disconnecting....
disconnect
spool offI've just started on a tutorial (i.e.
ADF) and it requires me to run a script, i.e.
SQLPLUS>Start <tutorial_install>\scripts\build.sql
How do I run this in Oracle XE?You must start SQL*Plus (SQL Command Line) and there execute the script.
For more info about using SQL*Plus take a look here:
http://download.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25108/xedev_sqlplus.htm#CJABIFFE
HTH -
Hi
how run sql scripts for example see below,
For Release 12+, i2471362.sql is delivered with the release with version 120.0
The module can be found in $INV_TOP/patch/115/sql
Run i2471362.sql periodically to clean-up orphaned rows in the MTL_DEMAND and MTL_RESERVATIONS tables.
any idea
thanksHi,
As applmgr/oracle user, login to SQL*Plus (as APPS user) and run the script.
$ sqlplus apps/<apps password>
SQL> @i2471362.sqlStandard Cleanup Scripts for INVDVDSD - SUPPLY/DEMAND in 11.5.10.2, 12.0 and 12.1 [ID 372170.1]
11i/R12: Clean Up Scripts - Inventory Reservations Not Relieved for Closed Sales Orders [ID 199887.1]
MRPRPROP - Reorder Point Report Shows Incorrect Data In Open Demand Qty [ID 300260.1]
Thanks,
Hussein -
How to run script on login?
I've got a script called MouseFix that sets the mouse's sensitivity to just the way I like it when it is run. I'd like the script to run on startup. I've tried using Lingon, but that didn't work, and I've also placed the command to run the script in the ~/.profile file, but that doesn't seem to work, either.
Anyone have any other suggestions that I could try?GaryKing wrote:
I've got a script called MouseFix that sets the mouse's sensitivity to just the way I like it when it is run. I'd like the script to run on startup. I've tried using Lingon, but that didn't work,
please explain what didn't work. using a launch daemon is a proper way to do this and Lingon is the easiest way to make one.
and I've also placed the command to run the script in the ~/.profile file, but that doesn't seem to work, either.
~/.profile is only executed when you start terminal.
Anyone have any other suggestions that I could try?
Message was edited by: V.K. -
Hope someone can answer this ASAP, I'm on deadline.
I have to convert .cwk files to Appleworks6, and found some great scripts by Hiroto in the AW forum.
However, i dont know how to use them!
copy and paste into script editor? Terminal? And then what? Compile? Run? ????
the confusing thing for me is none of them have the word "tell" in them, which all my research has informed me is how an applescript script reads...
Just (* , etc.
Here is the first part of one:
-- save_AW_as_v6.applescript
Convert files of AppleWorks / ClarisWorks prior to version 6 to AppleWorks 6 files.
v0.1
* Tested with AppleWorks 6.2.4 under OS X 10.6.8.
* AppleWorks 6.2.9 may fail to open old ClarisWorks files, in which case use older version such as AppleWorks 6.2.4.
* Specify property in_place in script, which defines the operation mode, as necessary.
* A log file with time-stamp in name is created on desktop.
* Original file name is always preserved.
Name extension ".cwk" is not added in destination file if it is missing in source file.
This is to avoid possible data loss in case there're file names, e.g., abc and abc.cwk in a source directory.
_main()
on _main()
script o
property in_place : false
true : convert files in place, i.e. files are overwritten,
where original source directory is archived in zip file with time-stamp in name in advance;
false : converted files are saved in destination directory which is specified in a dialogue in scriptThanks, for your time with this, Niel. I really don't want to have to convert them all by hand, so if I can get these to work, it would be beyond wonderful. I'm 2 days past when i told the client I'd have them ready...
Here are all 3 scripts. Cwk to AW6, AW6 to Numbers, AW6 to Pages...i imagine I'll have the same trouble with all of them.
Here's Hiroto's original posting:https://discussions.apple.com/thread/5455245?start=45&tstart=0
--save_AW_as_v6.applescript
Convert files of AppleWorks / ClarisWorks prior to version 6 to AppleWorks 6 files.
v0.3
v0.3 -
changed the logging scheme from post-conversion log:
converted x => y
to pre-conversion log:
converting x => y
so that it can help to identify the last file which had caused the applicaton / script to crash.
v0.2 -
added optional function to inherit creation and modification dates of source files
v0.1 -
initial version
* Tested with AppleWorks 6.2.4 under OS X 10.6.8.
* AppleWorks 6.2.9 may fail to open old ClarisWorks files, in which case use older version such as AppleWorks 6.2.4.
* Specify property in_place in script as necessary.
* Specify property inherit_dates in script as necessary.
* A log file with time-stamp in name is created on desktop.
* Original file name is always preserved.
Name extension ".cwk" is not added in destination file if it is missing in source file.
This is to avoid possible data loss in case there're file names, e.g., abc and abc.cwk in a source directory.
_main()
on _main()
script o
property in_place : true
true : convert files in place, i.e. files are overwritten,
where original source directory is archived in zip file with time-stamp in name in advance;
false : converted files are saved under destination directory which is specified in a dialogue in script
property inherit_dates : true
true : destination file inherits creation date and modification date of source file
false : destination file has creation date and modification date at the time of conversion
property logfile : (path to desktop)'s POSIX path & (do shell script "date +'save_AW_as_v6.log_%Y%m%dT%H%M%S.txt'")
property pp : {}
-- accept source directory (and destination direcotry if in_place is false)
set srcd to (choose folder with prompt "Choose source directory where source files reside.")'s POSIX path
if srcd ends with "/" and (count srcd) > 1 then set srcd to srcd's text 1 thru -2
if not in_place then
repeat
set dstd to (choose folder with prompt "Choose destination directory where to save converted files.")'s POSIX path
if dstd ends with "/" and (count dstd) > 1 then set dstd to dstd's text 1 thru -2
if srcd ≠ dstd then exit repeat
display dialog "Source and destination directories cannot be the same!" with icon stop
end repeat
end if
log_printf(logfile, "conversion started in operation mode: in_place = %s, inherit_dates = %s.\\n", {in_place, inherit_dates})
-- retrieve target files
log_printf(logfile, "scanning files under %s\\n", srcd)
set pp to _match(my is_AW_but_v6, scan_AW_files(srcd))
log_printf(logfile, "found %d file(s) to process.\\n", count my pp)
-- process target files
if (count my pp) > 0 then
if in_place then
-- archive the source directory first (zip file name = srcd_YYYY-MM-DDTHH.MM.SS.zip)
set dst to do shell script "src=" & srcd's quoted form & "
dst=\"${src}_$(date +'%FT%H.%M.%S').zip\"
ditto -ck --keepParent --sequesterRsrc \"$src\" \"$dst\"
echo \"$dst\""
log_printf(logfile, "archived source directory in %s\\n", dst)
repeat with p in my pp
set p to p's contents
log_printf(logfile, "converting %s\\n", p)
save_AW_as_v6(p, p, {inherit_dates:inherit_dates})
end repeat
else
set slen to count srcd
repeat with p in my pp
set p to p's contents
set q to dstd & (p's text (slen + 1) thru -1)
log_printf(logfile, "converting %s => %s\\n", {p, q})
save_AW_as_v6(p, q, {inherit_dates:inherit_dates})
end repeat
end if
end if
-- completion notice
log_printf(logfile, "process completed for total of %d file(s).\\n", count my pp)
tell me
activate
display dialog "Done " & (count my pp) & " file(s)." giving up after 5 with icon note
end tell
end script
tell o to run
end _main
on scan_AW_files(d)
string d : POSIX path of source directory where to start scanning
return list : list of POSIX paths of found files
* query condition is (file name extension = "cwk") OR (file creator type = "BOBO")
script o
property pp : {}
property qq : {}
property rr : {}
tell application "System Events"
tell disk item d
set pp to every folder's POSIX path
repeat with p in my pp
set qq to my scan_AW_files(p's contents)
repeat with q in my qq
set end of my rr to q's contents
end repeat
end repeat
set qq to every file's POSIX path whose name extension = "cwk" or creator type = "BOBO"
repeat with q in my qq
set end of my rr to q's contents
end repeat
end tell
end tell
return my rr's contents
end script
tell o to run
end scan_AW_files
on is_AW_but_v6(f)
string f : POSIX path of source file
return boolean : true if f is AW/CW file of version prior to 6, false otherwise
* matching codition is (byte 1 < 0x06) AND (bytes 5..8 = 'BOBO')
set f to f as POSIX file --as alias
--return (read f from 5 for 4)'s id = {66, 79, 66, 79} and (read f for 1)'s id < 6 -- for 10.5 or later only
considering case
return (read f from 5 for 4) = "BOBO" and (ASCII number (read f for 1)) < 6
end considering
end is_AW_but_v6
on save_AW_as_v6(src, dst, {inherit_dates:inherit_dates})
string src : POSIX path of source file, typically file of AW5 or CW4 etc
string dst : POSIX path of destination file
boolean inherit_dates: true for dst to inherit creation and modification dates of src, false otherwise.
* src may equate to dst, in which case src is overwritten
* intermeditate directories in dst will be created as needed if not present
-- get source alias
set srca to src as POSIX file as alias
-- create temp file
set tmp to do shell script "mktemp /tmp/save_AW_as_v6.XXXXXXXX"
set tmpa to tmp as POSIX file as alias
-- convert to AW6 and save in temp file
tell application "AppleWorks 6"
--activate
set k to count documents
open srca
repeat until (count documents) > k
delay 0.2
end repeat
tell document 1
close saving in tmpa
end tell
end tell
-- wait for the temp file is closed
wait_file_close(tmp)
-- set label of temp file to label of source file -- [1]
repeat 3 times -- max retry
try -- [2]
tell application "Finder"
set lbl to item srca's label index
tell item tmpa
update
set its label index to lbl
end tell
end tell
exit repeat -- exit if no error
delay 0.5 -- wait some time before retry
end try
end repeat
-- inherit creation and modication dates from src to tmp
if inherit_dates then inherit_file_dates(src, tmp)
-- move temp file to destination file (destination directory tree is created as necessary)
do shell script "tmp=" & tmp's quoted form & "; dst=" & dst's quoted form & "
d=${dst%/*}; [[ -d \"$d\" ]] || mkdir -p \"$d\"
mv -f \"$tmp\" \"$dst\""
[1] This is required because AW6 does not preserve the original label when saving file.
[2] Finder is such an unreliable beast that it may fail even after the file is indeed closed.
end save_AW_as_v6
on wait_file_close(f)
string f : POSIX path of file
* wait until f is no longer opened by AppleWorks
do shell script "f=" & f's quoted form & "
while [[ $(lsof -Fc \"$f\") =~ 'AppleWorks' ]]; do sleep 0.3; done"
end wait_file_close
on _match(pat, aa)
handler pat : handler to test elements in aa
list aa : source list
return list : list of every element a of list aa whose pat(a) = true
script o
property |::xx| : aa's contents
property |::yy| : {}
property |::f| : pat
repeat with x in my |::xx|
set x to x's contents
if my |::f|(x) then set end of my |::yy| to x
end repeat
return my |::yy|'s contents
end script
tell o to run
end _match
on log_printf(f, fmt, lst)
string f : POSIX path of log file
string fmt : printf format string
list lst : list of values (if lst is one item list {x}, lst may be x)
* %-26s time-stamp in format %F %T%z is added to the beginning of each entry
local args
set args to "'%-26s'" & fmt's quoted form & " \"$(date +'%F %T%z')\" "
repeat with a in {} & lst
set args to args & (a as string)'s quoted form & space
end repeat
do shell script "printf " & args & " >> " & f's quoted form
end log_printf
on inherit_file_dates(src, dst)
string src : POSIX path of source file
string dst : POSIX path of destination file
* If creation date of src is older than or equal to that of dst,
this will set both creation date and modification date of dst to those of src.
* If creation date of src is newer than that of dst,
this will set only modification date of dst to that of src.
do shell script "src=" & src's quoted form & "; dst=" & dst's quoted form & "
ct=$(stat -f '%SB' -t '%Y%m%d%H%M.%S' \"$src\")
mt=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' \"$src\")
touch -t $ct \"$dst\" # set creation date (<= current creation date)
touch -mt $mt \"$dst\" # set modification date (>= creation date)"
end inherit_file_dates
[CodeBlockStart:17c5a62c-54d3-4061-ac41-37b7e4ed1ce1][excluded]
--save_AW6_SS_as_Numbers2.applescript
Convert AppleWorks v6 SS (spreadsheet) files to iWork'09's Numbers v2 files
v0.2
v0.2 -
changed the logging scheme from post-conversion log:
converted x => y
to pre-conversion log:
converting x => y
so that it can help to identify the last file which had caused the applicaton / script to crash.
v0.1 -
initial version
* Tested with Numbers 2.0.5 under OS X 10.6.8.
* Specify property in_place in script as necessary.
* Specify property inherit_dates in script as necessary.
* A log file with time-stamp in name is created on desktop.
* Original file name is always preserved except that name extension ".numbers" is added
Note that original name extension (.cwk) is NOT removed and thus, e.g., abc.cwk will be converted to abc.cwk.numbers
This is to avoid possible data loss in case there're file names, e.g., abc and abc.cwk in a source directory.
_main()
on _main()
script o
property in_place : true
true : convert files in place, i.e. converted files are saved in original directories,
where original source directory is archived in zip file with time-stamp in name in advance;
false : converted files are saved under destination directory which is specified in a dialogue in script
property inherit_dates : true
true : destination file inherits creation date and modification date of source file
false : destination file has creation date and modification date at the time of conversion
property ext : ".numbers"
property logfile : (path to desktop)'s POSIX path & (do shell script "date +'save_AW6_SS_as_Numbers4.log_%Y%m%dT%H%M%S.txt'")
property pp : {}
-- accept source directory (and destination direcotry if in_place is false)
set srcd to (choose folder with prompt "Choose source directory where source files reside.")'s POSIX path
if srcd ends with "/" and (count srcd) > 1 then set srcd to srcd's text 1 thru -2
if not in_place then
repeat
set dstd to (choose folder with prompt "Choose destination directory where to save converted files.")'s POSIX path
if dstd ends with "/" and (count dstd) > 1 then set dstd to dstd's text 1 thru -2
if srcd ≠ dstd then exit repeat
display dialog "Source and destination directories cannot be the same!" with icon stop
end repeat
end if
log_printf(logfile, "conversion started in operation mode: in_place = %s, inherit_dates = %s.\\n", {in_place, inherit_dates})
-- retrieve target files
log_printf(logfile, "scanning files under %s\\n", srcd)
set pp to _match(my is_AW_v6_SS, scan_AW_files(srcd))
log_printf(logfile, "found %d file(s) to process.\\n", count my pp)
-- process target files
if (count my pp) > 0 then
if in_place then
-- archive the source directory first (zip file name = srcd_YYYY-MM-DDTHH.MM.SS.zip)
set dst to do shell script "src=" & srcd's quoted form & "
dst=\"${src}_$(date +'%FT%H.%M.%S').zip\"
ditto -ck --keepParent --sequesterRsrc \"$src\" \"$dst\"
echo \"$dst\""
log_printf(logfile, "archived source directory in %s\\n", dst)
repeat with p in my pp
set p to p's contents
set q to p & ext
log_printf(logfile, "converting %s => %s\\n", {p, q})
save_AW6SS_as_Numbers2(p, q, {inherit_dates:inherit_dates})
--do shell script "rm -f " & p's quoted form -- delete the source file [1]
end repeat
else
set slen to count srcd
repeat with p in my pp
set p to p's contents
set q to dstd & (p's text (slen + 1) thru -1) & ext
log_printf(logfile, "converting %s => %s\\n", {p, q})
save_AW6SS_as_Numbers2(p, q, {inherit_dates:inherit_dates})
end repeat
end if
end if
-- completion notice
log_printf(logfile, "process completed for total of %d file(s).\\n", count my pp)
tell me
activate
display dialog "Done " & (count my pp) & " file(s)." giving up after 5 with icon note
end tell
[1] NOT recommended because conversion is not necessarily complete.
end script
tell o to run
end _main
on scan_AW_files(d)
string d : POSIX path of source directory where to start scanning
return list : list of POSIX paths of found files
* query condition is (file name extension = "cwk") OR (file creator type = "BOBO")
script o
property pp : {}
property qq : {}
property rr : {}
tell application "System Events"
tell disk item d
set pp to every folder's POSIX path
repeat with p in my pp
set qq to my scan_AW_files(p's contents)
repeat with q in my qq
set end of my rr to q's contents
end repeat
end repeat
--set qq to every file's POSIX path whose name extension = "cwk" or (creator type = "BOBO" and file type = "CWSS")
set qq to every file's POSIX path whose name extension = "cwk" or creator type = "BOBO"
repeat with q in my qq
set end of my rr to q's contents
end repeat
end tell
end tell
return my rr's contents
end script
tell o to run
end scan_AW_files
on is_AW_v6_SS(f)
string f : POSIX path of source file
return boolean : true if f is AW version 6 WP file, false otherwise
byte[1] = version
byte[5..8] = BOBO
byte[279] (when byte[1] = 0x06) =
0 => draw
1 => word processing
2 => spreadsheet
3 => database
4 => paint
5 => presentation
* byte index is 1-based
set f to f as POSIX file
(* -- 10.5 or later only
return (read f from 5 for 4)'s id = {66, 79, 66, 79} and ¬
(read f for 1)'s id = 6 and ¬
(read f from 279 for 1)'s id = 1
considering case
return (read f from 5 for 4) = "BOBO" and ¬
(ASCII number (read f for 1)) = 6 and ¬
(ASCII number (read f from 279 for 1)) = 2
end considering
end is_AW_v6_SS
on save_AW6SS_as_Numbers2(src, dst, {inherit_dates:inherit_dates})
string src : POSIX path of source file
string dst : POSIX path of destination file
boolean inherit_dates: true for dst to inherit creation and modification dates of src, false otherwise.
* src may equate to dst, in which case src is overwritten
* intermeditate directories in dst will be created as needed if not present
-- get source and destination file
set srcf to src as POSIX file
set dstf to dst as POSIX file
-- open srca in Pages v4 and save it in dstf
tell application "Numbers"
--activate
set k to count documents
open srcf
repeat until (count documents) > k
delay 0.2
end repeat
tell document 1
close saving in dstf
end tell
end tell
-- wait for dst to come into existence
wait_file_exist(dst)
-- set label of destination file to label of source file -- [1]
repeat 3 times -- max retry
try -- [2]
tell application "Finder"
set lbl to item (srcf as alias)'s label index
tell item (dstf as alias)
update
set its label index to lbl
end tell
end tell
exit repeat -- exit if no error
delay 0.5 -- wait some time before retry
end try
end repeat
-- inherit creation and modication dates from src to tmp
if inherit_dates then inherit_file_dates(src, dst)
[1] This is required because Pages does not preserve the original label when saving file.
[2] Finder is such an unreliable beast that it may fail even after the file indeed has come into existence.
end save_AW6SS_as_Numbers2
on wait_file_exist(f)
string f : POSIX path of file
* wait until f comes into existence
do shell script "f=" & f's quoted form & "
until [[ -e \"$f\" ]]; do sleep 0.3; done"
end wait_file_exist
on _match(pat, aa)
handler pat : handler to test elements in aa
list aa : source list
return list : list of every element a of list aa whose pat(a) = true
script o
property |::xx| : aa's contents
property |::yy| : {}
property |::f| : pat
repeat with x in my |::xx|
set x to x's contents
if my |::f|(x) then set end of my |::yy| to x
end repeat
return my |::yy|'s contents
end script
tell o to run
end _match
on log_printf(f, fmt, lst)
string f : POSIX path of log file
string fmt : printf format string
list lst : list of values (if lst is one item list {x}, lst may be x)
* %-26s time-stamp in format %F %T%z is added to the beginning of each entry
local args
set args to "'%-26s'" & fmt's quoted form & " \"$(date +'%F %T%z')\" "
repeat with a in {} & lst
set args to args & (a as string)'s quoted form & space
end repeat
do shell script "printf " & args & " >> " & f's quoted form
end log_printf
on inherit_file_dates(src, dst)
string src : POSIX path of source file
string dst : POSIX path of destination file
* If creation date of src is older than or equal to that of dst,
this will set both creation date and modification date of dst to those of src.
* If creation date of src is newer than that of dst,
this will set only modification date of dst to that of src.
do shell script "src=" & src's quoted form & "; dst=" & dst's quoted form & "
ct=$(stat -f '%SB' -t '%Y%m%d%H%M.%S' \"$src\")
mt=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' \"$src\")
touch -t $ct \"$dst\" # set creation date (<= current creation date)
touch -mt $mt \"$dst\" # set modification date (>= creation date)"
end inherit_file_dates
[CodeBlockEnd:17c5a62c-54d3-4061-ac41-37b7e4ed1ce1]
[CodeBlockStart:e2c458b8-4771-44db-8dab-e6447418de9f][excluded]
--save_AW6_WP_as_Pages4.applescript
Convert AppleWorks v6 WP (word processing) files to iWork'09's Pages v4 files
v0.2
v0.2 -
changed the logging scheme from post-conversion log:
converted x => y
to pre-conversion log:
converting x => y
so that it can help to identify the last file which had caused the applicaton / script to crash.
v0.1 -
initial version
* Tested with Pages 4.0.5 under OS X 10.6.8.
* Specify property in_place in script as necessary.
* Specify property inherit_dates in script as necessary.
* A log file with time-stamp in name is created on desktop.
* Original file name is always preserved except that name extension ".pages" is added
Note that original name extension (.cwk) is NOT removed and thus, e.g., abc.cwk will be converted to abc.cwk.pages
This is to avoid possible data loss in case there're file names, e.g., abc and abc.cwk in a source directory.
_main()
on _main()
script o
property in_place : true
true : convert files in place, i.e. converted files are saved in original directories,
where original source directory is archived in zip file with time-stamp in name in advance;
false : converted files are saved under destination directory which is specified in a dialogue in script
property inherit_dates : true
true : destination file inherits creation date and modification date of source file
false : destination file has creation date and modification date at the time of conversion
property ext : ".pages"
property logfile : (path to desktop)'s POSIX path & (do shell script "date +'save_AW6_WP_as_Pages4.log_%Y%m%dT%H%M%S.txt'")
property pp : {}
-- accept source directory (and destination direcotry if in_place is false)
set srcd to (choose folder with prompt "Choose source directory where source files reside.")'s POSIX path
if srcd ends with "/" and (count srcd) > 1 then set srcd to srcd's text 1 thru -2
if not in_place then
repeat
set dstd to (choose folder with prompt "Choose destination directory where to save converted files.")'s POSIX path
if dstd ends with "/" and (count dstd) > 1 then set dstd to dstd's text 1 thru -2
if srcd ≠ dstd then exit repeat
display dialog "Source and destination directories cannot be the same!" with icon stop
end repeat
end if
log_printf(logfile, "conversion started in operation mode: in_place = %s, inherit_dates = %s.\\n", {in_place, inherit_dates})
-- retrieve target files
log_printf(logfile, "scanning files under %s\\n", srcd)
set pp to _match(my is_AW_v6_WP, scan_AW_files(srcd))
log_printf(logfile, "found %d file(s) to process.\\n", count my pp)
-- process target files
if (count my pp) > 0 then
if in_place then
-- archive the source directory first (zip file name = srcd_YYYY-MM-DDTHH.MM.SS.zip)
set dst to do shell script "src=" & srcd's quoted form & "
dst=\"${src}_$(date +'%FT%H.%M.%S').zip\"
ditto -ck --keepParent --sequesterRsrc \"$src\" \"$dst\"
echo \"$dst\""
log_printf(logfile, "archived source directory in %s\\n", dst)
repeat with p in my pp
set p to p's contents
set q to p & ext
log_printf(logfile, "converting %s => %s\\n", {p, q})
save_AW6WP_as_Pages4(p, q, {inherit_dates:inherit_dates})
--do shell script "rm -f " & p's quoted form -- delete the source file [1]
end repeat
else
set slen to count srcd
repeat with p in my pp
set p to p's contents
set q to dstd & (p's text (slen + 1) thru -1) & ext
log_printf(logfile, "converting %s => %s\\n", {p, q})
save_AW6WP_as_Pages4(p, q, {inherit_dates:inherit_dates})
end repeat
end if
end if
-- completion notice
log_printf(logfile, "process completed for total of %d file(s).\\n", count my pp)
tell me
activate
display dialog "Done " & (count my pp) & " file(s)." giving up after 5 with icon note
end tell
[1] NOT recommended because conversion is not necessarily complete.
end script
tell o to run
end _main
on scan_AW_files(d)
string d : POSIX path of source directory where to start scanning
return list : list of POSIX paths of found files
* query condition is (file name extension = "cwk") OR (file creator type = "BOBO")
script o
property pp : {}
property qq : {}
property rr : {}
tell application "System Events"
tell disk item d
set pp to every folder's POSIX path
repeat with p in my pp
set qq to my scan_AW_files(p's contents)
repeat with q in my qq
set end of my rr to q's contents
end repeat
end repeat
--set qq to every file's POSIX path whose name extension = "cwk" or (creator type = "BOBO" and file type = "CWWP")
set qq to every file's POSIX path whose name extension = "cwk" or creator type = "BOBO"
repeat with q in my qq
set end of my rr to q's contents
end repeat
end tell
end tell
return my rr's contents
end script
tell o to run
end scan_AW_files
on is_AW_v6_WP(f)
string f : POSIX path of source file
return boolean : true if f is AW version 6 WP file, false otherwise
byte[1] = version
byte[5..8] = BOBO
byte[279] (when byte[1] = 0x06) =
0 => draw
1 => word processing
2 => spreadsheet
3 => database
4 => paint
5 => presentation
* byte index is 1-based
set f to f as POSIX file
(* -- 10.5 or later only
return (read f from 5 for 4)'s id = {66, 79, 66, 79} and ¬
(read f for 1)'s id = 6 and ¬
(read f from 279 for 1)'s id = 1
considering case
return (read f from 5 for 4) = "BOBO" and ¬
(ASCII number (read f for 1)) = 6 and ¬
(ASCII number (read f from 279 for 1)) = 1
end considering
end is_AW_v6_WP
on save_AW6WP_as_Pages4(src, dst, {inherit_dates:inherit_dates})
string src : POSIX path of source file
string dst : POSIX path of destination file
boolean inherit_dates: true for dst to inherit creation and modification dates of src, false otherwise.
* src may equate to dst, in which case src is overwritten
* intermeditate directories in dst will be created as needed if not present
-- get source and destination file
set srcf to src as POSIX file
set dstf to dst as POSIX file
-- open srca in Pages v4 and save it in dstf
tell application "Pages"
--activate
set k to count documents
open srcf
repeat until (count documents) > k
delay 0.2
end repeat
tell document 1
close saving in dstf
end tell
end tell
-- wait for dst to come into existence
wait_file_exist(dst)
-- set label of destination file to label of source file -- [1]
repeat 3 times -- max retry
try -- [2]
tell application "Finder"
set lbl to item (srcf as alias)'s label index
tell item (dstf as alias)
update
set its label index to lbl
end tell
end tell
exit repeat -- exit if no error
delay 0.5 -- wait some time before retry
end try
end repeat
-- inherit creation and modication dates from src to tmp
if inherit_dates then inherit_file_dates(src, dst)
[1] This is required because Pages does not preserve the original label when saving file.
[2] Finder is such an unreliable beast that it may fail even after the file indeed has come into existence.
end save_AW6WP_as_Pages4
on wait_file_exist(f)
string f : POSIX path of file
* wait until f comes into existence
do shell script "f=" & f's quoted form & "
until [[ -e \"$f\" ]]; do sleep 0.3; done"
end wait_file_exist
on _match(pat, aa)
handler pat : handler to test elements in aa
list aa : source list
return list : list of every element a of list aa whose pat(a) = true
script o
property |::xx| : aa's contents
property |::yy| : {}
property |::f| : pat
repeat with x in my |::xx|
set x to x's contents
if my |::f|(x) then set end of my |::yy| to x
end repeat
return my |::yy|'s contents
end script
tell o to run
end _match
on log_printf(f, fmt, lst)
string f : POSIX path of log file
string fmt : printf format string
list lst : list of values (if lst is one item list {x}, lst may be x)
* %-26s time-stamp in format %F %T%z is added to the beginning of each entry
local args
set args to "'%-26s'" & fmt's quoted form & " \"$(date +'%F %T%z')\" "
repeat with a in {} & lst
set args to args & (a as string)'s quoted form & space
end repeat
do shell script "printf " & args & " >> " & f's quoted form
end log_printf
on inherit_file_dates(src, dst)
string src : POSIX path of source file
string dst : POSIX path of destination file
* If creation date of src is older than or equal to that of dst,
this will set both creation date and modification date of dst to those of src.
* If creation date of src is newer than that of dst,
this will set only modification date of dst to that of src.
do shell script "src=" & src's quoted form & "; dst=" & dst's quoted form & "
ct=$(stat -f '%SB' -t '%Y%m%d%H%M.%S' \"$src\")
mt=$(stat -f '%Sm' -t '%Y%m%d%H%M.%S' \"$src\")
touch -t $ct \"$dst\" # set creation date (<= current creation date)
touch -mt $mt \"$dst\" # set modification date (>= creation date)"
end inherit_file_dates -
How to launch and run script against safari using selenium webdriver
I am trying to launch and run my selenium webdriver script using safari but its launching safari but not running script. Its throwing belwo error message..
org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 50052 ms
Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_25'
Driver info: driver.version: SafariDriver
at org.openqa.selenium.safari.SafariDriverCommandExecutor.start(SafariDriverComman dExecutor.java:113)
at org.openqa.selenium.safari.SafariDriver.startClient(SafariDriver.java:112)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:110)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:115)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:83)
at org.openqa.selenium.safari.SafariDriver.<init>(SafariDriver.java:73)
at LinkText.setUp(LinkText.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.jav a:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java :12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java: 44)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:7 0)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:5 0)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRefere nce.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunne r.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunne r.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.jav a:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.ja va:197)Hey Reese
You bailed me out, dude! Apparently, my difficulties stemmed from me trying to directly edit /var/cron/tabs/root with pico. Never seemed to bother the other stuff, but it did this time. I am totally inept with vi, the default editor for crontab -e, which is why I had cheated before, and directly edited the /var/cron/tabs/root, el.al., so I had to find out how to
export EDITOR='pico'
in my .bashrc
After having done that, no problem, except for a latent programming logic bug that has reared its ugly head (my script is doing some date manipulation with today's and yesterday's date, and my script crashed and burned on the month change and with stuff related to single-digit date sequence numbers <10).
But, hey, I learned how to reset my default editor, so as to make life easier for me when it comes time to dorking with crontab files, and I learned that when the crontab file says "DO NOT EDIT THIS FILE - edit the master and reinstall," it means it!
Thanx for the troubleshooting hint. -
How to run a script on Oracle server from isqlplus
Hi I am trying to run a script on my workstation from Oracle server through isqlplus workarea. I entered following command and get the following error. i have enabled isqlplus URL by editing web.xml file already. Can please someone help how to run the script?
@http://myaixserver.com:5560/scripts/Databasestartupstages.sql;
SP2-0920: HTTP error 'page not found (505)' on attempt to open URLSo far, you haven't specified your rdbms version and isqlplus behaved differently on a 9iR1, 9iR2 from the one release on 10gR1/R2. on 9i it was a servlet based on a JServ servlet executor machine, meanwhile on 10g it is a J2EE compliant application deployed on an OC4J container, so configuration is different.
You may want to take a look at these references -->
* Starting iSQL*Plus from a URL
* Creating Reports using iSQL*Plus
~ Madrid
Maybe you are looking for
-
Dear all, When we run transaction F110 we have something strange and that we do not understand. For a vendor A, we have 2 sum up for the same vendor which contain several FI documents. Exemple: Is: Proposal: Vendor A:
-
CL_ICCMP_CUCOIREC_IMPL
hello all, i have created business transaction profilr Zservice .and attached this business transcation profile to IC_bt in function profilr of my business role . now when i am try to confirm my BUs Partnet . it throws me error as : Details Severe e
-
LOGON NOT POSSIBLE. ERROR IN LICENSE CHECK -- NO HWid from message Server
We could logon to the EC6 system. I Stopped the EC6 system and started it . It started with License Key Error. the License key was available and was shown in SLICENSE transaction but it was giving LOGON NOT POSSIBLE. ERROR IN LICENSE CHECK. SO I dele
-
I cannot load any webpages unless I am on wifi
Just as the subject says. I was sitting in my house and figured id test it so I turned off Wifi was connected to edge and I get a message that the server cannot be reached and help would be greatly apprecieted. Thanks
-
When performing a restore itunes shows the following: Choose a back up to restore. This will restore only contacts, calendars, text messages, and settings, not the iPhones firmware. instead of having dates of my old restores now, I am only seeing res