Announcing the new Datavyu v1.3.6 with enhanced features and transcription support!

I have about 200 MacSHAPA files and would be happy to somehow post an example of one. Of course, I'm no longer able to open these MacSHAPA files in anything other than a simple text editor, which isn't useful. How can I convert them for use in a more modern application (e.g., OpenSHAPA)?

I did try the following script but was unsuccessful in getting it to run properly without errors. I also had difficulty finding the OpenSHAPA API that is referenced in the answer to that question.

asked 23 Nov '13, 12:24

reising1's gravatar image

reising1
1112
accept rate: 0%

edited 23 Nov '13, 12:28


OpenSHAPA and Datavyu have the same format and you can use your files in both once you can use them in one. So you do not need to do anything additional to your files once you run a script to convert your MacSHAPA files to the OpenSHAPA format. The only difference is that the api for the script depends on which program (Datavyu or OpenSHAPA) you are running the script in. The conversion script for this can be found HERE.

permanent link

answered 18 Dec '13, 14:05

david's gravatar image

david ♦
143235
accept rate: 4%

edited 18 Dec '13, 14:10

Quick check first: Are you running the script to convert files in Datavyu, or in Openshapa? If it's in Openshapa, you'll need to include the API at the top of your script (we can send it to you). However we recommend you use Datavyu as it's the newer version of the software, and for it the API is already included in the program. You just need to include the following line at the top of script:

require 'Datavyu_API.rb'

When you tried running the script, what kind of error did you get? It would help to see both the script you're running and the specific error you're getting.

permanent link

answered 11 Dec '13, 23:18

WhitneyCole's gravatar image

WhitneyCole ♦
417239
accept rate: 21%

I have downloaded Datavyu and copied the script here (http://www.datavyu.org/support/questions/41/how-to-convert-macshapa-files-to-openshapa-files) and included as the first line the "require" line you indicated above. I also ensure I have the appropriate folders on my Desktop as the script indicates. Then, in Datavyu, I run the script via Script --> Run Script, and then the Scripting Console pops up. In that console, I see output "Converting WST 005" however it never prints "Saving WST 005 as OpenSHAPA file" (which, from the script, it should). I waited 10 minutes and still nothing.

(19 Dec '13, 16:21) reising1 reising1's gravatar image

Hm. I'm not sure at first glance why that wouldn't work. Can you post the entire text of the script you're using (just in case) and email me one of your files so I can take a look? My email is in my user profile.

(19 Dec '13, 16:35) WhitneyCole ♦ WhitneyCole's gravatar image

I have posted the script as an answer below.

(19 Dec '13, 16:55) reising1 reising1's gravatar image

The reason the conversion was failing for you is that there were actually two MacShapa file formats; in the version of Datavyu you have, only one of the two types could be loaded via a script. The developers have added scripting support for the second file type and it will be included in the next version of the software.

(14 Jan '14, 13:22) WhitneyCole ♦ WhitneyCole's gravatar image

Hello,

I am in the same boat in regards to wanting to transfer some MacSHAPA files to something newer. I was wondering if there was any difference in converting the files to OpenSHAPA format vs. Datavyu format because I thought that these two had the same format? Additionally, I was wondering if there were already any scripts for this sort of process just so that I could have a better understanding of what needs to be done? Thank you all for the help.

permanent link

answered 17 Dec '13, 11:08

behavior_scientist's gravatar image

behavior_sci...
0113
accept rate: 0%

Here is a script I am running through Datavyu. However, as per my comment above, it only prints out "Converting..." but never "Saving..."

require 'Datavyu_API.rb'

begin

# Edit this to match the directory containing your files.
macshapa_folder = File.expand_path("~/Desktop/MacSHAPA/")
macshapa_files = Dir.new(macshapa_folder)

# Edit this to match where you want to save the openshapa folders.
openshapa_folder = File.expand_path("~/Desktop/OpenSHAPA/")
if (!File::directory?(openshapa_folder))
    Dir.mkdir(openshapa_folder) # Make this dir if it doesn't exist
end

for f in macshapa_files.each()
 # Filter out files we don't want
     if (f[0].chr != '.') # Filter out the hidden files like . and .. and .DSSTORE
         puts "Converting " + f
         # Load the file and don't draw it to the screen
         $db, proj = load_macshapa_db(macshapa_folder + '/' + f, false)
         puts "Saving file " + f + " as OpenSHAPA file."
         save_db(openshapa_folder + '/' + f + ".opf")
     end
end

end
permanent link

answered 19 Dec '13, 16:56

reising1's gravatar image

reising1
1112
accept rate: 0%

Ok, your script looks fine. I was unable to open the MacSHAPA file you sent in MacSHAPA, but I opened it as a text file to look at how the file was structured. It does not seem to be set up the same way our old MacSHAPA files are. It might be that the existing script is unable to parse your files. I'll have to look into this further and get back to you.

(19 Dec '13, 17:26) WhitneyCole ♦ WhitneyCole's gravatar image

Really? I thought this file was from MacSHAPA. Any ideas what type of file this is? How are you able to open it in MacSHAPA? Do you have a super super old Mac?

(19 Dec '13, 19:02) reising1 reising1's gravatar image

Hello,

I have my script working (thanks to David) and am trying to just add one more thing to it. I have multiple folders and subdirectories with MacSHAPA files in each folder that I would like to be able to convert them to the OpenSHAPA/Datavyu format and place them automatically back into their appropriate folders/subdirectories without having to have all of the MacSHAPA files in the root directory. I've been trying to use the Dir.glob command but can't figure out what file extension to use with the MacShapa files since they are Unix Executable Files. Any help is much appreciated, thank you

(24 Dec '13, 11:55) behavior_sci... behavior_scientist's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×3
×2

question asked: 23 Nov '13, 12:24

question was seen: 7,909 times

last updated: 14 Jan '14, 13:22

powered by OSQA