Create folders using exporting script

Hi guys, i’m in a hurry right here.

I need to create an script to export all the images to a specific folder and to do the same with the JS and the videos.

I tried to modify the Sizmek script, but i get nothing from it. I really need a hand on this, can you help me guys?

Ha Ha, I don't know if I'm much help here, as I too have the same problem. (I'm using JXA, which makes it even more confusing, as the Hype example scripts are in Python.)

Yet, I took a look at it this morning. I just (yesterday) learned how to write files with JXA, but I'm not sure how to create directories yet. And since you're probably not using JXA, maybe this is a solution...

I'm not familiar with Python, but it seems like you could just run the terminal command in your Python script...

...but I imagine there's a more elegant way to do that.

Eh, best I can do right now... I just woke up and I'm about to head out. :smiley:

It’d be useful to know if there was a particular spec you had on the final structure.

Hype 3.6’s Export Scripts do have the ability to place resources in different paths/subpaths. This is done in the replace_url call. There’s actually an example of putting items in js, img, and misc folders in the SampleExportScript. The code there looks like:

	elif args.replace_url != None:
		url_info = {}
		url_info['is_reference'] = bool(distutils.util.strtobool(args.is_reference))
		if args.should_preload != None:
			url_info['should_preload'] = bool(distutils.util.strtobool(args.should_preload))
		
		if int(args.url_type) == HypeURLType.ResourcesFolder:
			url_info['url'] = "."
			pass
		elif (int(args.url_type) == HypeURLType.HypeJS):
			url_info['url'] = "js/" + args.replace_url
		elif (int(args.url_type) == HypeURLType.Resource):
			if args.replace_url.lower().endswith(('.png', '.jpg', '.jpeg', '.gif', '.svg', '.psd', '.pdf')):
				url_info['url'] = "img/" + args.replace_url
			else:
				url_info['url'] = "misc/" + args.replace_url

		else:
			url_info['url'] = args.replace_url
				
		exit_with_result(url_info)

You should be able to use subfolders in the url return field, so it could be "media/images/" + args.replace_url for those values.

Happy to help further if you need more assistance!

1 Like

A post was split to a new topic: Export Script argument parsing

That’a awesome, thanks Jonathan.

I have a question… Do I really need that EBLoader.js file? I would love not to need it.
How can I control if I want or not the zip file?

Thanks in advance.

If you are working with Sizmek then I believe you need it. I have a vague recollection of testing to see if it could be avoided since it is small and could be inlined, but I think the ad was rejected from Sizmek. However my memory could be faulty :slight_smile:.

If you aren’t dealing with Sizmek you should not use it, but you also probably shouldn’t be starting from the Sizmek export script as that has many sizmek-isms!