Jump to content
Macro Express Forums
patgenn123

Loop File Locations In Clipboard

Recommended Posts

Hello Everyone!

 

I might have mentioned this before in passing(see Right Click on file topic), but I am trying to get Clipboard to capture the names of multi-selected files and then perform some other actions to it.

 

Say for example I am on my desktop and I would like to highlight three files and perform some action on it. First, I would select Ctrl+C(Or right click and then click "Copy"). Next I open clipboard, but I only see one of the items and NOT all three.

 

Is there a way of getting all three onto the clipboard even if if meant repeating and appending them to each other? If so, how would the Macro Commands be structured assuming that the highlight/copy action could be one file, could be 100 files?

 

Pat

Share this post


Link to post
Share on other sites

I am surprised you see any filenames in the clipboard. When you copy something from the desktop to the clipboard I think you are copying the shortcut and not the name of the shortcut.

Share this post


Link to post
Share on other sites

Kevin,

 

Help me to understand what you mean.

 

When I copy a file from the desktop, I check out what it looks like in the clipboard. It never looks like the full address of the file!! It has some "curly q's" and the like, but never the full address of file.

 

So what your saying is that the clipboard is not equipped to show me the full address let alone multiple files and their addresses if I multi-copy more than one file?

 

Pat

Share this post


Link to post
Share on other sites

When you copy a file from the desktop you are not copying a filename, you are copying a file. It sounds to me like you want filenames. If you copy an item from the desktop to the clipboard you are copying the file, or at least whatever Windows uses to identify that you are going to copy a file.

 

Try this:

1. Right click on a desktop icon

2. Click Copy

3. Launch Notepad

4. Click Ctrl+v

 

Nothing happens. Why? Because you cannot paste a file into notepad. You can paste text into notepad, but not a file.

 

When you highlight several files and try to copy them to the clipboard, Windows only copies one file. The clipboard can only hold information about one file at a time.

Share this post


Link to post
Share on other sites

I don't know what you mean by 'addresses of filenames'. If you are asking how to highlight desktop shortcuts and get their filenames, then I do not know if it is even possible. This is not a limitation of Macro Express, it is the way Windows works.

 

Are you aware that there is a folder that contains the desktop files, folders and shortcuts? Knowing this might help you find a different way to write your macro. You can get the location of the Desktop folder using the Set Variable %T1% to "Path to Desktop" command. Then you could use the Repeat with Folder command to process each file and/or folder.

Edited by kevin

Share this post


Link to post
Share on other sites

OK, Thank you Kevin! I appreciate it.

 

However, here is what I am trying to do. This would make my life so much easier and maybe other's also.

 

 

I am basing my work on this forum topic:

 

http://pgmacros.com/community/index.php?showtopic=1787

 

It's called right click on file. Cory started the thread and I was thinking of a great way to use it.

 

Here is my idea:

 

Using the ideas built upon the thread above, I want to highlight a file(OR FILES) and right click on a Macro command from the right click menu to grab the filepath(or filepaths) and have the file INSTANTLY move itself to it's respective folder.

 

Here is an example: I have 4 files on my desktop with the person's last name "Adams". For example, Adams appraisal, Adams paystub, Adams insurance etc.

 

I want to move the files to the "Adams" folder located in another location. I already have the macro on how to move this file(s) to the folder BASED ON THE 1ST WORD of the file matching the first word of the folder.

 

I don't want this Macro to run unless I highlight the file(OR FILES) and run the Macro from the command in the registry based on the forum topic already discussed.

 

I know how to do this with 1 file and I have it figured out. However, to highlight multiple files and get their filepaths I think the only way to do this is to grab the file paths from the clipboard.

 

I tried ClipMate and you have to click the actual line in ClipMate itself to actually get it to paste it back onto the clipboard. I don't know if ClipMate can autopaste it back onto the clipboard. In fact, I am still monkeying with it and have tried to find out, but haven't had it long enough to see.

 

