cldcp00 Posted October 18, 2019 Report Share Posted October 18, 2019 I cannot for the life of me see why this simple code does not work? The Clipboard Copy works but for some reason the Variable Set String does not Clipboard Copy Delay: 1 seconds Variable Set String %tFilename% from the clipboard contents MessageBox: Test Or <CLIPBOARD COPY/> <DELAY Flags="\x01" Time="1"/> <VARIABLE SET STRING Option="\x02" Destination="%tFilename%" NoEmbeddedVars="FALSE"/> <MESSAGEBOX Caption="Test" Message="%tFilename%" Icon="0"/> I seem to make good progress and then something simple baffles me. Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 I recommend using code boxes when posting code. Also a small sample file helps us. Might get you more answers quicker the easier you make it for others. It works for me. If you're trying to copy a file object in Windows File Explorer, this will not work. If that's not what you're trying to do, what is it that you're copying? Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 BTW, in Windows File Explorer one can right click the file with the Shift key depressed and choose "Copy as path" to get the files path. Another cool trick I've used for macros is to create a "Send to" item on the right click menu to send it to an empty folder monitored with MEP. Then MEP grabs it and does whatever I need to have done with it and deletes it after. Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 Ignore this. Quote Link to comment Share on other sites More sharing options...
cldcp00 Posted October 18, 2019 Author Report Share Posted October 18, 2019 12 minutes ago, Cory said: I recommend using code boxes when posting code. Also a small sample file helps us. Might get you more answers quicker the easier you make it for others. It works for me. If you're trying to copy a file object in Windows File Explorer, this will not work. If that's not what you're trying to do, what is it that you're copying? That Exactly what I am trying. Can you explain why it will not work? The clipboard copies this C:\Desmond Music\Music Library 2018\000 Music Selected To Play WhatsApp Group\Bad Tunes\02 - Brethren & Sistren.mp3 Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 When one copies something to the clipboard, the type of data is detected and it's stored in a spot for the type of data. So if you copy a graphic, then it's stored as bitmap data. In the case of a file in Explorer or a picture, there is nothing set in the text bucket of the clipboard. When MEP sets a text variable, it uses a method like Clipboard.GetText. And since File Explorer din't set ant text, you get nothing. Which is what you see in MEP. This is the same for most apps. Copy a file in File Explorer and go into Notepad and paste. Notice there's nothing pasted. It's the same issue. Depending on what you're trying to do, there are many different methods to get the file name. But they're too numerous to enumerate. If I knew more about what you are doing, I could make some suggestions. Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 I suspect you would be best off using the Copy Path feature in Windows File Explorer. Home tab, Copy Path. Click here. Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 BTW if the path is unique, you can use the clipboard text to activate your macro. E.G. "C:\Desmond Music\Music Library 2018" Quote Link to comment Share on other sites More sharing options...
cldcp00 Posted October 18, 2019 Author Report Share Posted October 18, 2019 25 minutes ago, Cory said: When one copies something to the clipboard, the type of data is detected and it's stored in a spot for the type of data. So if you copy a graphic, then it's stored as bitmap data. In the case of a file in Explorer or a picture, there is nothing set in the text bucket of the clipboard. When MEP sets a text variable, it uses a method like Clipboard.GetText. And since File Explorer din't set ant text, you get nothing. Which is what you see in MEP. This is the same for most apps. Copy a file in File Explorer and go into Notepad and paste. Notice there's nothing pasted. It's the same issue. Depending on what you're trying to do, there are many different methods to get the file name. But they're too numerous to enumerate. If I knew more about what you are doing, I could make some suggestions. Thanks Cory Understand fully Quote Link to comment Share on other sites More sharing options...
Cory Posted October 18, 2019 Report Share Posted October 18, 2019 You're welcome. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.