www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  Scripting    Really basic question about scripting
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
Hi guys,

I haven't been using DBTW for that long (a little under 12 months) and don't have much experience in the scripting side of things... in fact, the only jscripting I've learned has been over the last couple of hours :P

Anywho, I was hoping someone could offer their expertise to assist if possible. Here's my situation - I've made a label form in DBTW so I can print spine labels with call numbers for our book collection. When we catalogue them, we put the dewey + cutter across one line, e.g. "001.1 AAA". What I want to do is write a script so that when I print the report and it goes to the label printer form, it inserts a carriage return wherever there's a blank space solely for it printing out, i.e.

>> 001.1 AAA becomes 001.1[carriage return]AAA and when printed is:
001.1
AAA

I know I could run a batch modify to the records to add the carriage return to each record, but I only want it to work like that when I go to print them out. Now, being clueless when it comes to coding anything in javascript, the following's what I patched together:


onReportInitialize()

var space = "";
var creturn = "\r";

if (space) {
document.write(creturn)
}

The theory is that the report is put into the label printing form when I select "File >> Print", the script looks through the 'Call Number' field, finds a blank space and inserts a carriage return, then prints it out and everyone is happy.

I've tried other stuff, I've trawled the message boards and plenty of javascript sites and I'm stumped with how to get this to work. I can't find any 'scripting and DBTW' documentation to help get me started, as I figure the 'onReport...' command is wrong, and I'm not specifying the box with the content from the records (the name of the box, which has the call numbers, is boxCN, which I specified in the scripting window in DBTW for the form), and for all I know the whole thing could be shot :P

If anyone could help out, it would be much appreciated!!

Sorry for being so vague :P

- Sean B
 
Posts: 8 | Location: Adelaide, Australia | Registered: Wed September 26 2007Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Instead of using scripting, why not use the "Make each word a paragraph" feature (Tools>Box Properties>Paragraphs, 3rd item in the drop-down list)?

Breaking call numbers onto multiple lines is exactly why that feature was implemented.
 
Posts: 217 | Registered: Wed June 29 2005Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Hi CDale,

Thanks, that worked a treat! There hasn't been much in the way of training beyond the basic intro stuff available to me since I started using it a little under 12 months ago, hence why I must have overlooked this feature.

Thanks again!

- Sean B
 
Posts: 8 | Location: Adelaide, Australia | Registered: Wed September 26 2007Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  Scripting    Really basic question about scripting