The macro needs to grab it from the clipboard and it can't. that's why I am looking for a way to grab multiple filepaths, but only if I choose these myself based on highlighting it myself.

 

The point is that I don't want all desktop files moved and i don't want it to be based on a prompt!

 

Any ideas would help.

 

 

Pat

Share this post


Link to post
Share on other sites

At first I thought that the macro described in the forum topic you reference would only run when you right-click on a file from within Windows Explorer/My Computer. It is great that it works when you right-click on the desktop also.

 

Perhaps the lack of a recommendation about how to process more than one highlighted file is an indication that it cannot be done. If it can be done it probably will require a change to the registry like the macro in the 'Right click on file' forum topic.

 

Perhaps there is another way to tackle the problem. For example, you might be able to write a macro that uses the Repeat with Folder command to collect filenames and then populate something like a Multiple Choice Menu command. You could have the macro ignore all known filenames (like My Computer, Outlook Express, and Recycle Bin).

Share this post


Link to post
Share on other sites

Kevin,

 

Thanks for the response!

 

However, it has everything to do with the Windows Clipboard that will not paste the full file paths into the clipboard if they are multi-selected and copied.

 

Regarding your recommendation with Repeat/Multiple Choice, what if I were to select 50 files?

 

I just thought of something.... If I had 5 files all by the name of "Adams" and use this macro to move at least 1 file, is there a way of holding that part of the filename(Adams) to loop through to find all other names of "Adams"? and then move them "One at a time?"

 

Pat

Share this post


Link to post
Share on other sites

Take a look here for copying file paths directly to clipboard. I use it every day.

 

http://home.worldonline.dk/ninotech/freeutil.htm

 

Ninotech Path Copy 4.0

Ninotech Path Copy is a shell extension for Windows 95, 98, NT4, 2000, and XP that enables to copy the path of a file or directory to the Clipboard. You can then paste the path in to your document, e-mail, etc. You copy the path of a file or directory by right-clicking it in the Windows Explorer and choosing Copy Path from the context menu. The context menu then offers nine standard ways of copying the path, in addition to the user defined copying methods that you create yourself:

 

- Short Name: File/folder name converted to 8.3 characters

- Long Name: File/folder name

- Short Folder: Parent folder name converted to 8.3 characters

- Long Folder: Parent folder name

- Short Path: Full path name converted to 8.3 characters

- Long Path: Full path name

- Short UNC Path: Full UNC path name converted to 8.3 characters (only enabled in network environment)

- Long UNC Path: Full UNC path name (only enabled in network environment)

- Internet Path: Full UNC path name converted to Internet path (only enabled in network environment)

- Setup... Create your own copy methods for copying the path names.

Share this post


Link to post
Share on other sites

There is a free one called ClipPath I use as well but I don't think any of these will return the path of multiple selected files which I think is what he's trying to do.

Share this post


Link to post
Share on other sites

Gentlemen,

 

Actually, it does multi-select files and creates the full paths in the clipboard. Thanks Jowensii!!!!

 

The only problem is that the free-ware does not give me the ability to continue on with a macro without having to make additional steps/shortkey etc.

 

in other words, even though you can right-click and click "copy path", what's next without having to do another step(i.e. shortcut key, whatever)? I want to make it seemeless without any extra steps or clicks or shortcut keys.

 

That program is great, free and very useful, but I thought maybe it would have allowed a command line of some kind(to run a macro), but it doesn't.

 

Pat

Share this post


Link to post
Share on other sites

That's cool. I'll have to keep that in mind.

 

I know how you could do it. Assuming you are running a macro then ask the user to go out and select some file and that your problem is how to get back to the macro. How about you clear the clipboard first, then start an infinite repeat that uses the clipboard contents not being empty as a criteria for a break. Like this:

 

Repeat Until %T1% <> %T1%
 If Clipboard Text Equals ""
   Delay 250 Milliseconds
 Else
   Break
 End If
Repeat End

 

<REP3:08:000002:000001:0001:1:01:T1><IFOTH2:07:1:><MSD:250><ELSE><BREAK><ENDIF><ENDREP>

