Script to Search and Print
Hi.
I would like to automate the search of a pdf document and the subsequent printing (or extraction) of all the pages on which the searched text appears. I think a script would be appropriate but I have no idea where to begin, Can someone help me with this? I deal routinely with large, mostly text pdf documents where I need to print many non-sequential pages.
Thanks
this piece of script will help you get there:
[code]
set search_for to "part" ---search for this name
set search_here to POSIX path of (path to desktop folder) as string ---- too much to handle
set search_here to "/Users/timmason/Desktop/spotlight scripts/csacsacs/alta__001 copy 2.pdf" ------file to search -not working
set search_here to "/Users/timmason/Desktop/spotlight scripts/csacsacs/" ------folder to search
display dialog searcher(search_for, search_here) ---returns location of doc
on searcher(search_for, search_here)
set the_script to {"mdfind -onlyin '", search_here, "' '", search_for, "'"} as string --converted for vars
set the_text to (do shell script the_script)
set num_records to count of paragraphs in the_text
set x to 0
set all_recs to ""
repeat num_records times
set x to x + 1
set all_recs to all_recs & return & return & paragraph x of the_text
end repeat
return all_recs
end searcher
Similar Messages
-
Script to search and relink linked image files that were moved?
Good afternoon
My indesign product catalog has links with a lot of different folders around in my hard disk, not a single folder. And to keep my catalog up to date I must package it.
When I move my linked files in my computer because I change the folder structure or do some cleaning, my indd loses track of its linked files. Currently I need to relink one by one.
Therefore I would like to find a script which would scan the hard disk with the all broken links in mind to detect their new location and relink. Yes I am a lazy person.
Thanks for any clue,Thanks so much! I will try soonest.
How does your script react in the unlikely case of duplicates?
Date: Thu, 18 Jun 2009 12:43:47 -0600
From: [email protected]
To: [email protected]
Subject: Script to search and relink linked image files that were moved?
At least your honest about your laziness.... Here's your reward:
Just a hint, don't select root of your volume, it will loop through every folder in existence, but key to this script is, if you know the general location, select into that folder hierarchy and the script will test for a relative path, otherwise, come back in a few days, and it will be finished.
~mike
var processed = 0
var skipped = 0
var updated = 0
if (app.documents.length > 0){
if(app.activeDocument.links.length > 0){
var mydoc = app.activeDocument;
var mylinks = mydoc.links;
var myRoot = Folder.selectDialog("Choose the volume or server where assets are located", undefined, false);
main();
else
{ alert("No Links present")
else{alert("No Documents Open")
function main(){
if(myRoot != null){
for(var i = 0; i < mylinks.length ; i++){
if(mylinks.item(i).status == LinkStatus.linkMissing){
var linkdata= mylinks.item(i).filePath;
var my_result = linkRepair(linkdata);
if (my_result == false){
var filetype = "." + mylinks.item(i).linkType;
var mysearch = search(linkdata, filetype);
if(mysearch != undefined){
var myswitch = confirm(mylinks.item(i).name + " has been found in a different location, Relink and Update?", "Relinker")
if(myswitch){
mylinks.item(i).relink(File(mysearch));
mylinks.item(i).update();
else{
alert("" + mylinks.item(i).name " was not found\nFolders processed: "processed + "\nFiles skipped: "+ skipped)
else{ alert( my_result + " has been found");
mylinks.item(i).relink(File(my_result));
function linkRepair(linkdata){
var mypath = linkdata.split(":")
my_status = analyzePath(mypath)
if(my_status == true){alert("UPDATED");
updated++
return my_status
function analyzePath(mypath){
var num = mypath.length ;
for(var i = 0; i < num-1; i++){
mypath.shift()
var newpath = pathRebuild(mypath)
newpath = (myRoot + newpath)
if(File(newpath).exists){
return newpath
return false
function pathRebuild(pathArray){
var solidPath = ""
for(var i = 0; i < pathArray.length ; i++){
solidPath += "/" + pathArray+ ;
return solidPath;
function search(linkdata, filetype){
var mypath = linkdata.split(":")
var mylink = mypath.pop();
var OK = confirm("Relative Path does not exist, search folder hiearchy for file?", true, "File Scanner")
if(OK){
var myscanresult = getfiles(mylink, myRoot)
return myscanresult
function getfiles(mylink, myBase){
myBase = Folder(myBase);
var files = myBase.getFiles("*")
for(var i = 0; i < files.length; i++){
try{
var foldertest = files+.getFiles();
processed++
var myfile = File(files+ + "/" + mylink)
if(myfile.exists == true){
return myfile
break;
else{
var myscan = getfiles(mylink, Folder(files+))
if(myscan != undefined){
return myscan
break;
catch(myerror){
skipped++
> -
Windows 7 GPO Script - Enable file and printer sharing
Hello,
I'm trying to activate the Advanced File and Network sharing bia script (as there is no GPO option to do this)
The script is simple :
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
netsh advfirewall firewall set rule group="network discovery" new enable=yes
netsh advfirewall set currentprofile state on
in .bat and .ps1 it works fine when logged in to a computer with admin rights. I want to run this script on the computer level via GPO. The GPO applies properly, but the settings aren't changed. Any ideas on getting this to work?
Environment is the following :
DC is WinServ 2008 R2, test machines : Win 7 Pro x64
Test OU with Inheritance disabled, GPO for testing enforced with no other parameters apart from this Computer Startup script. User and Computer account are in the Test OU.
gpresult shows the GPO is applied, but no data is available under Computer or User configuration. the script is stored in the correct sysvol location.Hi,
Checkout the below thread on similar discussion,
http://social.technet.microsoft.com/Forums/en-US/b193e8a9-9b2a-4993-bd74-836c65c51dc3/gpo-with-a-startup-script-is-not-working
Regards,
Gopi
www.jijitechnologies.com -
Running scripts from Finder, and printing without a dialog
Two questions:
1. I need to launch an InDesign script from outside of InDesign -- such as launching the script from the finder (Mac) and having it run in InDesign. How can I do this?
2. How can I script printing a document so that it automatically prints, bypassing the Print dialog box that a user would need to click on (I want it to print automatically in the background without the user doing anything)?1. Just save your script as an application and wrap your stuff in an "on run" statement.
on run
tell application "Adobe InDesign"
--do stuff
end
end
See the Applescript Language Reference at developer.apple.com/applescript for more info.
2. Yup. The "do stuff" in your case will probably look something like this:
tell active document
--Set up options, assumes you have created a printer preset
-- with the output options you want
set active printer preset of print preferences to "my printer preset"
set page range of print preferences to all pages
--And then print
print without print dialog
end -
Log file audit script to search and collect
Hi guys,
I'm trying to figure out the best way to complete this log file audit, so I would like to scripted, but can't seem to get a grasp on it and how best to do it. I need to search for the log files (all log files OS and App logs) on a few dozen systems on a
few different drives per system. I'm looking to collect the log location, name, size, last log file event in that log and then export info that to a CSV file and email it to myself monthly to report on.Please read the following:
Posting guidelines
Handy tips for posting to this forum
How to ask questions in a technical forum
Rubber duck problem solving
How to write a bad forum post
Help Vampires: A Spotter's Guide
-- Bill Stewart [Bill_Stewart] -
Binary Tree search and print methods
Hello, I'm trying to create a binary tree from inputs of a user. I believe I have the tree set up right because it shows no errors, but I'm getting an error message with a line of code. I cannot figure out what I am doing wrong. Also, I need to create a print method, which prints the tree's entries and a search method which would search the tree for certain record.
public class TreeNode
public static String empName = null;
public static int empNumber;
public static String nextRec = null;
TreeNode left;
String Name;
int Number;
TreeNode right;
public static void main(String[] args)
VRead in = new VRead();
VWrite out = new VWrite();
System.out.println("Enter Choice: ");
System.out.println("A: Enter Employee Information.");
System.out.println("B: Search For Employee.");
System.out.println("C: Print Entire Tree.");
System.out.println("D: Exit.");
System.out.println("_______________________________");
char command = in.readChar();
System.out.println();
switch (command)
case 'A':
case 'a':
inputInfo(in, out);
break;
case 'B':
case 'b':
break;
case 'C':
case 'c':
break;
case 'D':
case 'd':
System.exit(0);
break;
public static void inputInfo(VRead in, VWrite out)
out.write("Enter Employee Name: ");
empName = in.readString();
out.write("Enter Employee Number: ");
empNumber = in.readInt();
System.out.println();
System.out.println();
System.out.println("Enter Choice: ");
System.out.println("A: Enter Employee Information.");
System.out.println("B: Search For Employee.");
System.out.println("C: Print Entire Tree.");
System.out.println("D: Exit.");
System.out.println("_______________________________");
char command = in.readChar();
System.out.println();
switch (command)
case 'A':
case 'a':
inputInfo(in, out);
break;
case 'B':
case 'b':
break;
case 'C':
case 'c':
break;
case 'D':
case 'd':
System.exit(0);
break;
public TreeNode(String empName, int empNumber)
Name = empName;
Number = empNumber;
left = null;
right = null;
public class Tree
TreeNode Root;
public void Tree(String RootNode)
// Errors come from next line
Root = new TreeNode(RootNode, Name, Number);
public void Insert(String Name, int Number)
InsertNode(Root, Name, Number);
public void InsertNode(TreeNode t, String empName, int empNumber)
if (t == null)
t = new TreeNode(empName, empNumber);
else
if (empName.compareTo(t.Name) < 0)
InsertNode(t.left, empName, empNumber);
else if (empName.compareTo(t.Name) > 0)
InsertNode(t.right, empName, empNumber);
else if (empName.compareTo(t.Name) == 0)
System.out.println("Entered node that was already in Tree");
}im sure its something simple, i seem to always look over the small stuff. But i could really use some help on the print and search method tooJust having a quick look over it, and it looks like you are trying to add an extra argument in the TreeNode() method (unless there is a bit of overloading and there is a second treenode method in there) As it is TreeNode only accepts two argumets you have 3
As for printing the tree you would need to flatten it, that is an in order traversal of the tree.
FWIW
I just finished a project at uni that involved at frist writing a BST and then an AVL tree. the full point of these things seems to be to keep students awake at night*
*Before anyone flames, it's a joke
G -
Searching and printing from address book
Is there a way to do a find or sort on an address book field? That is, I'd like to find within "all" or a specific group which entries have (or don't have) an e-mail address associated with it. I'm aware that I can choose fields to display when printing, but it's not quite what I need. Is this a case for scripting or exporting? Or am I overlooking something really obvious? Thanks for any tips.
Sorry, you can't do that. You can only search for text found in a name field for a card or group of cards, not for anything else.
Mulder -
Apple script to search and replace in notes
I'd much appreciate such script or any suggestions as how to achieve that. I have hundreds of notes and decided to change my tagging system.
Thanks a loT!Well, color me confused. But if you're just concerned about Mail notes, here's a script that uses the example you gave above.
if application "Mail" is running then
-- mail should not be running when you use this script
display alert "Whoops!" message "Please quit Mail.app before running this script" as critical
return
end if
tell application "Finder"
-- locate the correct mail folder for the given account
try
set accountFolder to folder "[email protected]" of folder "V2" of folder "Mail" of folder "Library" of home
on error
-- folders changed from snow leopard to lion, check the folder hierarchy visually
display alert "Whoops!" message "something's wrong with the folder hierarchy." as critical
open folder "Mail" of folder "Library" of home
return
end try
tell accountFolder
with timeout of 600 seconds
-- gather notes file references. set a long timeout because this can take a while if there are a large number of notes
set theNotes to (every file of (entire contents of folder "Notes.mbox") whose name extension is "emlx") as alias list
end timeout
end tell
end tell
-- set up keywords to be swapped out here.
set swapPairs to {{"#essay", "kbEssay"}, {"#another key", "its replacement"}}
repeat with thisNote in theNotes
-- open and read the emlx file into a variable
set fp to open for access thisNote with write permission
set noteHTMLText to read fp
-- loop through the swap pairs making replacements
repeat with thisPair in swapPairs
set noteParts to tid(noteHTMLText, first item of thisPair)
set noteHTMLText to tid(noteParts, second item of thisPair)
end repeat
-- zero out the file and replace with the revised text
set eof fp to 0
write noteHTMLText to fp
close access fp
end repeat
on tid(input, delim)
-- generic text items handler
set {oldTID, my text item delimiters} to {my text item delimiters, delim}
if class of input is list then
set output to input as text
else
set output to text items of input
end if
set my text item delimiters to oldTID
return output
end tid
I've tested this on my laptop and it works, but I STRONGLY suggest that you back up your mail folder before trying it yourself, and (if possible) that you set up a few notes in a little used or dummy account and test it before you run it on your actual notes.
I also make no guarantees about what will happen if these notes are synched to other devices. It probably won't explode your computer, but... -
Search for record in txt and print to console
QairNo: 21, PostCd: 12, Age: 21, Gender: 2, Q1Res: 1, Q2Res: 2, Q3Res: 3,
QairNo: 23, PostCd: 21, Age: 12, Gender: 2, Q1Res: 1, Q2Res: 2, Q3Res: 3,
QairNo: 32, PostCd: 32, Age: 12, Gender: 1, Q1Res: 2, Q2Res: 1, Q3Res: 2, Hi i manage to write the above entry into database.txt
now i need to search and print the particular data i need. For example i enter *21* and it will print all the attribute that belong to it.
Please forgive me i am new to this, i have google for example but i can`t apply them for some reason. Below are my code, thank you for helping out !
public class PollSummary {
public static void main (String args[]) throws IOException {
//int inputQuestionNum= 0;
String key = "QairNo: ";
Scanner input = new Scanner(new FileReader("polldata.txt"));
while(input.hasNextLine()){
System.out.println(input.nextLine());
//System.out.println("Enter the Questionnaire Number to view records");
//inputQuestionNum = Integer.parseInt(entry.nextLine());
while (input.hasNext() && input.findInLine(key) != null)
String fileLine = input.nextLine();
System.out.println(fileLine);
}//end main
}//end classYou should use a map, just use the QuairNo as a key (aside: what is a Quair?)
http://java.sun.com/docs/books/tutorial/collections/interfaces/map.html -
Store+search+view+print inventory,store+search+print rent information
Good morning,
I need some help regarding my Java Project. I was told by my lecturer to do one program[probably java applets] to store all informations about CDs and Videos.
The program should be able to :
1)store,view,search and print the informations of CDs and Videos.
2)store,view,search and print the informations of customers
This are the informations that need to be stored for:
CDs:
1. Title of album
2. artist
3. number of tracks
4. total playing time
5. comments
Videos:
1. Title of video
2. Name of director
3. total playing time
4. comment
For search CDs and Vidoes information, user will key in the artist name(for CDs) and director name (for video)
For the renting section:
1)the employee will be able to key in customer transaction.
2) The customer must be a member to rent the CDs and Videos.If not, he / she must registers first.
3)The transaction will be recorded in terms of the CDs/Videos informations, date of rent,due date and payments.
4)The applet must also can identify which customer that has not pay/not return yet. If he or she does not return yet, he or she wont be able to rent .
Here is some of coding that I have made:
Name:TestRandomAccessFile[only for Videos]
*i dont know how to combine CDs.
*This applet coding only consists of register informations about Videos and View ONLY
//TestRandomAccessFile.java: Store and read data
//using RandomAccessFile
package Store;
import java.io.*;
import java.awt.*;
import java awt.event.*;
import javax.swing.*;
import CHapter9.MyFrameWithExitHandling;
import javax.swing.border.*;
public class TestRandomAccessFile extends MyFrameWithExitHandling
//Create a tabbed pane to hold two panels
private JTabbedPane jtpVideo = new JTabbedPane ();
//Random access file for access the student.dat file
private RandomAccessFile raf;
//Main method
public static void main (STring[]args)
TestRandomAccessFile frame = new TestRandomAccessFile ();
frame.pack ();
frame.setTitle ("Test Random Access File");
frame.setVisible ("True");
//Default constructor
// Open or create a random access file
try
raf=new RandomAccessFile("video.dat","rw");
catch(IOException ex)
System.out.print ("Error: " + ex);
System.exit (0);
//Place buttons in the tabbed pane
jtpVideo.add (new RegisterVideo(raf),"Register Video");
jtpVideo.add (new ViewVideo(raf),"View Video");
//Add the tabed pane to the frame
getContentPane().add(jtpVideo);
//Register video panel
class RegisterVideo extends Jpanel implements ActionListener
//Button for registering a video
private JButton jbtRegister;
//Video information panel
private VideoPanel videoPanel;
//Random access file
private RandomAccessFile raf;
//COnstructor
public RegisterVideo (RandomAccessFile raf)
//Pass raf to RegisterVideo Panel
this.raf=raf;
//Add videoPanel and jbtRegister in the panel
setLayout Pnew BorderLayout ());
add (videoPanel= new VideoPanel(),BorderLayout.CENTER);
add(jbtRegister= new JButton ("Register"),BorderLayout.SOUTH);
//Register listener
jbtRegister.addActionListener(this);
//Handle button actions
public void actionPerformed(ActionEvent e)
if (e.getSource()==jbtRegister)
Video video=videoPanel.getVideo();
try
raf.seek(raf.length());
video.writeVideo(raf);
catch (IOException ex)
System.out.print ("Error:" + ex);
//View video panel
class ViewVideo extends JPanel implements ActionListener
//Buttons for viewing video information
private JButton jbtFirst,jbtNext,jbtPrevious,jbtLast;
//Random access file
private RandomAccessFile raf=null;
//Current Video Record
private Video video = new Video ();
//Create a Video panel
private StudentPanel studentPanel=new StudentPanel ();
//File pointer in the random access file
private long lastPos;
private long currentPos;
//Contsructor
public ViewVideo (RandomAccessFile raf)
//Pass raf to ViewVideo
this.raf=raf;
//Panel p to hold four navigation buttons
JPanel p=new Jpanel();
p.setLayout(new FlowLayout(FlowLayout.LEFT));
p.add(jbtFirst=new JButton("First"));
p.add(jbtNext=new JButton("Next"));
p.add(jbtPrevious=new JButton("Previous"));
p.add(jbtLast=new JButton("Last"));
//Add panel p and studentPanel to ViewPanel
setLayout(new BorderLayout());
add(studentPanel;BorderLayout.CENTER);
add(p,BorderLayout.SOUTH);
//Register listeners
jbtFirst.addActionListener(this);
jbtNext.addActionListener(this);
jbtPrevious.addActionListener(this);
jbtLast.addActionListener(this);
//Handle navigation button actions
public void actionPerformed(ActionEvent e)
String actionCommand=e.getActionCommand();
if(e.getSource() instanceof JButton)
try
if ("First".equals(actionCommand))
if(raf.length()>0)
retrieve(0)l
else if ("Next".equals(actionCommand))
currentPos=raf.getFilePointer();
if (currentPos<raf.length())
retrieve(currentPos);
else if ("Previous".equals(actionCommand))
currentPos=raf.getFilePointer();
if (currentPos<raf.length())
retrieve(currentPos-2*2*Video.RECORD_SIZE);
else if ("Last".equals(actionCommand))
lastPos=raf.getFilePointer();
if (lastPos<raf.length())
retrieve(lastPos-2*Video.RECORD_SIZE);
catch (IOException ex)
System.out.print("Error:"+ex);
//Retrive a RECORD at specific position
public void retrieve(long pos)
try
raf.seek(pos);
video.readVideo(raf);
videoPanel.setVideo(video);
catch (IOException ex)
System.out.print ("Error lagi la wei:"+ex);
//This class contains static method to read and write fixed length //records
class FixedLengthStringTo
//Read fix number of the chracter from DataInput stream
public static String readFixedLengthString(int size;DataInput in)
throws IOException
char c[]=new char [size];
for (int=0;i<size;i++)
c=in.readChar();
return new String(c);
//Write fixed number of chracter (string with padded space
//to DataOutput Stream
public static void writeFixedLengthString (String s,int size, Data.Output out) throws IOException
char cBuffer[]=new char[size];
s.getChars(0,s.length(),cBuffer,0);
for (int i=s.length();i<cBuffer.length;i++)
cBuffer[i]=' ';
String newS=new String (cBuffer);
out.writeChars(newS);
File name:CD
package Kedai;
import java.io.*;
public class CD
private String title;
private String artist;
private String tracks;
private String time;
private String comment;
//Specify the size of four string fileds in record
final static int TITLE_SIZE=32;
final static int ARTIST_SIZE=32;
final static int TRACKS_SIZE=20;
final static int TIME_SIZE=10;
final static int COMMENT_SIZE=40;
//the total size of the record un bytes,a Unicode
//character is 2 bytes size
final static int RECORD SIZE= (TITLE_SIZE+ARTIST_SIZE+TRACKS_SIZE+TIME_SIZE+COMMENT_SIZE);
//Default constructor
public CD()
//Construct with specified data
public CD (String title,String artist,String tracks,String time,String comment)
this.title=title;
this.artist=artist;
this.tracks=tracks;
this.time=time;
this.comment=comment;
public String getTitle()
return title;
public String getArtist()
return artist;
public String getTracks()
return tracks;
public String getTime()
return time;
public String getComment()
return comment;
//Write a CD to a data output stream
public void writeCD (DataOutput out) throws IOException
FixedLengthStringIO.writeFixedLengthString(title,TITLE_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(artist,ARTIST_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(tracks,TRACKS_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(time,TIME_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(comment,COMMENT_SIZE,out);
//Read CD from data input stream
public void readCD(DataInput in) throws IOException
title=FixedLengthStringIO.readFixedLengthString(TITLE_SIZE,in);
artist=FixedLengthStringIO.readFixedLengthString(ARTIST_SIZE,in);
tracks=FixedLengthStringIO.readFixedLengthString(TRACKS_SIZE,in);
time=FixedLengthStringIO.readFixedLengthString(TIME_SIZE,in);
comment=FixedLengthStringIO.readFixedLengthString(COMMENT_SIZE,in);
File name:Video
package Kedai;
import java.io.*;
public class Video
private String title;
private String director;
private String time;
private String comment;
//Specify the size of four string fileds in record
final static int TITLE_SIZE=32;
final static int DIRECTOR_SIZE=32;
final static int TIME_SIZE=10;
final static int COMMENT_SIZE=40;
//the total size of the record un bytes,a Unicode
//character is 2 bytes size
final static int RECORD SIZE= (TITLE_SIZE+DIRECTOR_SIZE+TIME_SIZE+COMMENT_SIZE);
//Default constructor
public Video()
//Construct with specified data
public Video (String title,String director,String time,String comment)
this.title=title;
this.director=director;
this.time=time;
this.comment=comment;
public String getTitle()
return title;
public String getDirector()
return director;
public String getTime()
return time;
public String getComment()
return comment;
//Write a video to a data output stream
public void writeVideo (DataOutput out) throws IOException
FixedLengthStringIO.writeFixedLengthString(title,TITLE_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(director,DIRECTOR_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(time,TIME_SIZE,out);
FixedLengthStringIO.writeFixedLengthString(comment,COMMENT_SIZE,out);
//Read video from data input stream
public void readVideo(DataInput in) throws IOException
title=FixedLengthStringIO.readFixedLengthString(TITLE_SIZE,in);
director=FixedLengthStringIO.readFixedLengthString(DIRECTOR_SIZE,in);
time=FixedLengthStringIO.readFixedLengthString(TIME_SIZE,in);
comment=FixedLengthStringIO.readFixedLengthString(COMMENT_SIZE,in);
I need help in terms of:
1)store,view,search and print the informations of CDs and Videos.
2)store,view,search and print the informations of customers
What should I modify my coding above?What should I do next?Can anyone give me the code since I'm not good enough in creating Java coding.Please. The submission is on 30 SeptemberYou made three mistakes:
1) You posted to a JSP/JSTL forum when asking about applet code. Maybe you should redirect your thread to a more appropriate forum - Like one for Applets or general Java Programming.
2) You waited for the last few days to try tosolve your problem. If you spent time working on it little by little you would be closer to a solution.
3) You begged for someone to do the work for you. Asking for help is one thing. That I was willing to do, even though you posted to the wrong forum, but then you said: "someone do it for me because I am not good enough" which really means: "Someone help me cheat and hand in your work as my own because I am too lazy to do it myself."
If you can't do the work, maybe you should drop the course. -
Search and replace formulas with AppleScript
Thanks to this forum I've found out that it is possible to search and replace text by other text or formulas with AppleScript in Numbers 3.2
Does anybody have a script to search and replace a formula or a part of a formula by another formula or a partial formula.
For example:
I would like to be able to find:
= Table1::$b$3
and replace this by:
= Table1::$b$4De Signature,
Would this approach work for you...
This is a very neat way edit a complex formula in a single cell....
a) Copy and Paste the formula to a new black page in Pages,
b) Do your Find and Replace, then
c) Copy and Paste the formulae back into the cell in Numbers.
It works like a charm.
Here is an example of how I used this approach...
Original cell formulae:
=AVERAGE(
SMALL(OFFSET(K3,1,0,20,1),1),SMALL(OFFSET(K3,1,0,20,1),2),
SMALL(OFFSET(K3,1,0,20,1),3),SMALL(OFFSET(K3,1,0,20,1),4),
SMALL(OFFSET(K3,1,0,20,1),5),SMALL(OFFSET(K3,1,0,20,1),6),
SMALL(OFFSET(K3,1,0,20,1),7),SMALL(OFFSET(K3,1,0,20,1),8))
Final version of formulae:
=AVERAGE(
SMALL(OFFSET(K3,N1,0,20,1),1),SMALL(OFFSET(K3,N1,0,20,1),2),
SMALL(OFFSET(K3,N1,0,20,1),3),SMALL(OFFSET(K3,N1,0,20,1),4),
SMALL(OFFSET(K3,N1,0,20,1),5),SMALL(OFFSET(K3,N1,0,20,1),6),
SMALL(OFFSET(K3,N1,0,20,1),7),SMALL(OFFSET(K3,N1,0,20,1),8))
Find Replace: be cautious with the Find, to ensure it is unique, in my this example ",1,", to avoid changing the" ,1)"
Enjoy... -
Script to search PDFs and print report as to contents
I would like to create a script to help me with the following task, I have minimal experience, but am willing to invest some time on making this work, I just need some help getting started.
I have several thousand PDF files that are not text-searchable right now. I want to use Acrobat Pro 9 to batch process the files through its OCR utility. I would then like to use a script to search for certain keywords (names and dates) and generate a report that lists where those keywords appear.
Is this possible?
Thanks in advance,
Andythis piece of script will help you get there:
[code]
set search_for to "part" ---search for this name
set search_here to POSIX path of (path to desktop folder) as string ---- too much to handle
set search_here to "/Users/timmason/Desktop/spotlight scripts/csacsacs/alta__001 copy 2.pdf" ------file to search -not working
set search_here to "/Users/timmason/Desktop/spotlight scripts/csacsacs/" ------folder to search
display dialog searcher(search_for, search_here) ---returns location of doc
on searcher(search_for, search_here)
set the_script to {"mdfind -onlyin '", search_here, "' '", search_for, "'"} as string --converted for vars
set the_text to (do shell script the_script)
set num_records to count of paragraphs in the_text
set x to 0
set all_recs to ""
repeat num_records times
set x to x + 1
set all_recs to all_recs & return & return & paragraph x of the_text
end repeat
return all_recs
end searcher -
Create a follow up page in scripts using Duplex and Tumble Duplex in print
How to create a follow up page in scripts using Duplex and Tumble Duplex in print mode of scripts ?
it depends upon output device types.
Regards
Prabhu -
I have been searching high and low for this one. I have a vbscript that can successfully perform the function if one file is listed. It does a Wscript.echo on the results and if I run this via command using cscript, I can output to a text file
that way. However, I cannot seem to get it to work properly if I want it to search ALL the files in the folder. At one point, I was able to have it create the output file and appear as if it worked, but it never showed any results when the script
was executed and folder was scanned. So I am going back to the drawing board and starting from the beginning.
I also have a txt file that contains the list of string text entries I would like it to search for. Just for testing, I placed 4 lines of sample text and one single matching text in various target files and nothing comes back. The current script
I use for each file has been executed with a few hundred string text lines I want it to search against to well over one thousand. It might take awhile, but it works every time. The purpose is to let this run against various log files in a folder and
let it search. There is no deleting, moving, changing of either the target folder/files to run against, nor of the file that contains the strings to search for. It is a search (read) only function, going thru the entire contents of the folder and
when done, performs the loop function and onto the next file to repeat the process until all files are searched. When completed, instead of running a cscript to execute the script and outputting the results to text, I am trying to create that as part
of the overall script. Saving yet another step for me to do.
My current script is set to append to the same results file and will echo [name of file I am searching]: No errors found. Otherwise, the
output shows the filename and the string text that matched. Because the results append to it, I can only run the script against each file separately or create individual output names. I would rather not do that if I could include it all in one.
This would also free me from babysitting it and running each file script separately upon the other's completion. I can continue with my job and come back later and view the completed report all in one. So
if I could perform this on an entire folder, then I would want the entries to include the filename, the line number that the match occurred on in that file and the string text that was matched (each occurrence). I don't want the entire line to be listed
where the error was, just the match itself.
Example: (In the event this doesn't display correctly below, each match, it's corresponding filename and line number all go together on the same line. It somehow posted the example jumbled when I listed it)
File1.txt Line 54
Job terminated unexpectedly
File1.txt Line 58 Process not completed
File1.txt
Line 101 User input not provided
File1.txt
Line 105 Process not completed
File2.txt
No errors found
File3.txt
Line 35 No tape media found
File3.txt
Line 156 Bad surface media
File3.txt Line 188
Process terminated
Those are just random fake examples for this post.
This allows me to perform analysis on a set of files for various projects I am doing. Later on, when the entire search is completed, I can go back to the results file and look and see what files had items I wish to follow up on. Therefore, the
line number that each match was found on will allow me to see the big picture of what was going on when the entry was logged.
I actually import the results file into a spreadsheet, where further information is stored regarding each individual text string I am using. Very useful.
If you know how I can successfully achieve this in one script, please share. I have seen plenty of posts out there where people have requested all different aspects of it, but I have yet to see it all put together in one and work successfully.
Thanks for helping.I'm sorry. I was so consumed in locating the issue that I completely overlooked posting what exactly I was needing help with. I did have one created, but I came across one that seemed more organized than what I originally created. Later
on I would learn that I had an error in log location on my original script and therefore thought it wasn't working properly. Now that I am thinking that I am pretty close to achieving what I want with this one, I am just going to stick with it.
However, I could still use help on it. I am not sure what I did not set correctly or perhaps overlooking as a typing error that my very last line of this throws an "Expected Statement" error. If I end with End, then it still gives same
results.
So to give credit where I located this:
http://vbscriptwmi.uw.hu/ch12lev1sec7.html
I then adjusted it for what I was doing.
What this does does is it searches thru log files in a directory you specify when prompted. It looks for words that are contained in another file; objFile2, and outputs the results of all matching words in each of those log files to another file: errors.log
Once all files are scanned to the end, the objects are closed and then a message is echoed letting you know (whether there errors found or not), so you know the script has been completed.
What I had hoped to achieve was an output to the errors.log (when matches were found) the file name, the line number that match was located on in that file and what was the actual string text (not the whole line) that matched. That way, I can go directly
to each instance for particular events if further analysis is needed later on.
So I could use help on what statement should I be closing this with. What event, events or error did I overlook that I keep getting prompted for that. Any help would be appreciated.
Option Explicit
'Prompt user for the log file they want to search
Dim varLogPath
varLogPath = InputBox("Enter the complete path of the logs folder.")
'Create filesystem object
Dim oFSO
Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
'Creates the output file that will contain errors found during search
Dim oTSOut
Set oTSOut = oFSO.CreateTextFile("c:\Scripts\errors.log")
'Loop through each file in the folder
Dim oFile, varFoundNone
VarFoundNone = True
For Each oFile In oFSO.GetFolder(varLogPath).Files
'Verifies files scanned are log files
If LCase(Right(oFile.Name,3)) = "log" Then
'Open the log file
Dim oTS
oTS = oFSO.OpenTextFile(oFile.Path)
'Sets the file log that contains error list to look for
Dim oFile2
Set oFile2 = oFSO.OpenTextFile("c:\Scripts\livescan\lserrors.txt", ForReading)
'Begin reading each line of the textstream
Dim varLine
Do Until oTS.AtEndOfStream
varLine = oTS.ReadLine
Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
Dim colMatches, strName, strText
Do Until oErrors.AtEndOfStream
strName = oFile2.ReadLine
objRegEx.Pattern = ".{0,}" & strName & ".{0,}\n"
Set colMatches = objRegEx.Execute(varLine)
If colMatches.Count > 0 Then
For Each strMatch in colMatches
strText = strText & strMatch.Value
WScript.Echo "Errors found."
oTSOut.WriteLine oFile.Name, varLine.Line, varLine
VarFoundNone = False
Next
End If
Loop
oTS.Close
oFile2.Close
oTSOut.Close
Exit Do
If VarFoundNone = True Then
WScript.Echo "No errors found."
Else
WScript.Echo "Errors found. Check logfile for more info."
End If
End if -
When I try to print from my iPad I see a message "searching for printer" and then "no printer found.". I have a printer application loaded and it finds my wireless printer. How do I get the iPad to do the same so I can print from emails, the web, etc? Thanks
sandrafromsilver spring wrote:
When I try to print from my iPad I see a message "searching for printer" and then "no printer found.". I have a printer application loaded and it finds my wireless printer. How do I get the iPad to do the same so I can print from emails, the web, etc? Thanks
Go to the following link:
http://jaxov.com/2010/11/how-to-enable-airprint-service-on-mac-os-x-10-6-5/
Maybe you are looking for
-
I have my email forwarded to my cell phone via message to [[email protected]]. I do this for the reason that having my emails fetched constantly is a heavy burden on the battery. This works perfectly, except for the fact that the emails come from a d
-
BT Yahoo e-mail Account and MacBook Pro
Hi All This is my very first post, so please be patient if this topic has: 1) Already been covered. The ones I have found seem a bit too technical for me (embarrassing!) 2) Shows I'm a bit of a novice For a number of months now I have been happily
-
I keep getting this error message when logging in on my laptop
-
Plant and Storage Location determination at Item level during Copy control
Hello Freinds, We are experiencing issues within Sales Order creation when the line item is referencing a contract. The plant and storage location is being determined from the contract - this should not be done, we have an enhancement in place for sa
-
IReceivables integeration in r12
Hi, I'm working with iReceivables integeration with r12. I got the implementation guide of iReceivables(pdf) and setting up iReceivables(pdf) to do the setups to integerate in r12. I followed all the setups given in the iReceivables document and its