2 Replies Latest reply on Jun 8, 2006 1:03 PM by Meliora_Software

    Drag and Drop files to upload snag

    mlandsfeld
      I am developing a Director projector application that uploads a users local files to a server via an FTP Xtra. I would like to have an icon on the desktop that the user can drag-and-drop files onto and the application automatically uploads the files. I have created a folder on the desktop and an application that poll it for content to initiate the upload but the problem with this is that the user, by dragging files to the folder, will unknowingly move the files to "upload folder" and they will be removed from their original locations. This is obviously not what anyone desires. I would like to have the drag-and-drop trigger the upload from the file's current location.

      One solution that I have implemented is using the "Drag & Drop Xtra", from Meliora Software, and created a MIAW that looks like a desktop folder icon. The problem with this is that the icon is present only when the application is running and I can not keep it pinned down to the desktop. When it is clicked-on it will come to the front, like any other application. Is there a way to keep a MIAW pinned down?

      Another POSSIBLE approach would be to place a shortcut to the application on the desktop and when a file is dropped on it, capture the file path and pass that along to the Director application on startup. Is this possible? Is there an Xtra to do this or does Director have this capability built in?

      Ideally, we would like to have a folder on the desktop that only allows copy-and-paste functionality to itself but that would be an OS issue and out of the control of Director. Have any of you created such an app? Any ideas are welcomed.

      Thanks in advance.
        • 1. Re: Drag and Drop files to upload snag
          Level 7
          > Another POSSIBLE approach would be to place a shortcut to the application on
          > the desktop and when a file is dropped on it, capture the file path and pass
          > that along to the Director application on startup. Is this possible? Is there
          > an Xtra to do this or does Director have this capability built in?

          This is possible. Check the docs for 'commandLine' or use Buddy API's
          baCommandArgs()
          • 2. Re: Drag and Drop files to upload snag
            Meliora_Software
            > Another POSSIBLE approach would be to place a shortcut to
            > the application on the desktop and when a file is dropped on it,
            > capture the file path and pass that along to the Director
            > application on startup. Is this possible? Is there an Xtra to do
            > this or does Director have this capability built in?

            this approach won't work because every time a file is dropped on the icon a new instance of the projector will run.
            To achieve that you need:
            1) A Director version prior to MX 2004, Director MX would be fine.
            2) Remove the projector's button from the task bar when it starts with our Window Xtra:
            wndRemoveFromTaskbar(true)
            3) Move the projector's window to the background with our Window Xtra:
            WndSetDepth(wndGetMain(),"back")
            4) Apply a 1-bit alpha mask to change the projector's shape to make it looking like an icon, again, with our Window Xtra:
            wndTransInit(member "1BitMask",false,false)
            5) Leave all the Drag&Drop Xtra code for drop as is.

            That's it, it seems MIAW isn't required.