QScript Slot
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. Moving or resizing a slot moves the items in it on every page that uses the master, except items the user has moved themselves.
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.
| obj | The object to compare against. |
| Returns: | true or false |
| Example: | data_file.getQuestionByName('Q2').equals(data_file.questions()[0])
|
group
The page master this slot belongs to.
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
Get/set the height of the slot in pixels, which must be a positive number. A text slot whose vertical alignment is 'Resize to fit text' works its height out from its text and would not keep a height set on it, so setting it on such a slot throws and leaves the slot unchanged. Set width instead; the height then follows the text.
left
Get/set the left (X) position of the slot in pixels.
| Example: | var master = project.pageMasters.subItems.find(function (m) { return m.internalName === 'Item'; });
var content = master.subItems.find(function (i) { return i.slotType === 'Content'; });
content.left = 50;
content.width = 860;
|
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
Get/set the top (Y) position of the slot in pixels.
type
Returns "Slot".
width
Get/set the width of the slot in pixels, which must be a positive number.