Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
15
Erster Beitrag:
vor 4 Jahren, 8 Monaten
Letzter Beitrag:
vor 4 Jahren, 8 Monaten
Beteiligte Autoren:
Stefan Bentvelsen, Fabrice Harari, GuenterP, Al, Ola (at another machine), Arie

[WD17] Opening explorer in specific folder

Startbeitrag von Stefan Bentvelsen am 08.11.2013 16:06

Hi,

I'm trying to open the windows explorer from my application in a spcific folder.
The explorer opens fine, but in de folder user\Documents instead of the specified folder, i..e. "D:\MyExeDir\Relaties\345".

I use the following code:

MapOpen is string = StringBuild([
"%1" "%2"
],"EXPLORER.EXE",NaamPath)
ExeRun (MapOpen)

any hints are much appriciated.

Antworten:

Hi Stefan

you are using a long name for the directory, so you either need to add quotes around it or use fshortname of it instead

Best regards

von Fabrice Harari - am 08.11.2013 17:41
Hi Fabrice,

by using the stringbuild() command, there are quotes around it.
I've checked that in the debugger.

Or do I miss something, here ?

von Stefan Bentvelsen - am 08.11.2013 17:53
Hi Stefan,

What you are missing is a decent file manager:-)
I personally get bad rash, pimples and frustration when trying to use any Windows utilities:rp:
For file management I recommend the Total Commander. It's pure joy to use it. It has two file list windows and you can specify the start directory separately for both of them, as parameters, simply put like this:
EXERUN( "C:\totalcmd\TOTALCMD64.EXE /L= " + DirName1 + " /R=" + DirName2 )

Best regards
Ola

von Ola (at another machine) - am 08.11.2013 18:40
Hi Stefan

yes, you ARE missing something: the quotes around your directory name :-)

Let me explain: If you type your command in your command window, you will type something like:
MyProgram.exe "MyDirectoryStringHere"
And you can see that there are strings around the directory

BUT, in wlanguage, as soon as you do this:
sMyString is string="Toto"
you will SEE quotes around your string in the debugger, but the VALUE of the string is only TOTO (without the quotes)...

So, in your existing code, you are passing the directory WITHOUT quotes around it...
You would need to do something like :
NaamPath=charact(34)+"D:\MyExeDir\Relaties\345"+charact(34)
in order to ADD the quotes around your directory (If I remember correctly and the quote ascii value is 34.

Best regards

von Fabrice Harari - am 08.11.2013 22:05
Total Commander for sure :spos:

von Arie - am 09.11.2013 09:02
Hi Fabrice,

I have to disagree with you. :rolleyes:


By using the StringBuild() command with two sets of quotes in the base string:

MapOpen is string = StringBuild([
"%1" "%2"
],"EXPLORER.EXE",NaamPath)

I got a string with ""EXPLORER.EXE" "D:\MyDir\Exe\Relaties"" in it.
The debugger shows it as:

""EXPLORER.EXE" "D:\MyDir\Exe\Relaties""

so I'm sure that both the program AND the folder are between their own set of quotes,
and despite of that, it opens in the user\Documents folder. Only the foldername between quotes doesn't help either.

von Stefan Bentvelsen - am 09.11.2013 16:43
Hi Ola,

thanks for the suggestion, but the client do not want to learn another program.

von Stefan Bentvelsen - am 09.11.2013 16:45
Hi Stefan,

the following code works just fine here:



sMyString is string = "H:\My Projects\BackComfort\exe"
ExeRun("EXPLORER.EXE "+sMyString,exeActive,exeDontWait)



Note the space after EXPLORER.EXE

Is there anything more that you want to accomplish?

von GuenterP - am 09.11.2013 17:26
Hi Guenter,

thanks for your response.
I will try this next monday when I'am at work.

von Stefan Bentvelsen - am 09.11.2013 18:49
Hi Guenter,

I've tried your code, but it works like the other tries of me.

The explorer is opened, but in the folder C:\users\user\Documents and not in the folder I specified after 'Explorer.exe'. Could it have something to do with UAC? I'm using Windows 7.

von Stefan Bentvelsen - am 11.11.2013 07:49
Hi All,

my collegue has tested my code in a project of him and it works like it should !
The explorer is opened in the specified folder.

Could it be a setting in Windows, why it don't work on my pc ?

von Stefan Bentvelsen - am 11.11.2013 08:40
Hello Stefan

You may be right about the UAC getting in the way.
The code that Guenter posted works for me and I did a search on the MS site for command line switches in case that might work and this code works also

sMyString is string = " /e, /Root, /select,c:\windows\"
ExeRun("Explorer"+sMyString)


Your could test your string in the Run box from the MS Start button so if
Explorer /e, /Root, /select,c:\windows\
works in the run command then it should also work in your program

This is the MS Link
http://support.microsoft.com/kb/130510

Regards
Al

von Al - am 11.11.2013 08:59
Quote
Stefan Bentvelsen
Hi All,

my collegue has tested my code in a project of him and it works like it should !
The explorer is opened in the specified folder.

Could it be a setting in Windows, why it don't work on my pc ?


Hi Stefan,

some progress has been made .. we know that your PC / Windows has a problem. I assume that you did a log-in as an administrator, this should enable you to see all of the folders of your PC. The UAC will ask you only if you try to delete / rename a file. However, being a user, there may be settings which are stopping you at moving fgreely around on your computer. So, the decisive question is: are you really logged in as an administrator?

von GuenterP - am 11.11.2013 09:54

Re: [WD17] Opening explorer in specific folder (SOLVED)

Hi,

it was a silly misunderstanding. The code IS working OK, but not when the specified folder doesn't exist (anymore).

The program is a digital archive from a collegue of me, so I don't know all the ins and outs exact. It turned out that empty folders are automatically deleted. So after the first execution of the program, my test-folder was dissapeard and the next time, the "open folder" function starts in the C:\users\user\Documents map. I changed the code so that if the specified folder doesn't exist, the folder is changed one-level-higher. That works OK.

Thank you all for your help and effort.

von Stefan Bentvelsen - am 11.11.2013 10:46
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.