Jump to content
Macro Express Forums

Very Frustrating


Recommended Posts

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.

Link to comment
Share on other sites

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? 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...