You are not logged in.
Hi,
Today I found this strange thing: In the desktop I had a "Dragon.lnk" file and a "Dragon" folder, and when I tried to open the folder with ShellOpenFile(FilePath) it opened *.lnk instead.
I'm aware that windows (at least here on XP) usually treats *.lnk in peculiar way. For example, even if I always have the extension of my files visible, for *.lnk still don't appear. Also I tried with other type of files, but it didn't happen.
If this software has helped you, consider getting your pro version. :)
Offline
In both cases when ShellOpenFile is called with "C:\Path\Dragon" or "C:\Path\Dragon.lnk" it will open the "C:\Path\Dragon" folder.
I don't understand the problem. Could you describe your scenario step by step, highlighting expected and actual results?
Offline
In both cases when ShellOpenFile is called with "C:\Path\Dragon" or "C:\Path\Dragon.lnk" it will open the "C:\Path\Dragon" folder.
I don't understand the problem. Could you describe your scenario step by step, highlighting expected and actual results?
Ok, step by step... ¿?¿?¿? I'm not understanding what I'm getting, It seems like is giving me problems with '*.exe's too.
If you want to give it a try:
Put an exe in a folder. Let's say "shutter.exe", then you get a shortcuto of other DIFFERENT program but you call it also "shutter", and a folder also called "shutter"
You will have this three in the same directory.
Now you open ReNamer and you add this simple script: begin ShellOpenFile(FilePath); end.
then you can drag and drop each one of this 3 and see what happens.
What happens to me:
When I drag the EXE the EXE is opened
When I drag the LNK the LNK is opened
When I drag the FOLDER the EXE is opened (instead of the folder)
Now I delete the EXE
I drag the FOLDER and now the LNK is opened (instead of the folder)
Now I delete the LNK
I drag the FOLDER and now finally the FOLDER is opened
If this software has helped you, consider getting your pro version. :)
Offline
Ah, I understand now what's happening...
ShellOpenFile function in ReNamer uses ShellExecute WinAPI behind the scene with the operation parameter specified as "open". This operation handles various commands such as launching programs, opening documents with associated programs and even opening web pages using a default browser. The crucial bit is that it evaluates the command and determines exactly how to execute it. In case of the example below, when we call ShellOpenFile('C:\Test\Program') Windows automatically expands the path and actually calls 'C:\Test\Program.exe'. A simpler example is to call "ShellOpenFile('notepad')" which will actually call 'C:\Windows\notepad.exe'.
C:\Test\Program\ (folder)
C:\Test\Program.exe (executable)
C:\Test\Program.lnk (shortcut that points to another program)
Offline
ShellOpenFile function in ReNamer uses ShellExecute WinAPI behind the scene with the operation parameter specified as "open". This operation handles various commands such as launching programs, opening documents with associated programs and even opening web pages using a default browser. The crucial bit is that it evaluates the command and determines exactly how to execute it. In case of the example below, when we call ShellOpenFile('C:\Test\Program') Windows automatically expands the path and actually calls 'C:\Test\Program.exe'. A simpler example is to call "ShellOpenFile('notepad')" which will actually call 'C:\Windows\notepad.exe'.
Are you planning to try to solve it, or leave it like that? I don't exactly understand all the things in the documentation there, but listenining to what you said looks like doing this, the folder is opened correctly:
if (WideDirectoryExists(FilePath)) then
ShellOpenFile(FilePath + '\')
else
ShellOpenFile(FilePath);
Maybe it could be tweaked internally to avoid opening executables that sometimes can be dangerous? Or else, we should put a warning on the wiki?
If this software has helped you, consider getting your pro version. :)
Offline
I'm not going to change this function because it maps directly in to a WinAPI routine. However, I've added a warning in the Wiki: ReNamer:Pascal_Script:Functions#Process_Execution
By the way, if you want to force the "explore folder" mode then you can use something like that:
ShellOpenFile('explorer C:\Test\Folder');
Offline
By the way, if you want to force the "explore folder" mode then you can use something like that:
ShellOpenFile('explorer C:\Test\Folder');
I tried it with different instructions (explore, open, edit), but I couldn't make it work
ExecuteProgram('explorer C:\Test\Folder', False);
This does something, but looks like it's not a good idea for files. I don't know if i'll use it, but it's nice to know.
If this software has helped you, consider getting your pro version. :)
Offline
Put an exe in a folder. Let's say "shutter.exe", then you get a shortcuto of other DIFFERENT program but you call it also "shutter", and a folder also called "shutter"
You will have this three in the same directory.
Now you open ReNamer and you add this simple script: begin ShellOpenFile(FilePath); end.
then you can drag and drop each one of this 3 and see what happens.What happens to me:
When I drag the EXE the EXE is opened
When I drag the LNK the LNK is opened
When I drag the FOLDER the EXE is opened (instead of the folder)
Now I delete the EXE
I drag the FOLDER and now the LNK is opened (instead of the folder)
Now I delete the LNK
I drag the FOLDER and now finally the FOLDER is opened
Isn't this easily solved by simply making a minor modification to the code as shown below?
begin
ShellOpenFile(FilePath + '\');
end.
Offline
Isn't this easily solved by simply making a minor modification to the code as shown below?
begin ShellOpenFile(FilePath + '\'); end.
Nope, I have to put the code on #5 to make files open properly
Last edited by SafetyCar (2013-05-18 08:13)
If this software has helped you, consider getting your pro version. :)
Offline