|
Post by kokenge on Jul 28, 2008 8:01:47 GMT -5
How do you get information about the root directory in windows.
I tried files #f, "C:\*" and get an error. Seems like you have to give it a directory to make it work. If you give it a valid directory such as files #f, "C:\www\*" it works.
|
|
|
Post by votan on Jul 28, 2008 8:30:39 GMT -5
You probably get a sharing violation error!? You can't do anything about it, unless you exclude all the systemfiles, that cause those errors (like hiberfil.sys).
|
|
|
Post by kokenge on Jul 28, 2008 8:39:47 GMT -5
Yep! Exactly the problem. But how do you get around it? Since I don't know who will be running the script, I have no control over their PC. Seems like it should not give an error on the "files" command, and you should be able to do a "on error" trap during NEXTFILE$() or something.
I'm trying to write my own file selection system since I've never been able to get the "upload" command to work. But it looks like there is no way to do it.
Forgot to mention. For the client side, I'm looking into the Google directory stuff. I assume I can get to it somehow with JavaScript. Has anyone written the JS api to Google's directory application
Thanks for the help.. Dan
|
|
|
Post by votan on Jul 28, 2008 9:07:19 GMT -5
Yes..... files that are not accessible by the "files" command should simple be ignored by default. But I wonder why it returns an sharing violation error at all, as the "files" command should just read the file properties and not access (open) the file itself!? Maybe you can create an array of allowed filetypes, then loop the "files" command through all the allowed filetypes, and let it construct a list of files then. That actually should work.... just with the problem that some filetypes will not be available in your upload-program.
|
|
|
Post by mackrackit on Jul 28, 2008 10:52:32 GMT -5
This came from mike in another thread. Change: DefaultDir$="c:\rbp\" in the second line to: DefaultDir$="c:\" You mike be able to do what you want. There is another version on the wiki also. Have you seen "do_upload from Alice on the wiki? OK, I think I have a solution which works ok for me with IE7. Try this RunBASIC program to browse your RB projects and enables hard copy printout of the code with single line spacing, from the browser. ' folderBrowser-fileSelector DefaultDir$="c:\rbp\" 'DefaultDir$="c:\rbp101b1\" 'for beta testers cssid #lbStyle1, "{width:300px;background-color:#FEFECD}"
[start] cls print "RB Folder browser" files #rbdir, DefaultDir$+"*" nFolders=#rbdir rowcount() dim folderList$(nFolders) for x = 1 to nFolders #rbdir nextfile$() if #rbdir isdir() then dir$ = #rbdir name$() if #rbdir hasanswer()then 'print dir$ folderList$(x)=dir$ end if end if next x listbox #lb, folderList$(),10 '#lb setid("lbStyle1") print:print link #sel, "[ul]",[select]
wait
[select] folderName$=#lb selection$() files #f,DefaultDir$;folderName$;"\*" nFiles=#f rowcount() dim fileList$(nFiles) for x = 1 to nFiles #f nextfile$() if #f isdir() then zz=0 'do nothing else fil$ = #f name$() if #f hasanswer()then 'print fil$ fileList$(x)=fil$ end if end if next x
cls listbox #lb, fileList$(),10 '#lb setid("lbStyle1") print:print link #L1, "[Another]", [start] link #L2, "[Accept selection]", [accept] wait
[accept] fName$=#lb selection$() if fName$<>"" then cls open folderName$+"\"+fName$ for input as #fi pf$=input$(#fi, lof(#fi)) close #fi html "<div style=""width:700px;word-wrap:break-word;font-family:Courier New,Courier,monospace;font-size:10pt"">" html "<pre>" print pf$ html "</pre>" print:print html "</div>" link #L1, "[Another]", [start] end if wait
|
|
|
Post by votan on Jul 28, 2008 11:25:15 GMT -5
Well, these programs would still return the error if they were used to access the root of c:/, as they do not prevent the "file" command from accessing any hidden system files. Changing the rootpath to c:/ in the config line is the same as directly using "files #f, "C:\*". But to make sure, I've tested it and of cause it still returns the same error. So I guess the "file" command needs some Carl-tweaking before it can be used in the c: root... Additional to that, the problem might only occour on Vista...!? But can not test this as I only run vista here....
|
|
|
Post by kokenge on Jul 28, 2008 11:37:54 GMT -5
Just tried the routine that Dave suggested and still get this error when I change the directory to "c:\" ----------------------------------------- Compile Error Syntax error - ERROR_SHARING_VIOLATION ("c:\hiberfil.sys") -----------------------------------------
Also tried the file upload he suggested and it logs out of RunBasic.
I'm running XP and get the same errors you get on Vista.
I Googled JavaScript for a directory routine, and they show some, but none of them work..
Got to be a answer out there somewhere!
Have a great day.. Dan
|
|
|
Post by mackrackit on Jul 28, 2008 11:55:12 GMT -5
My apologies. I should have tried it on XP or vista before I posted. Just tried on Vista and no go here too, The system I use it on is my Linux box... Funny how it works there just fine. Is there some "security'" setting in windows that can be changed?
|
|
Chris Iverson
Junior Member
There are many worlds, but they all share the same sky. One sky, one destiny.
Posts: 73
|
Post by Chris Iverson on Aug 29, 2008 23:18:28 GMT -5
I assume by Linux you mean on WINE, and the reason it works there is because it doesn't have the hiberfil.sys file. Hiberfil.sys is a system file used to save the current state when going into hibernation. Because of that, it is held very securely. If you want to remove the security on the file, you must turn off hibernation in your control panel.
|
|
|
Post by mackrackit on Aug 29, 2008 23:44:13 GMT -5
Yep, running with WINE.
Tried your suggestion on XP Home and now I get
ERROR_SHARING_VIOLATION("c:\pagefile.sys")
Guess this is not for windows. I am glade that I WINE ;D
|
|