Alpha Video Training
Results 1 to 12 of 12

Thread: File to Clipboard for pasting file into other folder

  1. #1
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,192

    Default File to Clipboard for pasting file into other folder

    I'm sure this has been asked before but I can't find it. Using Windows File Explorer, after navigating to the file you seek, you can select the file, right mouse click, and copy the file to the clipboard. This can be done with ui_get_file(). However, I am trying to reduce the user having to execute navigating and searching for files. I know of neither a way to get Alpha to show a single specific file in a folder having many files, nor of xbasic code to get a file to the clipboard making available the file to be pasted into a folder location of the users choice.

    I am somewhat left with having to have a temp folder used to copy specific files into, have ui_get_file() to open that temp folder which will have few files for the user to have to select from, have the user perform right mouse click and copy, and then delete the temp folder file selected. Not a bad option, but I though maybe there is something more direct.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  2. #2
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,356

    Default Re: File to Clipboard for pasting file into other folder

    Sorry Mike, you've lost me somewhere.
    Do you know the file name before the search?
    Can you construct thefile name from data in Alpha?
    Are the file names constructed to relate to a record in AS?

    I had this problem with images. Needed to associate an image with a specific item.
    The item had a PK of, say 1234567+trailer+09 composed of vehicle, vehicle type,vehiclectype number
    The image had a filename of 1234567trailer09.jpg, in the Images folder.
    The file loookup was specific and went straight to the image file.

    Why are you wanting to copy the file location?
    Could you use a Hyperlink field?
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  3. #3
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,192

    Default Re: File to Clipboard for pasting file into other folder

    Hi Ted,
    Yes the complete file path and file name is known. Example:
    ROOT FOLDER: C:\Art\Assets\Assets_repository\
    FILE: C:\Art\Assets\Assets_repository\AST.00013_Coors Light Giant Kickoff.AI

    With this, I would like foremost to be able to have this file copied directly to the the Clipboard to be able to paste the file the desktop. I see no method to do this directly with xbasic.
    Unable to get the file directly put to the Clipboard, I believe I have to open the file navigator and right mouse click on the file to get the file onto the Clipboard.
    I can use ui_get_file() to open the folder where the file is located, but the folder has 1000 files and navigating to the exact file is cumbersome. I don't see a way to get to the exact file using ui_get_file to have only that exact file presented to right click and copy it to the Clipboard. So

    1- Is there a method to directly get the file to the Clipboard without having to use ui_get file()....
    2. Is there a syntax/method to get ui_get_file() to present only the exact file and not the contents of all the files in the root folder and having to navigate to the file.

    And no, using file.copy() is not an option, because I am using the scenario of pasting to the desktop as an example. Where the file is to be pasted is dynamic, not predetermied, and will be the choice of the user at the moment.
    Last edited by Mike Wilson; 08-14-2019 at 10:48 PM.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  4. #4
    "Certified" Alphaholic Ted Giles's Avatar
    Real Name
    Ted Giles
    Join Date
    Aug 2000
    Location
    In the Wolds, Louth, Lincolnshire, UK
    Posts
    4,356

    Default Re: File to Clipboard for pasting file into other folder

    I am probably being a bit thick here, but when you say "the file", what do you need to do with it?
    Do you want the whole file to go into a Memo Field, to create a link so that if the user can click and display the file content or what?
    Copying it would mean 2 versions of the file, so is that what you are after?

    EDIT
    What about Clipboard.Set_Data() ?
    Then, you could test for the presence of the file using File.Exists()

    So, a message if there is no file to find, or a Clipboard path with the file created in it as you have the construction already?
    Last edited by Ted Giles; 08-15-2019 at 04:26 AM.
    Ted Giles
    Example Consulting - UK
    .

    http://ec12.example-software.com//
    See our site for Alpha Support, Conversion and Upgrade.

  5. #5
    Member Elke's Avatar
    Real Name
    Elke Barghoorn
    Join Date
    Sep 2000
    Location
    New York
    Posts
    350

    Default Re: File to Clipboard for pasting file into other folder

    I know of no way to copy a file unless the location is known. However, you can filter the ui_get_file() with:
    dim prmpt_default as c
    dim prmpt_title as c
    dim prmpt_filter as c
    dim prmpt_flag as c
    dim vFileName as c
    prmpt_default = "C:\Art\Assets\Assets_repository"+chr(92)
    vFileName = "AST.00013_Coors Light Giant Kickoff"
    prmpt_title = "Select file"
    prmpt_filter = "all("+ vFileName +"*.*)"
    vscan_list = ui_get_file(a5_eval_expression(prmpt_title),prmpt_filter,prmpt_default)

  6. #6
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,308

    Default Re: File to Clipboard for pasting file into other folder

    Mike, it seems to me that it might be possible to:
    - use File methods to write the file to a blob variable
    - use the ui_browse_for_folder function to enable the user to select the destination
    - prompt the user for a new filename, possibly suggesting a default
    - use File or Blob methods to create the new file from the variable

    In other words you might not have to use clipboard at all.

  7. #7
    "Certified" Alphaholic Tom Henkel's Avatar
    Real Name
    Tom Henkel
    Join Date
    May 2002
    Location
    New Jersey, USA
    Posts
    1,870

    Default Re: File to Clipboard for pasting file into other folder

    And no, using file.copy() is not an option, because I am using the scenario of pasting to the desktop as an example. Where the file is to be pasted is dynamic, not predetermied, and will be the choice of the user at the moment.
    But, if you allow the user to select the file, then you would have the filename assigned to a variable already. If you assign a new variable to the stripped filename with the new path, then it should just be file.copy(orig_filename, new_filename).

    Am I missing something?

    Tom

  8. #8
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,192

    Default Re: File to Clipboard for pasting file into other folder

    Hi all,
    Our users access our application on our network via RDP. When in the application, if a user navigates to a file and then uses right click and copies the file, the file is on the clipboard. Then the user navigates/toggles to their personal computer desktop or any place in their personal computer off the network, then they can right click and paste the file to the place they want the file to be copied to in a location off the network in their personal computer. I don't know how to have it for alpha on the network to direct the file copy to a location off the network. Using the clipboard is the only way I know of to make that happen between the different spaces. The address of C:\transfer when on the network will not copy the file to c:\transfer on the users personal computer.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  9. #9
    "Certified" Alphaholic
    Real Name
    Finian Lennon
    Join Date
    Apr 2000
    Location
    Atlanta, GA
    Posts
    1,804

    Default Re: File to Clipboard for pasting file into other folder

    Are the local computers visible as shared resources on the server? If the local machines were to be set up to share "C:\Transfer" as "AlphaTransfer" with "everyone" then that folder could, theoretically, be read by Alpha from the server. The IT people might not like that idea. You'd need to get the logged-in machine name for each user on the server. That was pretty easy up through Server 2012-R2 (you can run a batch file from Alpha with just the "SET" command - redirect the command output to a file, then parse the file for the "CLIENTNAME" value) but I don't know how you would do it for later server versions. (I don't think Alpha has a method for this.)

    If that can be done then you could, again theoretically, use network addressing in a file.copy() command. Something like (don't trust my syntax!)
    infile = "\\ServerName\FolderWithFile\filename"
    outfile = "\\LocalMachineName\AlphaTransfer\filename"
    file.copy(infile,outfile)

    Might be worth a try.
    Finian

  10. #10
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,192

    Default Re: File to Clipboard for pasting file into other folder

    Hi Finian,
    Hum... Something to think about, and look into, for sure. Thank you.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  11. #11
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,663

    Default Re: File to Clipboard for pasting file into other folder

    Hi Mike,
    Did you ever get this to work?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  12. #12
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,192

    Default Re: File to Clipboard for pasting file into other folder

    No I haven't. Still working on it. Will report back if and when I get some conclusions.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

Similar Threads

  1. Pasting from windows Clipboard
    By alexmuir in forum Windows Desktop Applications
    Replies: 8
    Last Post: 07-21-2016, 11:27 AM
  2. File upload - PDF file not being uploaded to designated folder
    By clankford in forum Mobile & Browser Applications
    Replies: 5
    Last Post: 11-19-2015, 04:50 PM
  3. image file from clipboard data
    By john michaels in forum Alpha Five Version 11 - Desktop Applications
    Replies: 5
    Last Post: 11-24-2013, 04:08 PM
  4. Getting the folder location on file upload and file download javascript
    By acceptthis in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 03-09-2013, 06:00 PM
  5. move a file from folder x to folder y
    By Ken Tjia in forum Alpha Five Version 9 - Desktop Applications
    Replies: 7
    Last Post: 11-26-2009, 01:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •