Page 1 of 1

Including Filename & External Data

Posted: Fri Feb 03, 2006 4:24 pm
by Diglet
Hello,

I am creating product pages for a website. There are thousands of beads - Each one has an img file, and a .doc file (containing that particular bead's description). The img file names are the same as the .doc names, reflecting the particular beads product # - For example, bead #11145 is shown in img file 11145.jpg, and described in 11145.doc. I have a basic template setup for these pages, say 11145.html. I can't seem to get Find & Replace to take 11145.html, and insert it's filename (11145) into the HTML (ex: img src=FILENAME, and Description: [inserted from 11145.doc) - Is any of what I'm describing possible to do with this program? Please let me know, thanks!

Posted: Sat Feb 04, 2006 8:06 pm
by Abacre
Hello,

You cannot take description from 11145.doc (in current version of the software)

But you can "take 11145.html, and insert it's filename (11145) into the HTML (ex: img src=FILENAME)"

Please read about "Include File Name into Search Scope" option on the
following page:
http://www.abacre.com/afr/manual/optsbatch.htm
So you should use Batch Replace operation with checked "Include File Name into Search Scope" and "Use regular expression" options.
Then create needed regular expression for this case.

Posted: Fri Feb 10, 2006 3:11 pm
by Diglet
I have tried several times and I simply cannot get this to work. Are there settings I should change, or any other ways I could try to do this? Please let me know, thank you!

Posted: Fri Feb 17, 2006 8:06 pm
by Diglet
So there's no way to fix this?

Posted: Mon Mar 20, 2006 2:15 am
by wckc
I can't get this to work either. I don't even need to do anything as complicated as their example.

I just want to add the complete file name to the end of text in the file.

Text: XXXXXXX.com/ +FILENAME

:cry:

Posted: Mon Mar 20, 2006 11:43 am
by Abacre
Wally,

Do you work with Word/Excel files or with text files (TXT, HTML, ASP
or others)?
Adding file name to the end of file is quite easy task.
What you you mean in your example:
Text: XXXXXXX.com/ +FILENAME

What is source text of the file and what text should be after
transformation (adding filename).
Do you need to add only file name or full path + file name?

Posted: Mon Mar 20, 2006 1:44 pm
by wckc
I am working with .html files named, p3712.html, p3713.html, p3714.html etc. (I don't need the path)

I want to change the contents of each of the files, adding the file name to the end of http://www.booksofthebible.com. All files have the same content.

All Files
From:
<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com");
exit();
?></HTML>

file p3712.html
To:
<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3712.html");
exit();
?></HTML>

file p3713.html
To:
<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3713.html");
exit();
?></HTML>

etc..

Thank you in advance,

Wally

Posted: Mon Mar 20, 2006 2:24 pm
by Abacre
The last question: could you type resulting files (after replace) based on your source files?

Posted: Mon Mar 20, 2006 2:36 pm
by wckc
The to: was the contents of the result files:

These are the result files

p3712.html This is the file name

To: this is the result I want

<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3712.html");
exit();
?></HTML>

p3713.html This is the file name

To: this is the result I want

<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com/p3713.html");
exit();
?></HTML>

I'm starting out with the generic

<HTML><?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.booksofthebible.com");
exit();
?></HTML>

Wally

Posted: Mon Mar 20, 2006 7:18 pm
by Abacre
Ok. Step-by-step instructions:

Go to main menu - Action - Options - Batch Replace
check "Include file name into search scope"
check "Modifier S"
check "Modifier G"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
.*\\(.*html)\r\n(.*Location: http://www\.booksofthebible\.com)

Replace with:
\r\n$2/$1

That's all I verified it works perfectly.

Posted: Mon Mar 20, 2006 8:01 pm
by wckc
:) Thanks Roman, it does work. What did I just do?

Do you have any directions anywhere for the modifiers and what does \r\n$2/$1 do?

It's not clear how to use this program unless there is more to "help" than I am seeing.

Thanks again for making my liofe a little easier. I spent a few hours trying to figure this out without success.


Wally