Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Drag and Drop-How to get the url's title?, Name? Description?

24 views
Skip to first unread message

MarceepooNu

unread,
Feb 4, 2010, 4:40:01 PM2/4/10
to
I made a .Hta file that contains some drag and drop (primitive coding, alas).
(see full .hta code at bottom of this posting)
The .hta returns the url of links that are dragged and dropped onto it.
But there's info it doesn't return that I need, and I don't know the right
term to describe what I need that I'm not getting.
To explain by example, if I open a window to this url:
---- http://dotcommunities.codeplex.com/
and I open Windows Explorer to a folder
----- e,g, c:\apps
and I drag the url to that folder, a shortcut file will be created.
The shortcut file will contain the url AND the additional info I want,
which is stored in the shortcut file's name.

Does anyone have any suggestions how I can modify my .hta so that the
message box also returns the info that would be shortcut file's name (except
for the .url at the end)?

Thanks for reading this and for your time and help.

MarceepooNu

--
MarceepooNu

MarceepooNu

unread,
Feb 4, 2010, 4:42:15 PM2/4/10
to
whoops. I omitted the .hta code. Here it is:

<html>
<head>
<title>Drag and Drop, dataTransfer.getData("URL")</title>
<style>
#divTarget {
position: absolute;
left: 50px;
width: 200px;
height: 200px;
background-color: yellow}
</style>
<HTA:APPLICATION
APPLICATIONNAME="Drag and Drop, dataTransfer.getData("URL")"
ID="DragandDropDataTransferGetdata"
VERSION="1.0"/>
</head>

<script language="VBScript">

FullName = replace(DragandDropDataTransferGetdata.commandLine,chr(34),"")
arrFN=split(FullName,"\")
FileName = Trim(arrFN(ubound(arrFN)))
SourceDir=replace(FullName,FileName,"")

Sub Window_OnLoad
'This method will be called when the application loads
'Add your code here
End Sub

Sub subRarCpyThisPrgFile2Pdrv
Dim sHtaPrgFullName
Dim sThisHtaFullNam
Dim sThisHtaFileName
Dim sCmdLine
Dim sRarCopyScriptFullName
Dim sArgFullNameOfFil2bBakdUp
Dim oFSO
Const LOCAL_BACKUPDIR = "L"
Const SVR6_BACKUPDIR = "SVR6"
Const SCRIPT_TYPE = "VBS"

Set oFSO = CreateObject("Scripting.FileSystemObject")

'http://gallery.technet.microsoft.com/ScriptCenter/de-de/7a7f9937-0c6f-4f1e-a953-d29e47b2f5d5 ''''''''
sThisHtaFullName = Trim(FullName)' "\\svr6\Data1\data\_Shtcuts\Toolbar
links\A\A_HtaReplacment\ToolbarA_replacement.aaa.hta"

sThisHtaFileName = Trim(oFSO.GetFileName(sThisPrgFullName))
sThisPrgFullName = sThisHtaFullName
If Len(sThisHtaFullName) > 5 Then
sThisPrgFullName = sThisHtaFullName
Else
sThisPrgFullName = WScript.ScriptFullName
End If

sRarCopyScriptFullName =
"K:\data\Programs\HtaPrgs\Vbs.RarCpyBakupSelected.file.namedArgs.aaa.vbs"
sArgFullNameOfFil2bBakdUp = "/FulNameOfFil2bBakdUp:" & Chr(34) &
sThisPrgFullName & Chr(34)

' sArgFullNameOfArcFile = "/RarArcFilPath:" & Chr(34) &
"P:\Data\VB\HTML_MarcsPrgs\ItWorks\" '& sThisHtaFileName & Chr(34)
sArgPathOfArcFile = "/RarArcFilPath:" & chr(34) &
"\\svr6\D\Data\VB\HTML_MarcsPrgs\ItWorks_Hta\" & chr(34)'& _
' sThisHtaFileName & ".rar" & Chr(34)

' sCmdLine = "wscript " & Chr(34) & sRarCopyScriptFullName & Chr(34) & " " &
sArgFullNameOfFil2bBakdUp & Chr(34) & _
' sThisHtaFullName & Chr(34) & " " & sArgFullNameOfArcFile
sCmdLine = "wscript " & Chr(34) & sRarCopyScriptFullName & Chr(34) & " " &
sArgFullNameOfFil2bBakdUp & _
" " & sArgPathOfArcFile
' MsgBox sCmdline
Set objShell = CreateObject("Wscript.Shell")
objShell.Run sCmdline '"notepad.exe c:\scripts\test.txt"
End Sub

Function fnDrop
Dim strRetVal

strRetVal = window.event.dataTransfer.getData("URL")
MsgBox strRetVal

subRarCpyThisPrgFile2Pdrv

End Function

Function cancelEvent
window.event.returnValue = False
End Function

</script>

<body bgcolor="white">

<h1>Drag and Drop, dataTransfer.getData("URL").</h1>

<p>This page was copied from webreference.com. Try dragging
<a
href="http://webreference.com/programming/javascript/dragdropie/Example2.htm">this link</a>,
and dropping it on the yellow box below.</p>

<div id="divTarget"
ondragenter="cancelEvent()"
ondragover="cancelEvent()"
ondrop="fnDrop()">Drop on me</div>


<!--Add your controls here-->
<!--{{InsertControlsHere}}-Do not remove this line-->
</body>
</html>
--
MarceepooNu

0 new messages