Hi,
I am trying to create a CTB that would execute a script when files are dropped on it.
The files would come from Outlook email attachements.
Using "text <get drop>;" I get the list of the dropped files when selected from XYplorer or Windows Explorer.
But this is not working with Outlook email attachments. The list is empty.
Is there a workaround to make it work or should I think of another way to deal with my script ?
Thanks.
Caz.
Drop files on CTB from Outlook
Re: Drop files on CTB from Outlook
But drag'n drop of Outlook attachments into XYplorer (so that a copy is created in the current folder) works?
One of my scripts helped you out? Please donate via Paypal
Re: Drop files on CTB from Outlook
I used VBA as a workaround for now but I am interested if anybody as a method to make it work in a script.
Re: Drop files on CTB from Outlook
By doing what?I used VBA as a workaround
One of my scripts helped you out? Please donate via Paypal
Re: Drop files on CTB from Outlook
I need a script that creates files before attachments are dropped in XYplorer.
I wanted to use a CTB on which I could drop my attachments.
As a workaround I use VBA to get the attachment filenames and launch a script in XY to create the files I need.
Then I drag and drop the attachments.
So 2 operations when I think only one should be possible.
I wanted to use a CTB on which I could drop my attachments.
As a workaround I use VBA to get the attachment filenames and launch a script in XY to create the files I need.
Then I drag and drop the attachments.
So 2 operations when I think only one should be possible.
Re: Drop files on CTB from Outlook
Show the vbs script^^
One of my scripts helped you out? Please donate via Paypal
Re: Drop files on CTB from Outlook
Probably not a clean and optimised code (I am no expert).
Code: Select all
Public Sub CopyAttachmentFilenames()
Dim selItem As Object
Dim aMail As mailItem
Dim aAttach As attachment
Dim Report As String
Dim XYplorer As String
Dim clipboard As MSForms.DataObject
Set clipboard = New MSForms.DataObject
For Each selItem In Application.ActiveExplorer.Selection
If selItem.Class = olMail Then
Set aMail = selItem
For Each aAttach In aMail.Attachments
Report = Report & aAttach.FileName & vbCrLf
Next
End If
Next
clipboard.SetText Report
clipboard.PutInClipboard
XYplorer = "C:\Users\***\XYplorer\attachments.bat"
Call Shell(XYplorer)
End Sub
Re: Drop files on CTB from Outlook
I'm confused...
puts them into a <crlf> separated list and stores that list in the clipboard. Afterwards a .bat file is called, which does
"<something>"... And afterwards you additionally drag and drop those files. Em, where and why? XY doesn't recognize that
drop on the CTB as you said.
Post the script on your button as well, please.
As long as XY doesn't recognize the drop on any other element than the file list itself the only workaround I see is to run
code from your button (like: connect to Outlook, get attachments, store them <somewhere>/do something with them) which gets the attachments from the current mail in Outlook. In other words: No drag and drop at all and "the other way round", XY "gets" mail attachments from Outlook.
The vba file (you do execute it from within Outlook, correct?) gets all attachments (their file names) from the current mail,As a workaround I use VBA to get the attachment filenames and launch a script in XY to create the files I need.
Then I drag and drop the attachments.
puts them into a <crlf> separated list and stores that list in the clipboard. Afterwards a .bat file is called, which does
"<something>"... And afterwards you additionally drag and drop those files. Em, where and why? XY doesn't recognize that
drop on the CTB as you said.
Post the script on your button as well, please.
As long as XY doesn't recognize the drop on any other element than the file list itself the only workaround I see is to run
code from your button (like: connect to Outlook, get attachments, store them <somewhere>/do something with them) which gets the attachments from the current mail in Outlook. In other words: No drag and drop at all and "the other way round", XY "gets" mail attachments from Outlook.
One of my scripts helped you out? Please donate via Paypal
Re: Drop files on CTB from Outlook
What I need to do is create empty files with the same filenames as the attachments before I drag and drop them.
I wanted to do a single script in XY and drop the files on the CTB so as to create the empty files prior to the drop effectively happens (in a single operation).
I couldn't manage to do that.
As a workaround I use a VBA code to create a list of the attachments filenames and put it in the clipboard.
Then launch a XY script (through a bat file) from VBA that creates the empty files.
Then I can drag and drop the attachments, not on the CTB but in the active tab as the empty files already exist.
Hope it is more clear now.
I wanted to do a single script in XY and drop the files on the CTB so as to create the empty files prior to the drop effectively happens (in a single operation).
I couldn't manage to do that.
As a workaround I use a VBA code to create a list of the attachments filenames and put it in the clipboard.
Then launch a XY script (through a bat file) from VBA that creates the empty files.
Then I can drag and drop the attachments, not on the CTB but in the active tab as the empty files already exist.
Hope it is more clear now.
Re: Drop files on CTB from Outlook
I've asked this:
But you didn't mention (at that place) that this only works if you've created empty files with the same names (base + extension) of the names
of the attachments before doing the drag and drop...
Why don't you call XY itself with a /script= command line instead of using an intermediate .bat file then?
E.g with the following one-liner.:
This takes <crlf> separated file names (with no! paths) from the clipboard and creates empty files
with these names in the current folder (in the active list pane)
And you said that this works^^But drag'n drop of Outlook attachments into XYplorer (so that a copy is created in the current folder) works?
But you didn't mention (at that place) that this only works if you've created empty files with the same names (base + extension) of the names
of the attachments before doing the drag and drop...
Why don't you call XY itself with a /script= command line instead of using an intermediate .bat file then?
E.g with the following one-liner.:
Code: Select all
/script="::foreach($item, <clp>, <crlf>, 'e') { writefile($item); }"
with these names in the current folder (in the active list pane)
One of my scripts helped you out? Please donate via Paypal
Re: Drop files on CTB from Outlook
No this works like in Windows Explorer. No need to create empty files with the same names.highend wrote: ↑23 Nov 2018 13:29 I've asked this:And you said that this works^^But drag'n drop of Outlook attachments into XYplorer (so that a copy is created in the current folder) works?
But you didn't mention (at that place) that this only works if you've created empty files with the same names (base + extension) of the names
of the attachments before doing the drag and drop...
For some reasons I want to create this empty files before drag and drop.
Because I am still learningWhy don't you call XY itself with a /script= command line instead of using an intermediate .bat file then?
E.g with the following one-liner.:This takes <crlf> separated file names (with no! paths) from the clipboard and creates empty filesCode: Select all
/script="::foreach($item, <clp>, <crlf>, 'e') { writefile($item); }"
with these names in the current folder (in the active list pane)
I'll try your solution.
And your solution made me discover that I could copy the attachments in the clipboard. That opens new way of achieving my script !
Thanks.