wjbzone Posted September 24, 2014 Report Share Posted September 24, 2014 Having problems. This is what I want to do: Create a new folder in the current folder and name the new folder the same as a selected document. Start the macro while in a windows folder and with a document (in that folder) selected. 1. Variable set string %T1% to topmost window title. This sets the variable to the path of the current folder, but if the pathname is over 96 characters it truncates and does not work. Can I increase the length of a variable or is there a better way to obtain the current path? 2. Text Type <F2> this edits the currently select document filename. the part of the name I want to copy is highlighted (in windows7 the filename less the extension is highlighted) 3. Clipboard Copy 4. Variable set string %T2% from the clipboard contents T2 is the name I want to use for the new folder. 5. Create folder %t1%\%t2% This works, but only if the filepath string length (from 1 above) is not too long. Please help with 1 and 5 above. (or is there a better method?) Thanks Billy Quote Link to comment Share on other sites More sharing options...
Cory Posted September 24, 2014 Report Share Posted September 24, 2014 I can't think of a simple way to do #1 without using some alternate form of programming. But #5 is a file system limitation. In NTFS I think it's 256 characters for the entire path. Quote Link to comment Share on other sites More sharing options...
Cory Posted September 24, 2014 Report Share Posted September 24, 2014 Oh, for #1 did you try going to the address bar and copying the path from there? Quote Link to comment Share on other sites More sharing options...
Cory Posted September 24, 2014 Report Share Posted September 24, 2014 If you highlight a file and hold the shift as you right click there is a menu option to copy the entire file name. "Copy as Path" Quote Link to comment Share on other sites More sharing options...
wjbzone Posted September 24, 2014 Author Report Share Posted September 24, 2014 Cory, both those methods can get the filepath into the copy buffer. My problem is I cannot store the copy buffer to a variable because the string length is too long. I need filepath and filename stored as variables for the "Create Folder" method to work. My file server has extremely long path names. For now I just drag the folder to drive C:\ run the macro and then drag it back. Quote Link to comment Share on other sites More sharing options...
Cory Posted September 24, 2014 Report Share Posted September 24, 2014 That doesn't make sense. Please show me some sample code. A string variable can hold an enormous number of characters. Quote Link to comment Share on other sites More sharing options...
wjbzone Posted September 24, 2014 Author Report Share Posted September 24, 2014 You are right. I can store more in a variable. The variable gets truncated using this.... <VARIABLE SET STRING Option="\x05" Destination="%T1%" _ENABLED="FALSE"/> to set the variable T1 to the window title. It works for short filenames so I assumed the variable length was the problem. So let me backup. 1. If I go to the address bar and copy there. (alt-d gets to the address bar) I can get the variable set correctly. Figured out another method to try: "alt-shift-n" creates a new folder in the current explorer window (don't need the pathname). Just rename the new folder to T2 Thanks Cory Quote Link to comment Share on other sites More sharing options...
acantor Posted September 25, 2014 Report Share Posted September 25, 2014 Ctrl+Shift+N creates a new folder. Alt+Shift+N does nothing. This Windows hotkey works in a lot of contexts, e.g., in a Word or Outlook "Save As..." dialog, in Windows Explorer, etc. Quote Link to comment Share on other sites More sharing options...
Cory Posted September 25, 2014 Report Share Posted September 25, 2014 I suppose it depends on your OS as well. In W8 I don't see the path in the title. Also I'm guessing Windows truncates the rath if it's too long to display. In cases like this I try to avoid using Windows Explorer at all. It's better to use Macro Express's file and folder manipulation commands. To add a sub directory would be easy using the Variable Set From Path command. Quote Link to comment Share on other sites More sharing options...
terrypin Posted September 27, 2014 Report Share Posted September 27, 2014 Hi Cory, You might want to check your 'Contact me' link, which I don't think is working. My several attempts to use it gave fail errors. Terry, East Grinstead, UK Quote Link to comment Share on other sites More sharing options...
Cory Posted September 29, 2014 Report Share Posted September 29, 2014 Thank you Quote Link to comment Share on other sites More sharing options...
Cory Posted September 29, 2014 Report Share Posted September 29, 2014 I just tested it and it seems to work. I'll send you a PM. Quote Link to comment Share on other sites More sharing options...
redwards Posted October 31, 2014 Report Share Posted October 31, 2014 Cory Your "contact me" link for fine for me Quote Link to comment Share on other sites More sharing options...
Cory Posted October 31, 2014 Report Share Posted October 31, 2014 Thanks! It was broken however. The guy I had implement that had programmed it to use the form message as a subject. Bad form. Literally. So if there was a newline it would throw an exception. 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.