Action Directory / Move To File

Install

Shared by dg.account

Script

path = "/Lists/"
list = ["Movies - Favourites", "Novels - Favourites", "Novels - Unfavourites"];

ui.list("Lookup", list, false, lookup);

function lookup(selectedValues) {
	if (selectedValues) {
		range = editor.getSelectedLineRange();
		line = editor.getTextInRange(range[0], range[1]);

		http.request({
			url: "https://hooks.zapier.com/hooks/catch/1158354/93vgr8",
			data: {"path": path, "filename": (selectedValues[0]), "text": line}
		}, function(data) {
		});

		text = editor.getText() // ; IMPORTANT: uncomment this semicolon

		if (range[1] < text.length) {
			editor.replaceTextInRange(range[0], range[1] + 1, "");
		} else {
			editor.replaceTextInRange(range[0] - 1, range[1], "");
		}
	}
}