Display Dir contents

P

paul h

Hi,

I am automating a few processes in my office - creating customer files
and folders that then need to be worked with manually. Once they have
been created, I need to open the root folder and display it with it's
contents, so that the user can then work directly on the files without
having to navigate to the folder.

Is there a way with ruby to pop a folder open and to the top of the z
order? Couldn't find anything by googling.

(The machines in the office all run win7)

Thanks

Paul
 
J

Jeremy Bopp

Hi,

I am automating a few processes in my office - creating customer files
and folders that then need to be worked with manually. Once they have
been created, I need to open the root folder and display it with it's
contents, so that the user can then work directly on the files without
having to navigate to the folder.

Is there a way with ruby to pop a folder open and to the top of the z
order? Couldn't find anything by googling.

(The machines in the office all run win7)

Since this only needs to be a Windows solution, try the following:

system("start C:/path/to/interesting/directory")

This will kick off the Windows file browser to the path you indicate.
Take care to quote the path if it may have spaces in it.

-Jeremy
 
Q

Quintus

Am 28.02.2011 20:20, schrieb paul h:
Hi,

I am automating a few processes in my office - creating customer files
and folders that then need to be worked with manually. Once they have
been created, I need to open the root folder and display it with it's
contents, so that the user can then work directly on the files without
having to navigate to the folder.

Is there a way with ruby to pop a folder open and to the top of the z
order? Couldn't find anything by googling.

(The machines in the office all run win7)

Thanks

Paul

Something like this (untested)?

system("explorer.exe C:\\your\\folder")

(Note the double backslash, you must escape backslashes in Ruby strings
if you type them in literally)

Vale,
Marvin
 
K

Kalman Hazins

[Note: parts of this message were removed to make it a legal post.]

No need for funky escaping. Just use single-quotes instead

system('explorer.exe C:\your\folder')

HTH,

-Kalman Hazins
 
P

Phillip Gawlowski

No need for funky escaping. Just use single-quotes instead

system('explorer.exe C:\your\folder')

Windows happily accepts forward slashes, too:

system "explorer C:/your/folder/path"

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
P

Paul Hollyer

Phillip Gawlowski wrote in post #984544:
Windows happily accepts forward slashes, too:

system "explorer C:/your/folder/path"

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

Thanks to everyone who replied - it's just what I need. I hadn't seen
the system method before but have just read up on it and it is going to
be useful in additional features I want to implement.

Cheers

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top