Share this post


Link to post
Share on other sites

Ok,

 

After I get that figured out, I was curious as to how you would "chew" through the file paths in the clipboard.

 

They obviously would go line by line underneath each other, but when I put them all into a variable, they are crunched into one line.

 

Do I have to do a text process or ASCII process for each line and if that's the case, I would think i would have to save everything to a text file first from the Clipboard right?

 

The only reason I am not doing this right now to check to see if I am right is because I like to get other input into this and I learn much better this way.

Share this post


Link to post
Share on other sites

As for the right click there was a discussion in here about adding a macro to that menu and it works really slick. Might want to check that out.

 

For parsing out the different file names I can't say or sure as I haven’t seen it but there is probably a CRLF at the end of each line. I would read that in to a text var, find the position of CR and store in N1, decrement N1, Copy part of the text to T2 from 1 to N1. Add 2 to N1 and delete part of text from 1 to N1 and repeat. Simple.

 

If you like do the copyclip and save it to a text variable and post it here. Then I can look at it with the hex editor and see what’s in between.

 

Oh, can see may article about hex editors if you’re interested. http://bluepointdesign.com/macros/hexedit.htm

Share this post


Link to post
Share on other sites

Cory,

 

That is what I am basing all of this off of. However, there is no way I could figure out how to connect http://home.worldonline.dk/ninotech/freeutil.htm with the right click menu macro we have discussed in the forum recently.

 

Ninotech looks like it won't be executable from a macro program launch line? Where would the .exe be at for this program or have it run from the "run" line. It doesn't look like it can be run unless you go to right click it in the right-click menu.

 

I guess I am going to have to e-mail the maker of the program..

 

Pat

Share this post


Link to post
Share on other sites

I am not familiar with the program and would need to review it before giving any specific advice. I just don't have the time at the moment.

Share this post


Link to post
Share on other sites

It looks like the only way this can be done is to right click on the file(or multiple files),highlight, and then use http://home.worldonline.dk/ninotech/freeutil.htm to paste it to the clipboard, then use the (right click on file post) to start processing the contents into the clipboard.

 

This might be the last gasp at this, but is the right click menu a control or is it a hidden program that can be found anywhere in the system that can be called up with a macro? If so, what is it and where is it?

 

Thanks!

 

Pat

Share this post


Link to post
Share on other sites

I’ sorry, I must be think. I still don’t know why you don’t just run it as a part of your macro. Parsing it has nothing to do with the running of the macro. But then again I’ve never gotten any details on what exactly it is you’re trying to do. Why can’t you have the user start running the macro that does whatever it is you like, then pause to have the user select multiple files, right click and copy to clipboard with your utility, and then move on to finish the macro? Maybe if you could give a specific blow by blow of what think it should do and a specific explanation of what it is you’re trying to automate. For instance what is it you want to do with these files? On the one hand you say you want to get the path from multiple objects by right click but then it sounds like you want to be able to have the macro do this somehow by using the right click context sensitive menu. I’m confused.

 

Here’s an idea for you. Why don’t you run the utility and paste the results into a text file and post it here. Then I can tell you how to parse it.

 

As for right click activation of a macro if you look back a while there was an excellent post on how to launch a macro from a right click. Many of us have tried it and it works really well.

Share this post


Link to post
Share on other sites

Cory,

 

OK. Let's start. I am not even going to get into the parsing stuff after it is pasted into the clipboard because I am not quite there yet. I almost have it, but let me start.

 

OK. Here is my intent:

 

1)Right click file or files

2)Click the program that allows the file(s) to paste to clipboard.

2a)Click on the right click menu again? to run the macro

3)Have the Macro parse the file name(s) based on the first word of the file name after it is pasted onto the clipboard. For example, I have file names called "Smith appraisal" , "Smith paystub", "Smith worksheet". I would like to have the Macro search the entire database to find the folder named "Smith" and move all the file there automatically. Simple.

 

