Delete File

Delete File

Anonymous
Not applicable
631 Views
15 Replies
Message 1 of 16

Delete File

Anonymous
Not applicable
I am deleting a file use FSO...

Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(sExistingDoc) Then
filesys.DeleteFile sExistingDoc
End If


The problem is the directory does not refresh, has to be refreshed manually. Does any one know how to refresh the directory?

Windows XP, Autocad 2000i
0 Likes
632 Views
15 Replies
Replies (15)
Message 2 of 16

Anonymous
Not applicable
why would you not just use the Kill statement?

wrote in message news:5751262@discussion.autodesk.com...
I am deleting a file use FSO...

Dim filesys
Set filesys = CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(sExistingDoc) Then
filesys.DeleteFile sExistingDoc
End If


The problem is the directory does not refresh, has to be refreshed manually.
Does any one know how to refresh the directory?

Windows XP, Autocad 2000i
0 Likes
Message 3 of 16

Anonymous
Not applicable
I wasnt aware of the Kill statement.

I modified the code to use the kill statement but I still have to manually refresh the folder.
0 Likes
Message 4 of 16

Anonymous
Not applicable
what do you mean by refresh? are talking a windows explorer window that
displays the list files?

wrote in message news:5751297@discussion.autodesk.com...
I wasnt aware of the Kill statement.

I modified the code to use the kill statement but I still have to manually
refresh the folder.
0 Likes
Message 5 of 16

Anonymous
Not applicable
yes, a windows explorer window.

this directory is on my local drive

basically, what I am doing....
I am copying a file out to a network folder. Deleting the original file, then creating a shortcut to the new file and placing the shortcut in the orginal directory. problem is until I manually refresh the original directory the orginal file still apears there.
0 Likes
Message 6 of 16

Anonymous
Not applicable
i dont mean to be a brick but why is this a problem? why would you care that
the view gets refreshed?

wrote in message news:5751314@discussion.autodesk.com...
yes, a windows explorer window.

this directory is on my local drive

basically, what I am doing....
I am copying a file out to a network folder. Deleting the original file,
then creating a shortcut to the new file and placing the shortcut in the
orginal directory. problem is until I manually refresh the original
directory the orginal file still apears there.
0 Likes
Message 7 of 16

Anonymous
Not applicable
cuz there are a few people in our engineering department that are not very computer savvy. if the original file is still showing in the directory, it will just confuse the hell out of them.
0 Likes
Message 8 of 16

Anonymous
Not applicable
If you happen to know (or can get) the caption of the Explorer window the
following hack might work.

AppActivate "Caption of currently displayed Explorer window"
SendKeys vbKeyF5 'Refresh active window
0 Likes
Message 9 of 16

Anonymous
Not applicable
Hi,

Press F5 in Windows Explorer and there is a faint chance it will do what it
is supposed to and refresh. The best way is to restart Windows Explorer.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
wrote in message news:5751377@discussion.autodesk.com...
cuz there are a few people in our engineering department that are not very
computer savvy. if the original file is still showing in the directory, it
will just confuse the hell out of them.
0 Likes
Message 10 of 16

Anonymous
Not applicable
problem with that is the window caption may be different on everyones pc depending on their settings.
0 Likes
Message 11 of 16

Anonymous
Not applicable
The caption of the "Explorer" window should be whatever directory it is
looking at. If it is not the directory you just manipulated there should be
no problem. Explorer should refresh automatically when your user switches to
the target directory and the "phantom" file should be gone.

Nonetheless, it's still a big time hack. I hope someone offers better.
0 Likes
Message 12 of 16

Anonymous
Not applicable
I tried it and that does not seem to work...
0 Likes
Message 13 of 16

Anonymous
Not applicable
i think he wants to refresh programmatically.

"Laurie Comerford" wrote in message
news:5751448@discussion.autodesk.com...
Hi,

Press F5 in Windows Explorer and there is a faint chance it will do what it
is supposed to and refresh. The best way is to restart Windows Explorer.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
wrote in message news:5751377@discussion.autodesk.com...
cuz there are a few people in our engineering department that are not very
computer savvy. if the original file is still showing in the directory, it
will just confuse the hell out of them.
0 Likes
Message 14 of 16

Anonymous
Not applicable
Hi,

To manipulate Windows Explorer I would expect a need to use Windows API
calls. There is any amount of documentation for these on the Web.

From my experience with Windows Explorer, I would be inclined to start a new
instance of it which should be relatively easy.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
"Steve" wrote in message
news:5751489@discussion.autodesk.com...
i think he wants to refresh programmatically.

"Laurie Comerford" wrote in message
news:5751448@discussion.autodesk.com...
Hi,

Press F5 in Windows Explorer and there is a faint chance it will do what it
is supposed to and refresh. The best way is to restart Windows Explorer.

--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
wrote in message news:5751377@discussion.autodesk.com...
cuz there are a few people in our engineering department that are not very
computer savvy. if the original file is still showing in the directory, it
will just confuse the hell out of them.
0 Likes
Message 15 of 16

Anonymous
Not applicable
See "Shell.Application" and "WScript.Shell" on MSDN.

You can try using the MinimizeAll and UndoMinimizeAll
methods, if you can't find a more direct method.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5751451@discussion.autodesk.com...
problem with that is the window caption may be different on everyones pc depending on their settings.
0 Likes
Message 16 of 16

Anonymous
Not applicable
I havent been able to get the SendKeys method to work consistantly... I am trying to run this after the main form is unloaded and before the macro is unloaded.

I havent been able to find info on doing this via API, does anyone have examples of that?
0 Likes