Explore the community Forums Lectora Lectora Questions & Answers Variables – Save as Library Object – Is This Possible

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #329712 Score: 0
    Profile photo of TxLady
    TxLady
    Member
    beginner
    intermediate
    advanced
    contributor
    wise owl
    curious george
    1 pt
    @TxLady

    Is is possible to save a Variable as a library object to use across multiple titles?  I can’t seem to find where I can do that.  I keep having to create the same variable over and over.

    #329717 Score: 1
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    I don’t think it’s possible with a library object per se, however,  if you find that you have multiple variables that you use a lot I can think of 2 ways to get them into a new project without having to go through the Tools interface.

    Method 1. Create all the variables and then save the project as a template.

    Method 2. Edit the .awt file to add your own pre-built variables in Lectora’s xml format. Explained below. Before you say it’s too difficult, try it, it’s easier than it seems and will save you a ton of time of you do not want to go the template route.

    Create the XML for the variables in something like notepad.  Note in the example below I explained the tags in parentheses, do not include the explanations. It follows this format:

    <variabledata> (This is the opening tag)
    <variable id=”901″> (This is the opening variable tag and includes the id attribute. Every variable needs a unique id. I suggest starting at 900)
    <name>student1</name> (The variable names goes between the name tags)
    <initialvalue>Brad Pitt</initialvalue> (The initial Value)
    </variable> (This closes the variable)
    <variable id=”902″>
    <name>student2</name>
    <initialvalue>Angelina Jolie</initialvalue>
    </variable>
    <variable id=”903″>
    <name>student3</name>
    <initialvalue>Blake Lively</initialvalue>
    </variable>
    <variable id=”904″>
    <name>student4</name>
    <initialvalue>Ryan Reynolds</initialvalue>
    </variable>
    </variabledata>

    1. Open a new project do nothing but name it, save and close. Open the .awt file with a text editor (like notepad).
    2. Normally variables are found between <variabledata> & </ variabledata> tags however since this project does not have any variables yet you will only find a single tag <variabledata /> (Notice the slash / is after the word variabledata in this empty tag).
    3. Copy your xml, highlight the <variabledata /> line and paste your code over it. Save the .awt and close.
    4. If you followed these steps correctly, when you open the .awt in lectora and look in Tools – Variables you should see all your newly added variables. Use normally.

    DRS

    This post has received 1 vote up.
    #329745 Score: 2
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    I think if you create an External HTML Object and attach variables to it (make them required), you can save the Ext HTML object as a library object and it will carry the variables with it.

    This post has received 2 votes up.
    #329777 Score: 1
    Profile photo of Lazaro Perez
    Lazaro Perez
    Member
    beginner
    intermediate
    curious george
    wise owl
    friend finder
    contributor
    profile
    Group Member
    picture perfect
    advanced
    28 pts
    @sirwise23

    Sergey is correct from what I recall.

    If you create an empty text block and attach actions to it that touch that variable, you can save that object to the library.

    If you insert that object it will create all the variables it touches as well.

    This post has received 1 vote up.
    #329845 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    If either of you can get that to work, please post an example. I’ve tried many variations with no success.

    #329874 Score: 0
    Profile photo of TxLady
    TxLady
    Member
    beginner
    intermediate
    advanced
    contributor
    wise owl
    curious george
    1 pt
    @TxLady

    Wow!  I got the experts on this one.  I’m impressed.  I will try the object with the variables attached first as it will be easiest.  I will be using it today and see if it works.  If not – I’ll go with the XML version.  In reading it, I can see it’s not difficult – just looks worse than it is.

    Thank you everyone who weighed in!

    #329900 Score: 2
    Profile photo of Lazaro Perez
    Lazaro Perez
    Member
    beginner
    intermediate
    curious george
    wise owl
    friend finder
    contributor
    profile
    Group Member
    picture perfect
    advanced
    28 pts
    @sirwise23

    Attached is a video of this working.

    This post has received 2 votes up.
    #329904 Score: 0
    Profile photo of TxLady
    TxLady
    Member
    beginner
    intermediate
    advanced
    contributor
    wise owl
    curious george
    1 pt
    @TxLady

    Well I’ll be darned.  Great idea!  I had just opened Lectora to start my project and try it.  I watched your video.  Wonderful!  There are so many really smart people out here to help people like me look better than we really are.  Thank you so much!  I love this community!!

    #329933 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    Awesome, Lazaro! Thank you so much for the post. When I copied what yo did it worked perfectly. LOL, I spent about two hours trying different combos of html extension objects, text boxes, required variables, etc.. nothing worked. I still have no idea what I was doing wrong but with your (and credit to Sergey too) help all is good.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.