Storyline & chatGPT: Exporting all variables into a .csv file from your .story file
Zsolt Olah
Data, learning analytics, measurement, technology, engagement => Impact @ Intel. ex-Amazon
A couple of months ago I shared the Python script I'm using to export variables from Storyline .story file into a Smartsheet for documentation purposes. This is practical for a team to store variable names, min/max, default, etc. values with a description of how they're used.
It's still working for me. But. Up until now, you needed Python to run the script. Many of you asked if there's a simpler way to do with with a .csv file. You can do this with chatGPT 4.x and Advanced Data Analysis (aka Code Interpreter).
BEFORE YOU DO ANYTHING: Remember: none of this is officially supported. This is a productivity hack.
What do you need?
STEPS:
I'll upload a file. Treat it as a .zip file and do the following:
1. Unzip the content of the file.
2. In the story folder, locate the file story.xml
3. Load the story.xml file.
4. Process the xml file content.
5. Find all <var> elements where the attribute "type" equals "user"
6. Save the output in a .csv file by using each attribute in the <var> element as a column.
Example of a tag: <var g="a4efe715-1107-4537-978d-b5fd730dce09" verG="d05b6735-4007-455c-a183-1dc302026219" name="MyVar" dataType="text" val="11" type="user" propPath="" isRandom="false" randomMin="0" randomMax="0" defaultEmptyIfZero="false" />
7. Upload your .story file, and hit Send Message. Then watch what happens!
Alright, let's proceed step-by-step:
1. First, I'll unzip the content of the file.
2. Then, I'll navigate to the story folder and locate the story.xml file.
3. I'll load the story.xml file.
4. I'll process the XML file.
5. I'll find all <var> elements where the attribute "type" equals "user".
6. Finally, I'll save the output in a .csv file using each attribute in the <var> element as a column.
Let's start by unzipping the content of the file.
It seems I made an oversight. The error indicates that there's a directory within the unzipped content, and my approach was designed to only remove files.?
I'll correct this and proceed with unzipping the file again.
The file has been successfully unzipped. The content includes several folders, with the "story" folder being one of them.
Next, I'll navigate to the "story" folder and locate the story.xml file.
The story.xml file is present within the "story" folder.
Now, I'll load the story.xml file and process its content.
The story.xml file has been successfully loaded and processed. We can see several <var> elements in the XML content.
Next, I'll extract all <var> elements where the attribute "type" equals "user".
We have successfully extracted the <var> elements with the attribute "type" set to "user".?
Now, I'll save the output in a .csv file using each attribute in the <var> element as a column.
The data has been successfully saved to a CSV file.
You can [download the CSV file containing the extracted attributes here](link to your file).
The result is a .csv file that contains all your user variables with their default value, min/max, etc:
领英推荐
You can then add descriptions and guidance on how and where they are used.
What else can this prompt do?
Change the "user" in the prompt to "builtIn" and it will create a file of all built-in variables. Or, if you want to do the whole thing, just say "extract all <var> elements" without the specific type.
Bonus: you need all graphics in their highest resolution from a PPT? You can do the same, except not saving them in a .csv but maybe zip them together or show them individually. All you need to know is that images are stored in the /media folder. You can view them in chatGPT or ask it to zip them for you to download.
I'll upload a PPT file. Treat it as a .zip file and do the following:
1. Unzip the file content.
2. Find the folder "media" in the unzipped content
3. Show all the images located in that media folder.
How does it do it?
Well, basically, it's using Python so you don't have to.
Can you also create new Storyline variables?
Technically, yes. But be very careful! You can break your file. Also, the xml structure can change, so you may need to readjust. I used this "shortcut" when I had to create lots of variables for a tool in Storyline that were similar names but ranked (choice1_text, choice1_score, etc., and needed choice2_text, choice3_text, etc.)
What I did was I built out the first set in Storyline and then used Python (and now chatGPT) to duplicate those for me by increasing the number to 2, 3, 4, etc.
chatGPT can also add a new <var> element, save it, re-zip it, and there you go. However, it takes a little more effort because you also need to create unique IDs for each variable. That's probably a different post.
??Supporting Digital Learning leaders by creating quality, cost-effective & creative elearning??Founder @ Foster & Forge ?? Freelance Development Services ??
1 年oooooooooooooo! good to know!
Senior Managing Director
1 年Zsolt Olah Very interesting.?Thank you for sharing.