Jump to content
Macro Express Forums

Why doesn't this work?


Recommended Posts

When I use the Repeat with Folder command and explicitly enter the folder name, it works. But when I use a variable name (ExplorerFolder), as shown below, it fails - apparently ignoring the Repeat .

 

// Assumes a My Computer folder is open. Doesn't matter if any file is already selected.

Variable Set String ExplorerFolder to topmost window title

Text Type (Simulate Keystrokes): <HOME>

Repeat with Folder %ExplorerFolder%

Text Box Display: Message 1

End Repeat

Macro Return

 

<COMMENT Value="Assumes a My Computer folder  is open. Doesn't matter if any file is already selected."/>
<VARIABLE SET STRING Option="\x05" Destination="ExplorerFolder"/>
<TEXT TYPE Action="0" Text="<HOME>" _COMMENT="Selects first filename"/>
<REPEAT WITH FOLDER Path="%ExplorerFolder%" OnlyFiles="TRUE" Destination="%JPG_Filename%" FullPath="FALSE" ProcSubfolders="FALSE"/>
<TEXT BOX DISPLAY Title="Message 1" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 Filename = %JPG_Filename%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="0" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
<END REPEAT/>
<MACRO RETURN/>

 

Note that the variable is correctly captured, as it is shown in the Variable Debugger.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

The repeat with the variable is properly formatted. I suspect that there is some slight problem with the window title being used as a file path. Try displaying "%ExplorerFolder%" in a dialog box before the repeat. Include the quotes. I'll bet there's something slightly wrong with the syntax. Post what you find here including the quotes if you don't see a problem. In any case I bet it's because the title contains an extra character or "Windows Explorer - " in it.

 

BTW I see no need for the "Home" text type. At least it's not needed for the repeat.

 

Also you do realize having Windows Explorer open isn't required for Repeat with Folder, right?

Link to comment
Share on other sites

The repeat with the variable is properly formatted. I suspect that there is some slight problem with the window title being used as a file path. Try displaying "%ExplorerFolder%" in a dialog box before the repeat. Include the quotes. I'll bet there's something slightly wrong with the syntax. Post what you find here including the quotes if you don't see a problem. In any case I bet it's because the title contains an extra character or "Windows Explorer - " in it.

 

BTW I see no need for the "Home" text type. At least it's not needed for the repeat.

 

Also you do realize having Windows Explorer open isn't required for Repeat with Folder, right?

 

Thanks Cory. I've figured out the reason. The folder name I captured was the displayed folder name, not the full name with path. Repeat with Folder needs the full path.

 

I have long since had this XP setting unchecked

Tools > Folder Options > View > Display the full path in the title bar

because showing the full path of deeply located sub-folders makes it difficult to distinguish them (unless you make the windows very wide). As soon as I enabled that setting, the macro works OK. So I have a dilemma now. It would be good to have an ME command, like 'Variable set String > From topmost folder path & name'.

 

I'd opened the folder so that I could capture its name, making the macro more versatile. But on your other point, no, I hadn't realised the Repeat would ignore any selection already made; I see now it processes the entire folder contents, from start to finish.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Keep in mind that Windows Explorer is a program that is running. True, it is a part of Windows, but it is a separate program.

 

The Windows Explorer program allows a user to view and change files but it is just a view of the files and folders that exist on the hard drive. Macro commands like Repeat with Folder work with the files and folders on the hard drive. These macro commands do not interact with Windows Explorer itself.

 

There is a macro command to get the 'Current Directory'. The current directory is a hold over from the DOS days when there was not a way to visually view the file and folder structure. The current directory has no bearing on what is displayed in Windows Explorer.

 

So, what you are asking for is a command to get the file and folder that the program Windows Explorer has on top.

Link to comment
Share on other sites

Keep in mind that Windows Explorer is a program that is running. True, it is a part of Windows, but it is a separate program.

 

The Windows Explorer program allows a user to view and change files but it is just a view of the files and folders that exist on the hard drive. Macro commands like Repeat with Folder work with the files and folders on the hard drive. These macro commands do not interact with Windows Explorer itself.

 

There is a macro command to get the 'Current Directory'. The current directory is a hold over from the DOS days when there was not a way to visually view the file and folder structure. The current directory has no bearing on what is displayed in Windows Explorer.

 

So, what you are asking for is a command to get the file and folder that the program Windows Explorer has on top.

 

Yes. That's what I've asked for via the Request route.

 

Can you think of any alternative way of getting the full path-filename of that topmost folder, apart from changing the XP folder option that displays it?

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

Back in the ME3 forum a guy showed us how to get the file path of a file one right clicked on. I think it's the same method that "Command Prompt Here" works. Also I use a simple little DLL called ClipPath that adds a shell extension to grab a variety of different paths from whatever object you right click on and stick them on your clipboard. You might look at those for clues.

Link to comment
Share on other sites

Back in the ME3 forum a guy showed us how to get the file path of a file one right clicked on. I think it's the same method that "Command Prompt Here" works. Also I use a simple little DLL called ClipPath that adds a shell extension to grab a variety of different paths from whatever object you right click on and stick them on your clipboard. You might look at those for clues.

 

 

Thanks. Just took a look at http://downloads.zdnet.co.uk/0,1000000375,...925s,00.htm?r=2 where I see this 'Publisher's Description of ClipPath':

"As a Programmer, we are often required to set the path or classpath Environment variables. But Windows Operating does not allow us to copy the full path of a file or a folder,say, c:\temp\try.java to clipboard so that we can paste the same anywhere we require. Clip Path utility tries to solve these problems. It is a windows Shell Extension Program. Once installed, you can copy full path of a file or folder to clipboard."

 

That sounds like it does what I've been doing for years with Powertoys Send To. I r-click a filename and choose 'Send to > Clipboard as Name' The full path-filename can then be pasted anywhere.

 

--

Terry, East Grinstead, UK

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...