QScript Slot

From Q
Jump to navigation Jump to search

Slot

A slot on a page master — a placeholder position an item can occupy. A cut-down analysis item: it exposes on-page pixel geometry and a slotNumber. Put an item into this slot by setting the item's slotNumber to this slot's slotNumber.

deleteItem()

Deletes this slot from the page master. Every page that uses the master loses the slot; a page that already holds an item in the slot keeps that item. Deleting one of the slots that the six built-in page masters come with throws "You may not remove a slot that a built-in page master comes with." — copy the master with project.pageMasters.copyAfter and delete the slot from the copy instead.
Example:
var master = project.pageMasters.subItems.find(function (m) { return m.name === 'Layout 1'; });
var slots = master.subItems.filter(function (i) { return i.type === 'Slot'; });
slots[slots.length - 1].deleteItem();

equals(obj)

Whether two objects are the same.
objThe object to compare against.
Returns:true or false
Example:
data_file.getQuestionByName('Q2').equals(data_file.questions()[0])

guid

The slot's GUID — its durable identity. Prefer this over slotNumber to track a slot, as a slot number can be reused when a slot is deleted.

height

The height of the slot in pixels.

left

The left (X) position of the slot in pixels.

slotNumber

The slot's number. Assign this to an item's slotNumber to place the item in this slot.

slotType

The kind of item the slot holds: 'Title', 'Content' or 'Text'.

top

The top (Y) position of the slot in pixels.

type

Returns "Slot".

width

The width of the slot in pixels.