Skip to content

Instantly share code, notes, and snippets.

@paveljurca
Last active November 27, 2017 14:59
Show Gist options
  • Save paveljurca/da1360b2353273fcf9e984f2d4affdd9 to your computer and use it in GitHub Desktop.
Save paveljurca/da1360b2353273fcf9e984f2d4affdd9 to your computer and use it in GitHub Desktop.
sub ms32_vbs_filedialog {
# let's just see if it works
my $VBScript =<<'EOF';
Set shell = CreateObject("Shell.Application")
Set mediasite = shell.BrowseForFolder(0, "Pick up your Mediasite presentation folder", 0, "%USERPROFILE%")
WScript.Echo """" & mediasite.self.Path & """"
EOF
# cannot do while 'unix2dos' in use!
# $VBScript =~ s|\n|\r\n|;
open my $cscript, ">:utf8", undef or die;
print $cscript $VBScript;
close $cscript;
chomp(my $path = qx(cscript.exe $cscript //E:VBScript //Nologo));
die unless -d $path;
return $path;
}
'set up a file dialog
Set shell = CreateObject("Shell.Application")
Set mediasite = shell.BrowseForFolder(0, "Pick up your Mediasite presentation folder", 0, "%USERPROFILE%")
'return full path for the selected folder
WScript.Echo """" & mediasite.self.Path & """"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment