Jump to content

ember

Members
  • Posts

    35
  • Joined

  • Last visited

Posts posted by ember

  1. hello everyone, i need a little help on creating something on a webpage, that inside a table, there is some text, and on the side of it there is a button where you can click to display a little picture that can assist you at understanding the text better. something like the viamichelin.com page, where you can create a travel route, and near the driving directions, there is a button where you can click to display the map of the indicated area. the problem is that i don't know how this can be done. and in this case, the data is static, not like in viamichelin, where it is influenced by the route you create.can anyone help me on this?best regards, ember

  2. I don't know what happened, but a part of the code was eaten over there!i'll try to post it again:

    	<%' In this demo, at least, we don't allow user to change directories...' Change the DIRECTORY to point to any virtual directory of your choice.CONST DIRECTORY = "/" ' relative path in virtual directories 'These consts are only valid for default file-folders 'virtual folders may have their own ids! Const FILE_NAME = 0 CONST FILE_SIZE = 1 CONST FILE_TYPE = 2 CONST FILE_MODIFIED = 3 Const FILE_CREATED = 4 Const FILE_ACCESSED = 5 Const FILE_OWN = 8 Const FILE_AUT = 10 ' get requested sort order, if not first time here...' (forward by name is default)req = Request("sortBy")If Len(req) < 1 Then sortBy = 0 Else sortBy = CInt(req)req = Request("priorSort")If Len(req) < 1 Then priorSort = -1 Else priorSort = CInt(req)'' did user ask for same sort? to reverse the order?' but if so, then zap priorSort so clicking again will do forward!If sortBy = priorSort Then    reverse = true    priorSort = -1Else    reverse = false    priorSort = sortByEnd If' now start the *real* code...'Dim path Dim sh Dim oShellFolder Dim theFiles Dim info path = Server.MapPath( DIRECTORY ) Set sh = CreateObject("Shell.Application") Set oShellFolder = sh.Namespace( path ) theFiles = getItemsInfo(oShellFolder) For Each info in theFiles                       Next Function getItemsInfo (oShF)         Dim ######em               Dim currentSlot         Dim p         Dim fname         Dim fext         Dim ftype               Dim fcreate         Dim fmod         Dim faccess         Dim fsize         Dim fauthor         Dim fowner         ReDim theFiles(oShF.Items.Count-1)         currentSlot = -1         For Each ######em in oShF.Items 		                                   fname = ######em.Name                     p = instrrev(fname,".")                 If (p> 0) Then fext = Mid(fname, p+1,len(fname)) Else fext = fname                ftype = oShF.GetDetailsOf(######em, FILE_TYPE)                     fsize = oShF.GetDetailsOf(######em, FILE_SIZE)                             fmod = oShF.GetDetailsOf(######em, FILE_MODIFIED)                                                 fcreate = oShF.GetDetailsOf(######em, FILE_CREATED)                 faccess = oShF.GetDetailsOf(######em, FILE_ACCESSED)                 fauthor = oShF.GetDetailsOf(######em, FILE_AUT)                   fowner = oShF.GetDetailsOf(######em, FILE_OWN)                 currentSlot = currentSlot + 1                 theFiles(currentSlot) = Array(fname, fext, ftype, fsize, fmod, fauthor, fowner)          Next        getItemsInfo = theFiles '' files are now in the array...'' As noted, it is actually an ARRAY *OF* ARRAYS. Which makes' picking the column we will sort on easier!'' ...size and sort it...fileCount = currentSlot ' actually, count is 1 more, since we start at 0ReDim Preserve theFiles( currentSlot ) ' really not necessary...just neater!' First, determine which "kind" of sort we are doing.' (VarType=8 means "string")'If VarType( theFiles( 0 )( sortBy ) ) = 8 Then    If reverse Then kind = 1 Else kind = 2 ' sorting strings...Else    If reverse Then kind = 3 Else kind = 4 ' non-strings (numbers, dates)End If'' A simple bubble sort for now...easier to follow the code...'For i = fileCount TO 0 Step -1    minmax = theFiles( 0 )( sortBy )    minmaxSlot = 0    For j = 1 To i        Select Case kind ' which kind of sort are we doing?        ' after the "is bigger/smaller" test (as appropriate),        ' mark will be true if we need to "remember" this slot...        Case 1 ' string, reverse...we do case INsensitive!            mark = (strComp( theFiles(j)(sortBy), minmax, vbTextCompare ) < 0)        Case 2 ' string, forward...we do case INsensitive!            mark = (strComp( theFiles(j)(sortBy), minmax, vbTextCompare ) > 0)        Case 3 ' non-string, reverse ...            mark = (theFiles( j )( sortBy ) < minmax)        Case 4 ' non-string, forward ...            mark = (theFiles( j )( sortBy ) > minmax)        End Select        ' so is the current slot bigger/smaller than the remembered one?        If mark Then            ' yep, so remember this one instead!            minmax = theFiles( j )( sortBy )            minmaxSlot = j        End If    Next    ' is the last slot the min (or max), as it should be?    If minmaxSlot <> i Then        ' nope...so do the needed swap...        temp = theFiles( minmaxSlot )        theFiles( minmaxSlot ) = theFiles( i )        theFiles( i ) = temp    End IfNext' Ta-da! The array is sorted!'%>

    i don't know why, but a part of the code was munched when i pasted it!so here comes the first part, and in the next reply will be the second.here comes the second part:

    <FORM Name="doSort" Method="Get"><INPUT Type=Hidden Name=priorSort Value="<% = priorSort %>"><INPUT Type=Hidden Name=sortBy Value="-1"></FORM><script Language="JavaScript">function reSort( which ){    document.doSort.sortBy.value = which;    document.doSort.submit( );}</SCRIPT><CENTER><b></b><FONT class=normal bgColor=#cecfce width="100%"><font face="Arial" size="4"></b></FONT></font><p> </p><p><FONT class=normal bgColor=#cecfce width="100%"><font face="Arial" size="4"> Showing <% = (fileCount+1) %> files from directory <% = path %></FONT></p><P></P><P></P><p> </p><p> </p><TABLE Border=0 CellPadding=3><TR>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(0);">File name</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(1);">Extension</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(2);">Type</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(3);">Size</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(4);">Last modified</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(5);">Author</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(6);">Owner</A></TH></TR><%'With the array nicely sorted, this part is a piece of cake!For i = 0 To fileCount   Response.Write "<TR class=normal>" & vbNewLine    For j = 0 To UBound( theFiles(i) )        Response.Write "    <TD><a href= """ & path & "/" & fname & """ >"& theFiles(i)(j) & "</a></TD>" & vbNewLine    Next    Response.Write "</TR>" & vbNewLineNextEnd Function%>

    about the filters, the user should be able to filter the results on every item that appears. i'm a little stuck with this, it's in these time that i realise how little i know about ASP =/thanks everyone,ember

  3. sure, here it goes :)

    <%' In this demo, at least, we don't allow user to change directories...' Change the DIRECTORY to point to any virtual directory of your choice.CONST DIRECTORY = "/" ' relative path in virtual directories'Option Explicit 'These consts are only valid for default file-folders 'virtual folders may have their own ids! Const FILE_NAME = 0 CONST FILE_SIZE = 1 CONST FILE_TYPE = 2 CONST FILE_MODIFIED = 3 Const FILE_CREATED = 4 Const FILE_ACCESSED = 5 Const FILE_OWN = 8 Const FILE_AUT = 10 ' get requested sort order, if not first time here...' (forward by name is default)req = Request("sortBy")If Len(req) < 1 Then sortBy = 0 Else sortBy = CInt(req)req = Request("priorSort")If Len(req) < 1 Then priorSort = -1 Else priorSort = CInt(req)'' did user ask for same sort? to reverse the order?' but if so, then zap priorSort so clicking again will do forward!If sortBy = priorSort Then	reverse = true	priorSort = -1Else	reverse = false	priorSort = sortByEnd If' now start the *real* code...'Dim path Dim sh Dim oShellFolder Dim theFiles Dim info path = Server.MapPath( DIRECTORY ) Set sh = CreateObject("Shell.Application") Set oShellFolder = sh.Namespace( path ) theFiles = getItemsInfo(oShellFolder) 'dump result, replace WSH.Echo for ASP For Each info in theFiles					   		'WSH.Echo join(info ,"*") Next 'WSH.StdIn.ReadLine() ' Function getItemsInfo (oShF) 		Dim ######em	   		Dim currentSlot 		Dim p 		Dim fname 		Dim fext 		Dim ftype	   		Dim fcreate 		Dim fmod 		Dim faccess 		Dim fsize 		Dim fauthor 		Dim fowner 		ReDim theFiles(oShF.Items.Count-1) 		currentSlot = -1 		For Each ######em in oShF.Items 		 'if ######em.isFolder Then ######em.GetFolder		 		 						 fname = ######em.Name	 				p = instrrev(fname,".") 				If (p> 0) Then fext = Mid(fname, p+1,len(fname)) Else fext = fname				ftype = oShF.GetDetailsOf(######em, FILE_TYPE)	 				fsize = oShF.GetDetailsOf(######em, FILE_SIZE)			 				fmod = oShF.GetDetailsOf(######em, FILE_MODIFIED)								 				fcreate = oShF.GetDetailsOf(######em, FILE_CREATED) 				faccess = oShF.GetDetailsOf(######em, FILE_ACCESSED) 				fauthor = oShF.GetDetailsOf(######em, FILE_AUT)   				fowner = oShF.GetDetailsOf(######em, FILE_OWN) 				currentSlot = currentSlot + 1 				theFiles(currentSlot) = Array(fname, fext, ftype, fsize, fmod, fauthor, fowner) 		 		 'end ifNext		getItemsInfo = theFiles 'End Function '' files are now in the array...'' As noted, it is actually an ARRAY *OF* ARRAYS. Which makes' picking the column we will sort on easier!'' ...size and sort it...fileCount = currentSlot ' actually, count is 1 more, since we start at 0ReDim Preserve theFiles( currentSlot ) ' really not necessary...just neater!' First, determine which "kind" of sort we are doing.' (VarType=8 means "string")'If VarType( theFiles( 0 )( sortBy ) ) = 8 Then	If reverse Then kind = 1 Else kind = 2 ' sorting strings...Else	If reverse Then kind = 3 Else kind = 4 ' non-strings (numbers, dates)End If'' A simple bubble sort for now...easier to follow the code...'For i = fileCount TO 0 Step -1	minmax = theFiles( 0 )( sortBy )	minmaxSlot = 0	For j = 1 To i		Select Case kind ' which kind of sort are we doing?		' after the "is bigger/smaller" test (as appropriate),		' mark will be true if we need to "remember" this slot...		Case 1 ' string, reverse...we do case INsensitive!			mark = (strComp( theFiles(j)(sortBy), minmax, vb script:reSort(0);">File name</A></TH>	<TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(1);">Extension</A></TH>	<TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(2);">Type</A></TH>	<TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(3);">Size</A></TH>	<TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(4);">Last modified</A></TH>	<TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(5);">Author</A></TH>	<TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(6);">Owner</A></TH></TR><%'With the array nicely sorted, this part is a piece of cake!For i = 0 To fileCount   Response.Write "<TR class=normal>" & vbNewLine	For j = 0 To UBound( theFiles(i) )		Response.Write "	<TD><a href= """ & path & "/" & fname & """ >"& theFiles(i)(j) & "</a></TD>" & vbNewLine	'End Function	Next	Response.Write "</TR>" & vbNewLineNextEnd Function%>

    i still have some tweaking to do, that's to make the script also scan folders inside the root folder, and where it displays the name of the file for it to have a link to the file.thanks everyone!

  4. i've thought about that, also, but as you may have noticed, i'm a newbie on asp... it has to display the results and only after that be able to filter them, using something like javascript dropdown navigation menus or something similar.i didn't quite understand your question about the files though...anyway, thanks for your reply :)

  5. Hello everyone. i've been learning a lot here in the past few weeks, but unfortunately it's not enough for what i need now...Here it goes:I have an ASP script wich scans a given directory and returns information on the files inside it (name, type, size, date last mod, owner and author). Everything works fine, but now i need a new element on this - a way to filter the results. someone i know has told me something about recordsets, but all the info i can find is about connections with Access databases.so, i'd like to ask if there is a way to sort my problem out, and if you know any links or online documentation to do so.best regards and thanks in advance, ember

  6. finally, it's working!it didn't work exactly after the re-registering process, but after searching for the obtained errors on google and re-registering a few more dll's, it's working just fine!thankyou very much, justsomeguy!

  7. One thing to make sure is that the IUSR_computer and IWAM_computer accounts are both activated and not disabled. Do you know how to check that?
    unfortunately, no, i don't =/and how can i re-register vbscript.dll & asp.dll ??thanks,ember
  8. this is what i got (i don't understand anything :S)The system has called a custom component and that component has failed and generated an exception. This indicates a problem with the custom component. Notify the developer of this component that a failure has occurred and provide them with the information below. Component Prog ID: Server Application ID: {3D14228D-FBE1-11D0-995D-00C04FD919C1}Server Application Instance ID:{11F3695B-3594-48F2-A6FE-DA6BCE004257}Server Application Name: IIS Out-Of-Process Pooled ApplicationsThe serious nature of this error has caused the process to terminate.Exception: C0000005Address: 0x77514164Call Stack: ole32!CoFreeUnusedLibrariesEx + 0xC1Aole32!CoFreeUnusedLibrariesEx + 0xB5Eole32!CLSIDFromString + 0x66Dole32!CoRegisterClassObject + 0x1CA2ole32!UpdateDCOMSettings + 0x53ACole32!CoQueryAuthenticationServices + 0x1F30ole32!CoQueryAuthenticationServices + 0x28FCole32!CoWaitForMultipleHandles + 0x6E2CRPCRT4!CheckVerificationTrailer + 0x75RPCRT4!NdrStubCall2 + 0x215RPCRT4!CStdStubBuffer_Invoke + 0x82ole32!StgGetIFillLockBytesOnFile + 0x10439ole32!StgGetIFillLockBytesOnFile + 0x103E3ole32!CoReleaseMarshalData + 0x7DCole32!CoReleaseMarshalData + 0x701ole32!StgGetIFillLockBytesOnFile + 0x10319ole32!StgGetIFillLockBytesOnFile + 0x101C4ole32!StgGetIFillLockBytesOnFile + 0xFF1DRPCRT4!NdrGetTypeFlags + 0x1C9RPCRT4!NdrGetTypeFlags + 0x12ERPCRT4!NdrGetTypeFlags + 0x5ARPCRT4!CreateStubFromTypeInfo + 0x2E2RPCRT4!CreateStubFromTypeInfo + 0x323RPCRT4!NdrConformantArrayFree + 0x28BRPCRT4!I_RpcBCacheFree + 0x14CRPCRT4!I_RpcBCacheFree + 0x5EARPCRT4!I_RpcBCacheFree + 0x403RPCRT4!I_RpcBCacheFree + 0x5D2kernel32!GetModuleFileNameA + 0x1B4

  9. hello everyone. i'm a little confused with the results i'm obtaining from the following script:

    <%CONST DIRECTORY = "/" ' relative path in virtual directories'missing file info	fileown = 8	fileat = 10' Specify one of these constants for "sortBy"...CONST FILE_NAME = 0CONST FILE_EXT = 1CONST FILE_TYPE = 2CONST FILE_SIZE = 3CONST FILE_CREATED = 4CONST FILE_MODIFIED = 5CONST FILE_ACCESSED = 6' get requested sort order, if not first time here...' (forward by name is default)req = Request("sortBy")If Len(req) < 1 Then sortBy = 0 Else sortBy = CInt(req)req = Request("priorSort")If Len(req) < 1 Then priorSort = -1 Else priorSort = CInt(req)'' did user ask for same sort? to reverse the order?' but if so, then zap priorSort so clicking again will do forward!If sortBy = priorSort Then    reverse = true    priorSort = -1Else    reverse = false    priorSort = sortByEnd If' now start the *real* code...'path = Server.MapPath( DIRECTORY )Set sh = CreateObject("Shell.Application")  set fl = sh.Namespace( path )Set fso = CreateObject("Scripting.FileSystemObject")Set theCurrentFolder = fso.GetFolder( path )Set curFiles = theCurrentFolder.Files'' And now a loop for the files'Dim theFiles( )ReDim theFiles( 500 ) ' arbitrary size!currentSlot = -1 ' start before first slot' We collect all the info about each file and put it into one' "slot" in our "theFiles" array.'For Each fileItem in curFiles    fname = fileItem.Name    fext = InStrRev( fname, "." )    If fext < 1 Then fext = "" Else fext = Mid(fname,fext+1)    ftype = fileItem.Type    fsize = fileItem.Size    fcreate = fl.GetDetailsOf(f,fileat)    'fcreate = fileItem.DateCreated    fmod = fileItem.DateLastModified    'faccess = fileItem.DateLastAccessed    faccess = fl.GetDetailsOf(f,fileow)        currentSlot = currentSlot + 1    If currentSlot > UBound( theFiles ) Then        ReDim Preserve theFiles( currentSlot + 99 )    End If    ' note that what we put here is an array!    theFiles(currentSlot) = Array(fname,fext,ftype,fsize,fcreate,fmod,faccess)Next'' files are now in the array...'' As noted, it is actually an ARRAY *OF* ARRAYS. Which makes' picking the column we will sort on easier!'' ...size and sort it...fileCount = currentSlot ' actually, count is 1 more, since we start at 0ReDim Preserve theFiles( currentSlot ) ' really not necessary...just neater!' First, determine which "kind" of sort we are doing.' (VarType=8 means "string")'If VarType( theFiles( 0 )( sortBy ) ) = 8 Then    If reverse Then kind = 1 Else kind = 2 ' sorting strings...Else    If reverse Then kind = 3 Else kind = 4 ' non-strings (numbers, dates)End If'' A simple bubble sort for now...easier to follow the code...'For i = fileCount TO 0 Step -1    minmax = theFiles( 0 )( sortBy )    minmaxSlot = 0    For j = 1 To i        Select Case kind ' which kind of sort are we doing?        ' after the "is bigger/smaller" test (as appropriate),        ' mark will be true if we need to "remember" this slot...        Case 1 ' string, reverse...we do case INsensitive!            mark = (strComp( theFiles(j)(sortBy), minmax, vb script:reSort(0);">File name</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(1);">Extension</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(2);">Type</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(3);">Size</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(4);">Author</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(5);">Last modified</A></TH>    <TH bgcolor=#CECFCE class=normal align=center><A HREF="java script:reSort(6);">Author</A></TH></TR><%' With the array nicely sorted, this part is a piece of cake!For i = 0 To fileCount    Response.Write "<TR class=normal>" & vbNewLine    For j = 0 To UBound( theFiles(i) )        Response.Write "    <TD>" & theFiles(i)(j) & "</TD>" & vbNewLine    Next    Response.Write "</TR>" & vbNewLineNext%> 

    in the Owner/Author items, instead of returning the info about the file, it returns the type of info, in all files!example:instead of returning this,file | owner | author |1.jpg| ember | e1brpt |2.jgp| bruno |b1brpt |it returns this:file |owner |author |1.jpg |owner |author |2.jpg |owner |author |can anyone help me correct this?thanks in advance, ember

  10. hello!there are developments!i made it to adapt the script to work with virtual directories, but there is a misshap that i dont understand:when calling the "CreateObject(Shell.Application)" instead of, i.e., returning the date created (12-05-2004) it returns the name of the object ("date created" instead of "12-05-2004"). what could be causing this?thanks in advance,ember

  11. thanks!here it goes:<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><% filesz = 0 fileown = 8 srv = Request.ServerVariables("SERVER_SOFTWARE") if instr(srv,"/5.0")>0 then filesz = 1 filecr = 6 fileac = 7 fileat = 10 elseif instr(srv,"/5")>0 or instr(srv,"/6")>0 then filesz = 1 filecr = 4 fileac = 5 fileat = 9 end if if filesz > 0 then folder = "C:\Documents and Settings\bb79brg\Desktop\" response.write "<b>File listing for " & folder & "</b><p>" response.write "<table border=0 cellpadding=5 cellspacing=1 align=center>" response.write "<tr>" response.write "<th bgcolor=#CECFCE align=center>Nome</th>" response.write "<th bgcolor=#CECFCE align=center>Tipo</th>" response.write "<th bgcolor=#CECFCE align=center>Tamanho</th>" response.write "<th bgcolor=#CECFCE align=center>Última Modificação</th>" response.write "<th bgcolor=#CECFCE align=center>Proprietário</th>" response.write "<th bgcolor=#CECFCE align=center>Autor</th>" response.write "</tr>" tds = "<td><nobr> " tde = " </nobr></td>" Set sh = CreateObject("Shell.Application") set fl = sh.Namespace(folder) for each f in fl.Items if not f.IsFolder then p = f.path fn = right(p, len(p)-instrRev(p,"\")) response.write "<tr>" & _ tds & fn & tde & _ tds & f.type & tde & _ tds & fl.GetDetailsOf(f,filesz) & tde & _ tds & f.modifyDate & tde & _ tds & fl.GetDetailsOf(f,fileown) & tde & _ tds & fl.GetDetailsOf(f,fileat) & tde & _ "</tr>" end if next set fl = nothing set sh = nothing response.write "</table>" else response.write "Unable to process results." end if %> </body></html>thanks in advance :)

  12. thanks, it worked just fine =)but there are 2 little things:1st, it only works with physical drives, and i need it to work with virtual drives and relative paths.2nd, i need to have a sort of the files.any ideas?i found a script that solved these problems, but it doens't show the attributes i need, and I don't know how to "mix" them together...if needed i'll provide the code i'm using.thanks everyone,ember

×
×
  • Create New...