MacResource
Ambitious but can it be done? - Printable Version

+- MacResource (https://forums.macresource.com)
+-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1)
+--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3)
+--- Thread: Ambitious but can it be done? (/showthread.php?tid=67853)

Pages: 1 2


Ambitious but can it be done? - Mac1337 - 12-08-2008

I'd like to search inside a text file, find all instances that end with .png(like fig1.png, etc), then go find that file in the same directory and copy it to another folder. Some kind of automator action perhaps.


Re: Ambitious but can it be done? - Seacrest - 12-08-2008

shell script, yeah. automator, likely.


Re: Ambitious but can it be done? - Mac1337 - 12-08-2008

Seacrest wrote:
shell script, yeah. automator, likely.

Well, I know little about either.


Re: Ambitious but can it be done? - mikebw - 12-08-2008

Just open up Automator and give it a try. It can record your actions. I would suggest working on a copy of our files first just in case things go awry.


Re: Ambitious but can it be done? - Seacrest - 12-08-2008

IIRC, Dreamweaver can do this kind of thing.


Re: Ambitious but can it be done? - Doc - 12-08-2008

AppleScript or Perl... hmm... 'might be easier to use AppleScript and TextEdit...

How are the image files referenced? Is it a simple list, one to a line or is it more like a note that talks about the files?


Re: Ambitious but can it be done? - mattkime - 12-09-2008

what is the format of the file?

sounds like a job for perl but i think we can find a "simpler" way to do it


Re: Ambitious but can it be done? - Mac1337 - 12-09-2008

mattkime wrote:
what is the format of the file?

sounds like a job for perl but i think we can find a "simpler" way to do it

They appear in lines like this,

\includegraphics[width=2.3in,height=2.2in]{Lena.png}

They are all .png but file name can be anything. So I start searching for references to .png files like above Then must look for the Lena.png which is in the same folder and copy it to another folder. The solution must be somehow OS-based. Can't learn Perl.


Re: Ambitious but can it be done? - Seacrest - 12-09-2008

How many files and images are we talking here?
If it's a lot, you're either gonna have to learn perl|python|ruby|php and regex syntax, else hire someone who has and can whip up a script for you quickly.
It's not an impossible task, and there may be a GUI utility out there that can accomplish it, but I think this calls for the full geekdom.
It may be worth a couple of bucks to hire someone of elance or craigslist gigs if your time is valuable.


Re: Ambitious but can it be done? - Mac1337 - 12-09-2008

It is one of those one off jobs. I can do it by hand in half an hour perhaps. Just tedious work. What about Automator?