Idea #2

 

Everything the same as above, but right click on a folder(rather than a file(or files) and have the macro search the entire computer to "pull" all file names and bring them to the folder instantly. This would also be based on the same concept. If the folder has the name "Adams", then have the macro search the computer to pull all files with the first name "adams" only if it's the first word in the file name.

 

Idea #3

 

How about using your e-mail macro that you just explained and posted in recent days to run a macro from the right click menu to send e-mails based on multiselecting files and sending them fast!

 

Idea #4. How about that same e-mail macro from a folder "pulling the file names from that folder, putting them on a multiple choice list, multiselecting them and then putting them into an e-mail.

 

 

There are so many things I could do with this. However what really stinks is I don't want to have to have a macro ask me to highlight anything. I want to do it as natural as possible. Why do it any other way? Highlight the file or files, do the macro and that's it.

 

It appears that it won't work with just one click though. First you need another program to paste the muliple files into the clipboard. Once you click that program, the right click menu instantly disapears. and there is no way that "freeware" will allow a macro to "piggyback" it within its own program. That means that you have to click the files, copy them and then right click again to get the macro to parse it.

 

I don't have an idea about how to get these two prgrams to work with each other to make this work in one step based on one click.

 

Try it. The problem is: ME needs to rely on another program, after selecting the NinoTech program(to paste to clipbaord) you need to highlight/select those files again in order to run the ME Macro "ContextMacro". It's just not possible even in your suggestion without highlighting the files twice and clicking the right click menu twice to use two different commands. AM I wrong???????

 

Summary:

 

Highlight/multiselect

right click

click on the desired macro from right click menu and do whatever needs to be done

 

That's really it in a nutshell. Three simple steps.

 

Pat

Share this post


Link to post
Share on other sites

First off I must point out that I am available on a consulting basis! In all seriousness if this is something you really just need I can help do the actual writing or just advise in an interactive way. What you are suggesting sounds like fun and very similar to things I have done in the past. Now where was I…

 

Good explanations, I see what you’re up to. You’re correct that there are limitations to doing it exactly like you want but I can think of a couple of ways to get close. First off I don’t think you have a need for a right click to activate the macro after selecting. Personally I would highlight the files I want, leave the mouse over one of the files. Then hit a hotkey for the macro that would then right click on the file and select the item you want and march on with the macro. In any case you have to select the files and you will have to right click and do something otherwise how would it know when you are ready. So this seems a pretty quick solution: Highlight, hotkey. Oh, and I have an idea. How about you set the middle mouse button to be the hotkey? Very cool.

 

All the rest of the stuff seems pretty easy as long as your filing systems and such are consistent. But you’re right, getting the selection down is the first step and I think if you approach it as I suggest you can avoid the prompts.

 

That means that you have to click the files, copy them and then right click again to get the macro to parse it.

Uhhh…. No. Why do you think another selection is needed? Once you run your program all the files will be on the clipboard ready for the macro.

 

AM I wrong???????

Uhhhh… Yes! :D

Share this post


Link to post
Share on other sites

Cory,

 

I see what you mean, however, I don't see, even with the Macro you suggest, how this is not going to require 2 right clicks to get it to work.

 

One is going to click the program "Ninotech" to paste to clipboard and then the other will be needed to run ContextMacro. Setting the macro with the hotkey will still require two mouse right clicks to open the right click menu twice.

 

How can it be any other way?

 

I would like to be proven wrong. I am certain I am wrong, but in my small mind, it's not fitting in..... :blink::ph34r:

 

Pat

Share this post


Link to post
Share on other sites

I envision something like this. You highlight all the files you want and then hit your middle mouse button. The macro should do the rest. So the net user action required is highlight and a click. This in fact is fewer user actions than the nanotech program. With it you would need to highlight, right click and select a menu item. My solution would eliminate all of that after the selection and replace it with one mouse click. Unless you have a have mind reading computer I don’t see how you could possibly do it in less.

Share this post


Link to post
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...