KimberlyJillPereira

How to match the date and time in my Excel to the picture in the folder?

11 posts in this topic

#1 ·  Posted

Using the alarm received parameter how to search for the picture that matches the year month day hour min and sec and by the name of the .jpg file the jpg file naming format is first letter is always m followed by last two digits of year then two digit month two digit day two digit hour two digit minute and two digit second then get that picture and paste it in Microsoft Excel.How to do it? Please help me. Thank you.:)

iii1.png

iii2.png

iii3.png

Share this post


Link to post
Share on other sites



#4 ·  Posted

@LarsJ please help

Share this post


Link to post
Share on other sites

#5 ·  Posted

Was a little bored, so put this together:

#include <Array.au3>
#include <Excel.au3>
#include <File.au3>

Local $oExcel = _Excel_Open()

Local $aImagePath
;~ Add Image Source Path
Local $sImagePath = "Y:\88_TanglinHaltRd\IllegalParking\88_TanglinHaltRd_Cam1\2017-02-24"
;~ Add Excel Spreadsheet Path
Local $sWorkbook = @ScriptDir & "\Results.xlsx"

Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)
$aWorkBook = _Excel_RangeRead($oWorkbook)
For $i = 1 To UBound($aWorkBook) - 1
    $aImagePath = _FileListToArray($sImagePath, "m" & StringTrimLeft($aWorkBook[$i][5], 2) & "*.jpg", 1, True)
    If UBound($aImagePath) >= 2 Then
        _Excel_PictureAdd($oWorkbook, Default, $aImagePath[1], "G" & $i + 1)
        $aImageSize = _ImageSize($aImagePath[1])
        $oRow = $oExcel.Rows($i + 1)
        $oRow.RowHeight = $aImageSize[1]
    EndIf
Next

;~ Malkeys code: https://www.autoitscript.com/forum/topic/108578-getting-image-size/
Func _ImageSize($sFileName)
    Local $aRet[2], $sExt = StringRegExpReplace($sFileName, "^.*\.", "")
    If (FileExists($sFileName) = 0) Or _
            ((StringLen($sExt) = 3) And (StringRegExp($sExt, "(?i)(bmp|gif|jpg|png|tif|emf|wmf)") = 0)) Or _
            ((StringLen($sExt) = 4) And (StringRegExp($sExt, "(?i)(tiff|jpeg)") = 0)) Then _
            Return SetError(1, 0, $aRet)
    Local $ghGDIPDll = DllOpen("GDIPlus.dll")
    Local $tInput = DllStructCreate("int Version;ptr Callback;int NoThread;int NoCodecs")
    Local $tToken = DllStructCreate("ulong_ptr Data")
    DllStructSetData($tInput, "Version", 1)
    DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", DllStructGetPtr($tToken), "ptr", DllStructGetPtr($tInput), "ptr", 0)
    Local $aImage = DllCall($ghGDIPDll, "int", "GdipLoadImageFromFile", "wstr", $sFileName, "ptr*", 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageWidth", "handle", $aImage[2], "uint*", -1)
    $aRet[0] = $aResult[2]
    $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageHeight", "handle", $aImage[2], "uint*", 0)
    $aRet[1] = $aResult[2]
    DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $aImage[2])
    DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ptr", DllStructGetData($tToken, "Data"))
    DllClose($ghGDIPDll)
    Return SetError(0, 0, $aRet)
EndFunc ;==>_ImageSize

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

@Subz I tried using this code but it didnt work. Please help me. Thanks.

Share this post


Link to post
Share on other sites

#7 ·  Posted

You have to be more specific, I know the code works because I tested it first, what errors are you getting?

Share this post


Link to post
Share on other sites

#8 ·  Posted

@Subz This is the error which I get--> IE.au3 T3.0-2 Warning from function _IEAttach, $_IESTATUS_NoMatch.

Share this post


Link to post
Share on other sites

#9 ·  Posted

#include <Array.au3>
#include <IE.au3>
#include <String.au3>
#include<Excel.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
;Author: Kimberly Jill Pereira
#cs ########################################################################################################
    #  Script Function:                                                                                    #
    #  It is an Auto Login bot. It also extracts specific data from table and store it in Microsoft Excel. #
#ce ########################################################################################################

Local $oIE
Local $oDivs
Local $aPageCount, $iPageCount
Local $aTable, $oTables
Local $aResults[0][7]
Local $oUserName, $oPassWord
Local $sUserName = "Oneberry"
Local $sPassWord = "Qwer1234"
Call("_ImageSize($sFileName)")
$oIE = _IECreate("http://www.timeview2.net/", 1); Opens IE browser
WinSetState("[ACTIVE]", "", @SW_MAXIMIZE);Maximize Internet Explorer window
$oForms = _IETagNameGetCollection($oIE, "form")
For $oForm In $oForms
    If $oForm.id = "UserLoginForm" Then
        $oUserName = _IEFormElementGetObjByName($oForm, "data[User][username]")
        _IEFormElementSetValue($oUserName, $sUserName)
        $oPassWord = _IEFormElementGetObjByName($oForm, "data[User][password]")
        _IEFormElementSetValue($oPassWord, $sPassWord)
        _IEFormSubmit($oForm)
    EndIf
Next

_IENavigate($oIE, "http://www.timeview2.net/alarms")
$oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If $oDiv.ClassName = "alarms index" Then
        $aPageCount = _StringBetween($oDiv.InnerText, "Page 1 of ", ", showing ")
        If @error Then Exit
        $iPageCount = Number($aPageCount[0])
    EndIf
Next

For $i = 1 To $iPageCount
    _IENavigate($oIE, "http://www.timeview2.net/alarms/index/group:All%20Groups/page:" & $i, 1)
    $oTables = _IETagNameGetCollection($oIE, "table")
    For $oTable In $oTables
        If $oTable.ClassName = "pageindex" Then
            $nTable = $oTable.NextElementSibling
            $aTable = _IETableWriteToArray($nTable, True)
            If UBound($aTable) - 1 > 0 And UBound($aTable, 2) = 7 Then
                If $i = 1 Then
                    _ArrayConcatenate($aResults, $aTable, 0)
                Else
                    _ArrayConcatenate($aResults, $aTable, 1)
                EndIf
                ExitLoop
            EndIf
        EndIf
    Next
 Next
 Local $oExcel = _Excel_Open(); Opens Microsoft Excel

Local $oWorkbook = _Excel_BookNew($oExcel); Create new Microsoft excel
WinSetState("[ACTIVE]", "", @SW_MAXIMIZE);Maximize Microsoft Excel window
_ArrayColDelete($aResults, 6)
 _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aResults, "A1"); write the data to A1 cell of Microsoft excel
$oWorkbook.Activesheet.range("A1:G1").Font.Bold = True ; set font to bold
_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Pictures", "G1"); write 'Pictures' to A1 cell
$oWorkbook.Activesheet.range("E2:F100").NumberFormat = "yyyy/mm/dd" & " hh:mm:ss" & " AM/PM" ;set E2 to F100 cell to date format in yyyy/mm/dd
$oExcel.ActiveSheet.Columns("A:G").AutoFit
$oColumns = $oExcel.Columns("G")
$oColumns.ColumnWidth = 40.86
$oRows = $oExcel.Rows("2:100");Expands row 2 until 100
$oRows.RowHeight = 198.75;Automatically expands row
Local $oExcel = _Excel_Open()

Local $aImagePath
;~ Add Image Source Path
Local $sImagePath = "Y:\88_TanglinHaltRd\IllegalParking\88_TanglinHaltRd_Cam1\2017-02-24"
;~ Add Excel Spreadsheet Path
Local $sWorkbook = @ScriptDir & "\Results.xlsx"

Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook)
$aWorkBook = _Excel_RangeRead($oWorkbook)
For $i = 1 To UBound($aWorkBook) - 1
    $aImagePath = _FileListToArray($sImagePath, "m" & StringTrimLeft($aWorkBook[$i][5], 2) & "*.jpg", 1, True)
    If UBound($aImagePath) >= 2 Then
        _Excel_PictureAdd($oWorkbook, Default, $aImagePath[1], "G" & $i + 1)
        $aImageSize = _ImageSize($aImagePath[1])
        $oRow = $oExcel.Rows($i + 1)
        $oRow.RowHeight = $aImageSize[1]
    EndIf
Next

;~ Malkeys code: https://www.autoitscript.com/forum/topic/108578-getting-image-size/
Func _ImageSize($sFileName)
    Local $aRet[2], $sExt = StringRegExpReplace($sFileName, "^.*\.", "")
    If (FileExists($sFileName) = 0) Or _
            ((StringLen($sExt) = 3) And (StringRegExp($sExt, "(?i)(bmp|gif|jpg|png|tif|emf|wmf)") = 0)) Or _
            ((StringLen($sExt) = 4) And (StringRegExp($sExt, "(?i)(tiff|jpeg)") = 0)) Then _
            Return SetError(1, 0, $aRet)
    Local $ghGDIPDll = DllOpen("GDIPlus.dll")
    Local $tInput = DllStructCreate("int Version;ptr Callback;int NoThread;int NoCodecs")
    Local $tToken = DllStructCreate("ulong_ptr Data")
    DllStructSetData($tInput, "Version", 1)
    DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", DllStructGetPtr($tToken), "ptr", DllStructGetPtr($tInput), "ptr", 0)
    Local $aImage = DllCall($ghGDIPDll, "int", "GdipLoadImageFromFile", "wstr", $sFileName, "ptr*", 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageWidth", "handle", $aImage[2], "uint*", -1)
    $aRet[0] = $aResult[2]
    $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageHeight", "handle", $aImage[2], "uint*", 0)
    $aRet[1] = $aResult[2]
    DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $aImage[2])
    DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ptr", DllStructGetData($tToken, "Data"))
    DllClose($ghGDIPDll)
    Return SetError(0, 0, $aRet)
EndFunc ;==>_ImageSize

Share this post


Link to post
Share on other sites

#10 ·  Posted

The full code is above.

Share this post


Link to post
Share on other sites

#11 ·  Posted

Not getting any errors, although I have fixed the code as it wasn't saving the document so no way for the code to associate images.

#include <Array.au3>
#include <IE.au3>
#include <String.au3>
#include<Excel.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
;Author: Kimberly Jill Pereira
#cs ########################################################################################################
    #  Script Function:                                                                                    #
    #  It is an Auto Login bot. It also extracts specific data from table and store it in Microsoft Excel. #
#ce ########################################################################################################

Local $sExcelPath = @ScriptDir
Local $sImagePath = "Y:\88_TanglinHaltRd\IllegalParking\88_TanglinHaltRd_Cam1\2017-02-24"

Local $oIE
Local $oDivs
Local $aPageCount, $iPageCount
Local $aTable, $oTables
Local $aTimeView[0][7]
Local $oUserName, $oPassWord
Local $sUserName = "Oneberry"
Local $sPassWord = "Qwer1234"
$oIE = _IECreate("http://www.timeview2.net/", 1); Opens IE browser
WinSetState("[ACTIVE]", "", @SW_MAXIMIZE);Maximize Internet Explorer window
$oForms = _IETagNameGetCollection($oIE, "form")
For $oForm In $oForms
    If $oForm.id = "UserLoginForm" Then
        $oUserName = _IEFormElementGetObjByName($oForm, "data[User][username]")
        _IEFormElementSetValue($oUserName, $sUserName)
        $oPassWord = _IEFormElementGetObjByName($oForm, "data[User][password]")
        _IEFormElementSetValue($oPassWord, $sPassWord)
        _IEFormSubmit($oForm)
    EndIf
Next

_IENavigate($oIE, "http://www.timeview2.net/alarms")
$oDivs = _IETagNameGetCollection($oIE, "div")
For $oDiv In $oDivs
    If $oDiv.ClassName = "alarms index" Then
        $aPageCount = _StringBetween($oDiv.InnerText, "Page 1 of ", ", showing ")
        If @error Then Exit
        $iPageCount = Number($aPageCount[0])
    EndIf
Next

For $i = 1 To $iPageCount
    _IENavigate($oIE, "http://www.timeview2.net/alarms/index/group:All%20Groups/page:" & $i, 1)
    $oTables = _IETagNameGetCollection($oIE, "table")
    For $oTable In $oTables
        If $oTable.ClassName = "pageindex" Then
            $nTable = $oTable.NextElementSibling
            $aTable = _IETableWriteToArray($nTable, True)
            If UBound($aTable) - 1 > 0 And UBound($aTable, 2) = 7 Then
                If $i = 1 Then
                    _ArrayConcatenate($aTimeView, $aTable, 0)
                Else
                    _ArrayConcatenate($aTimeView, $aTable, 1)
                EndIf
                ExitLoop
            EndIf
        EndIf
    Next
 Next
 Local $oExcel = _Excel_Open(); Opens Microsoft Excel

Local $oWorkbook = _Excel_BookNew($oExcel); Create new Microsoft excel
WinSetState("[ACTIVE]", "", @SW_MAXIMIZE);Maximize Microsoft Excel window
_ArrayColDelete($aTimeView, 6)
 _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aTimeView, "A1"); write the data to A1 cell of Microsoft excel
$oWorkbook.Activesheet.range("A1:G1").Font.Bold = True ; set font to bold
_Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "Pictures", "G1"); write 'Pictures' to G1 cell
$oWorkbook.Activesheet.range("E2:F100").NumberFormat = "yyyy/mm/dd" & " hh:mm:ss" & " AM/PM" ;set E2 to F100 cell to date format in yyyy/mm/dd
$oExcel.ActiveSheet.Columns("A:G").AutoFit
$oColumns = $oExcel.Columns("G")
$oColumns.ColumnWidth = 40.86
$oRows = $oExcel.Rows("2:100");Expands row 2 until 100
$oRows.RowHeight = 198.75;Automatically expands row

Local $sWorkbook = $sExcelPath & "\" & StringReplace(StringReplace($aTimeView[UBound($aTimeView) -1][4] & "-" & $aTimeView[1][4], ":", "-"), " ", "_") & "_TimeView.xlsx"
Local $oExcel = _Excel_BookSaveAs($oWorkbook, $sWorkbook)
$aWorkBook = _Excel_RangeRead($oWorkbook)
Local $aImagePath
For $i = 1 To UBound($aWorkBook) - 1
    $aImagePath = _FileListToArray($sImagePath, "m" & StringTrimLeft($aWorkBook[$i][5], 2) & "*.jpg", 1, True)
    If UBound($aImagePath) >= 2 Then
        _Excel_PictureAdd($oWorkbook, Default, $aImagePath[1], "G" & $i + 1)
        $aImageSize = _ImageSize($aImagePath[1])
        $oRow = $oExcel.Rows($i + 1)
        $oRow.RowHeight = $aImageSize[1]
    EndIf
Next

;~ Malkeys code: https://www.autoitscript.com/forum/topic/108578-getting-image-size/
Func _ImageSize($sFileName)
    Local $aRet[2], $sExt = StringRegExpReplace($sFileName, "^.*\.", "")
    If (FileExists($sFileName) = 0) Or _
            ((StringLen($sExt) = 3) And (StringRegExp($sExt, "(?i)(bmp|gif|jpg|png|tif|emf|wmf)") = 0)) Or _
            ((StringLen($sExt) = 4) And (StringRegExp($sExt, "(?i)(tiff|jpeg)") = 0)) Then _
            Return SetError(1, 0, $aRet)
    Local $ghGDIPDll = DllOpen("GDIPlus.dll")
    Local $tInput = DllStructCreate("int Version;ptr Callback;int NoThread;int NoCodecs")
    Local $tToken = DllStructCreate("ulong_ptr Data")
    DllStructSetData($tInput, "Version", 1)
    DllCall($ghGDIPDll, "int", "GdiplusStartup", "ptr", DllStructGetPtr($tToken), "ptr", DllStructGetPtr($tInput), "ptr", 0)
    Local $aImage = DllCall($ghGDIPDll, "int", "GdipLoadImageFromFile", "wstr", $sFileName, "ptr*", 0)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageWidth", "handle", $aImage[2], "uint*", -1)
    $aRet[0] = $aResult[2]
    $aResult = DllCall($ghGDIPDll, "int", "GdipGetImageHeight", "handle", $aImage[2], "uint*", 0)
    $aRet[1] = $aResult[2]
    DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $aImage[2])
    DllCall($ghGDIPDll, "none", "GdiplusShutdown", "ptr", DllStructGetData($tToken, "Data"))
    DllClose($ghGDIPDll)
    Return SetError(0, 0, $aRet)
EndFunc ;==>_ImageSize

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • KimberlyJillPereira
      By KimberlyJillPereira
      How to use the date and time in Microsoft Excel and use it find to find it in Windows explorer under date modified(date and time) if it matches then extract that picture and paste it in Microsoft Excel. I know have to use FileGetTime() but not sure how to do. Please help me. Thank you.


    • PINTO1927
      By PINTO1927
      Hello guys, I'm working on this script:
      $search = GUICtrlCreateButton("Search", 10, 10, 90, 30) $find = GUICtrlCreateInput("", 710, 10, 200, 25) GUICtrlSetState($find, $GUI_DISABLE) $ok_find = GUICtrlCreateButton("Find", 925, 10, 65, 25) GUICtrlSetState($ok_find, $GUI_DISABLE)  
      Case $search GUICtrlSetState($ok_trova, $GUI_ENABLE) GUICtrlSetState($trova, $GUI_ENABLE) _GUICtrlListView_SimpleSort($list, $g_bSortSense, 0, False) _GUICtrlListView_DeleteAllItems($list) $File_txt = _FileListToArray("\\PATH\", "*.ini", $FLTA_FILES, True) Local $aLines, $File_txt For $i = 1 To $File_txt[0] _FileReadtoArray($File_txt[$i], $aLines) For $j = 1 To $aLines[0] GUICtrlCreateListViewItem($aLines[$j], $list) Next Next For $i2 = 0 To _GUICtrlListView_GetColumnCount($list) _GUICtrlListView_SetColumnWidth($list, $i2, $LVSCW_AUTOSIZE_USEHEADER) Next Case $ok_find $iI = _GUICtrlListView_FindInText($list, GUICtrlRead($input_find)) MsgBox($MB_SYSTEMMODAL, "Information", "Target Item Index: " & $iI) _GUICtrlListView_EnsureVisible($list, $iI) through a inputbox I would search for the desired word and highlight it in the GuiCtrlListView.
      Can you help me?
    • Wicked_Caty
      By Wicked_Caty
      I've written a bot that is loading down  pictures from a website. Basically, it opens the website, saves the picture via context menu, and hits a button for loading the next pic. Unfortunately, the pics and my internet connection aren't always the same and it takes longer to load at times. Right now I've got a sleep(3000) in my code, but it isn't very efficient. I waste time if it loads faster than 3000ms, and the program fails if it takes more than 3000ms. So I wanted to make a function that waits until the picture has loaded, and then saves it. 
      I don't know if that causes any problems with possible functions, but it isn't the tab that's loading. The loading circle doesn't appear. It's something on the website.
      I've adapted to program to chrome, so I'd have to rewrite it partially for the IE functions, so it'd be nice if there was a solution for chrome. --- Thanks!
    • goss34
      By goss34
      Hi Guys,
      I am writing an app that involves a list view with for example 100 rows. I have added an input box and search button to search the list view for whatever was in the input box.
      I found this function on the forum:
      Button2() Func Button2() ;MsgBox(0, "Button2", GUICtrlRead($Input)) $value = GUICtrlRead($Input) ; Search for target item $iI = _GUICtrlListView_FindInText($ListView1, $value, -1) _GUICtrlListView_EnsureVisible($ListView1, $iI) EndFunc This works to a degree but only jumps to a matching string and not in every case even though the string is definitely in the list view.
      What i want to do is redraw the listview with any results matching or part matching the string in the input box. 
      Im sure someone will of already done this if so could i see the code as i do not know where to begin.
      Thanks,
      Dan
       
    • zelles
      By zelles
      I was looking to find the MIME type of a file using AutoIt and found a function to do it but it only detects the 26 hardcoded, test, MIME types and returns 0 if the file is not one of the few hardcoded MIME's... So I decided to throw a function together... It detects 249 MIME types via the files extention. The thing is it dedects only by the extention; and not by actually checking the file.
      True MIME Finder: Supports 26 MIME Types
      ; sample usage $file = "c:\file path\file.txt" $mime_type = __GetMIMEByCode($file) MsgBox(0, "MIME Type:", $mime_type) ; the function Func __GetMIMEByCode($f_file) $f_call = DllCall("urlmon.dll", "long", "FindMimeFromData", _ "ptr", 0, _ "wstr", $f_file, _ "ptr", 0, _ "DWORD", 0, _ "ptr", 0, _ "DWORD", 1, _ "ptr*", 0, _ "DWORD", 0) If @error Then Return 0 $f_mime = DllStructGetData(DllStructCreate("wchar[" & _WinAPI_StringLenW($f_call[7]) & "]", $f_call[7]), 1) Return $f_mime EndFunc Determine MIME By Extension: Supports 249 MIME Types
      ;sample usage $file = "c:\file path\filename.txt" $mime_type = __GetMIMEByExtention($file) MsgBox(0, "MIME Type:", $mime_type) ; the function Func __GetMIMEByExtention($f_file) Local $f_extension = StringSplit($f_file, ".") Switch '.' & $f_extension[$f_extension[0]] Case '.x3d' Return 'application/vnd.hzn-3d-crossword' Case '.3gp' Return 'video/3gpp' Case '.3g2' Return 'video/3gpp2' Case '.mseq' Return 'application/vnd.mseq' Case '.pwn' Return 'application/vnd.3m.post-it-notes' Case '.plb' Return 'application/vnd.3gpp.pic-bw-large' Case '.psb' Return 'application/vnd.3gpp.pic-bw-small' Case '.pvb' Return 'application/vnd.3gpp.pic-bw-var' Case '.tcap' Return 'application/vnd.3gpp2.tcap' Case '.7z' Return 'application/x-7z-compressed' Case '.abw' Return 'application/x-abiword' Case '.ace' Return 'application/x-ace-compressed' Case '.acc' Return 'application/vnd.americandynamics.acc' Case '.acu' Return 'application/vnd.acucobol' Case '.atc' Return 'application/vnd.acucorp' Case '.adp' Return 'audio/adpcm' Case '.aab' Return 'application/x-authorware-bin' Case '.aam' Return 'application/x-authorware-map' Case '.aas' Return 'application/x-authorware-seg' Case '.air' Return 'application/vnd.adobe.air-application-installer-package+zip' Case '.swf' Return 'application/x-shockwave-flash' Case '.fxp' Return 'application/vnd.adobe.fxp' Case '.pdf' Return 'application/pdf' Case '.ppd' Return 'application/vnd.cups-ppd' Case '.dir' Return 'application/x-director' Case '.xdp' Return 'application/vnd.adobe.xdp+xml' Case '.xfdf' Return 'application/vnd.adobe.xfdf' Case '.aac' Return 'audio/x-aac' Case '.ahead' Return 'application/vnd.ahead.space' Case '.azf' Return 'application/vnd.airzip.filesecure.azf' Case '.azs' Return 'application/vnd.airzip.filesecure.azs' Case '.azw' Return 'application/vnd.amazon.ebook' Case '.ami' Return 'application/vnd.amiga.ami' Case 'N/A' Return 'application/andrew-inset' Case '.apk' Return 'application/vnd.android.package-archive' Case '.cii' Return 'application/vnd.anser-web-certificate-issue-initiation' Case '.fti' Return 'application/vnd.anser-web-funds-transfer-initiation' Case '.atx' Return 'application/vnd.antix.game-component' Case '.mpkg' Return 'application/vnd.apple.installer+xml' Case '.aw' Return 'application/applixware' Case '.les' Return 'application/vnd.hhe.lesson-player' Case '.swi' Return 'application/vnd.aristanetworks.swi' Case '.s' Return 'text/x-asm' Case '.atomcat' Return 'application/atomcat+xml' Case '.atomsvc' Return 'application/atomsvc+xml' Case '.atom, .xml' Return 'application/atom+xml' Case '.ac' Return 'application/pkix-attr-cert' Case '.aif' Return 'audio/x-aiff' Case '.avi' Return 'video/x-msvideo' Case '.aep' Return 'application/vnd.audiograph' Case '.dxf' Return 'image/vnd.dxf' Case '.dwf' Return 'model/vnd.dwf' Case '.par' Return 'text/plain-bas' Case '.bcpio' Return 'application/x-bcpio' Case '.bin' Return 'application/octet-stream' Case '.bmp' Return 'image/bmp' Case '.torrent' Return 'application/x-bittorrent' Case '.cod' Return 'application/vnd.rim.cod' Case '.mpm' Return 'application/vnd.blueice.multipass' Case '.bmi' Return 'application/vnd.bmi' Case '.sh' Return 'application/x-sh' Case '.btif' Return 'image/prs.btif' Case '.rep' Return 'application/vnd.businessobjects' Case '.bz' Return 'application/x-bzip' Case '.bz2' Return 'application/x-bzip2' Case '.csh' Return 'application/x-csh' Case '.c' Return 'text/x-c' Case '.cdxml' Return 'application/vnd.chemdraw+xml' Case '.css' Return 'text/css' Case '.cdx' Return 'chemical/x-cdx' Case '.cml' Return 'chemical/x-cml' Case '.csml' Return 'chemical/x-csml' Case '.cdbcmsg' Return 'application/vnd.contact.cmsg' Case '.cla' Return 'application/vnd.claymore' Case '.c4g' Return 'application/vnd.clonk.c4group' Case '.sub' Return 'image/vnd.dvb.subtitle' Case '.cdmia' Return 'application/cdmi-capability' Case '.cdmic' Return 'application/cdmi-container' Case '.cdmid' Return 'application/cdmi-domain' Case '.cdmio' Return 'application/cdmi-object' Case '.cdmiq' Return 'application/cdmi-queue' Case '.c11amc' Return 'application/vnd.cluetrust.cartomobile-config' Case '.c11amz' Return 'application/vnd.cluetrust.cartomobile-config-pkg' Case '.ras' Return 'image/x-cmu-raster' Case '.dae' Return 'model/vnd.collada+xml' Case '.csv' Return 'text/csv' Case '.cpt' Return 'application/mac-compactpro' Case '.wmlc' Return 'application/vnd.wap.wmlc' Case '.cgm' Return 'image/cgm' Case '.ice' Return 'x-conference/x-cooltalk' Case '.cmx' Return 'image/x-cmx' Case '.xar' Return 'application/vnd.xara' Case '.cmc' Return 'application/vnd.cosmocaller' Case '.cpio' Return 'application/x-cpio' Case '.clkx' Return 'application/vnd.crick.clicker' Case '.clkk' Return 'application/vnd.crick.clicker.keyboard' Case '.clkp' Return 'application/vnd.crick.clicker.palette' Case '.clkt' Return 'application/vnd.crick.clicker.template' Case '.clkw' Return 'application/vnd.crick.clicker.wordbank' Case '.wbs' Return 'application/vnd.criticaltools.wbs+xml' Case '.cryptonote' Return 'application/vnd.rig.cryptonote' Case '.cif' Return 'chemical/x-cif' Case '.cmdf' Return 'chemical/x-cmdf' Case '.cu' Return 'application/cu-seeme' Case '.cww' Return 'application/prs.cww' Case '.curl' Return 'text/vnd.curl' Case '.dcurl' Return 'text/vnd.curl.dcurl' Case '.mcurl' Return 'text/vnd.curl.mcurl' Case '.scurl' Return 'text/vnd.curl.scurl' Case '.car' Return 'application/vnd.curl.car' Case '.pcurl' Return 'application/vnd.curl.pcurl' Case '.cmp' Return 'application/vnd.yellowriver-custom-menu' Case '.dssc' Return 'application/dssc+der' Case '.xdssc' Return 'application/dssc+xml' Case '.deb' Return 'application/x-debian-package' Case '.uva' Return 'audio/vnd.dece.audio' Case '.uvi' Return 'image/vnd.dece.graphic' Case '.uvh' Return 'video/vnd.dece.hd' Case '.uvm' Return 'video/vnd.dece.mobile' Case '.uvu' Return 'video/vnd.uvvu.mp4' Case '.uvp' Return 'video/vnd.dece.pd' Case '.uvs' Return 'video/vnd.dece.sd' Case '.uvv' Return 'video/vnd.dece.video' Case '.dvi' Return 'application/x-dvi' Case '.seed' Return 'application/vnd.fdsn.seed' Case '.dtb' Return 'application/x-dtbook+xml' Case '.res' Return 'application/x-dtbresource+xml' Case '.ait' Return 'application/vnd.dvb.ait' Case '.svc' Return 'application/vnd.dvb.service' Case '.eol' Return 'audio/vnd.digital-winds' Case '.djvu' Return 'image/vnd.djvu' Case '.dtd' Return 'application/xml-dtd' Case '.mlp' Return 'application/vnd.dolby.mlp' Case '.wad' Return 'application/x-doom' Case '.dpg' Return 'application/vnd.dpgraph' Case '.dra' Return 'audio/vnd.dra' Case '.dfac' Return 'application/vnd.dreamfactory' Case '.dts' Return 'audio/vnd.dts' Case '.dtshd' Return 'audio/vnd.dts.hd' Case '.dwg' Return 'image/vnd.dwg' Case '.geo' Return 'application/vnd.dynageo' Case '.es' Return 'application/ecmascript' Case '.mag' Return 'application/vnd.ecowin.chart' Case '.mmr' Return 'image/vnd.fujixerox.edmics-mmr' Case '.rlc' Return 'image/vnd.fujixerox.edmics-rlc' Case '.exi' Return 'application/exi' Case '.mgz' Return 'application/vnd.proteus.magazine' Case '.epub' Return 'application/epub+zip' Case '.eml' Return 'message/rfc822' Case '.nml' Return 'application/vnd.enliven' Case '.xpr' Return 'application/vnd.is-xpr' Case '.xif' Return 'image/vnd.xiff' Case '.xfdl' Return 'application/vnd.xfdl' Case '.emma' Return 'application/emma+xml' Case '.ez2' Return 'application/vnd.ezpix-album' Case '.ez3' Return 'application/vnd.ezpix-package' Case '.fst' Return 'image/vnd.fst' Case '.fvt' Return 'video/vnd.fvt' Case '.fbs' Return 'image/vnd.fastbidsheet' Case '.fe_launch' Return 'application/vnd.denovo.fcselayout-link' Case '.f4v' Return 'video/x-f4v' Case '.flv' Return 'video/x-flv' Case '.fpx' Return 'image/vnd.fpx' Case '.npx' Return 'image/vnd.net-fpx' Case '.flx' Return 'text/vnd.fmi.flexstor' Case '.fli' Return 'video/x-fli' Case '.ftc' Return 'application/vnd.fluxtime.clip' Case '.fdf' Return 'application/vnd.fdf' Case '.f' Return 'text/x-fortran' Case '.mif' Return 'application/vnd.mif' Case '.fm' Return 'application/vnd.framemaker' Case '.fh' Return 'image/x-freehand' Case '.fsc' Return 'application/vnd.fsc.weblaunch' Case '.fnc' Return 'application/vnd.frogans.fnc' Case '.ltf' Return 'application/vnd.frogans.ltf' Case '.ddd' Return 'application/vnd.fujixerox.ddd' Case '.xdw' Return 'application/vnd.fujixerox.docuworks' Case '.xbd' Return 'application/vnd.fujixerox.docuworks.binder' Case '.oas' Return 'application/vnd.fujitsu.oasys' Case '.oa2' Return 'application/vnd.fujitsu.oasys2' Case '.oa3' Return 'application/vnd.fujitsu.oasys3' Case '.fg5' Return 'application/vnd.fujitsu.oasysgp' Case '.bh2' Return 'application/vnd.fujitsu.oasysprs' Case '.spl' Return 'application/x-futuresplash' Case '.fzs' Return 'application/vnd.fuzzysheet' Case '.g3' Return 'image/g3fax' Case '.gmx' Return 'application/vnd.gmx' Case '.gtw' Return 'model/vnd.gtw' Case '.txd' Return 'application/vnd.genomatix.tuxedo' Case '.ggb' Return 'application/vnd.geogebra.file' Case '.ggt' Return 'application/vnd.geogebra.tool' Case '.gdl' Return 'model/vnd.gdl' Case '.gex' Return 'application/vnd.geometry-explorer' Case '.gxt' Return 'application/vnd.geonext' Case '.g2w' Return 'application/vnd.geoplan' Case '.g3w' Return 'application/vnd.geospace' Case '.gsf' Return 'application/x-font-ghostscript' Case '.bdf' Return 'application/x-font-bdf' Case '.gtar' Return 'application/x-gtar' Case '.texinfo' Return 'application/x-texinfo' Case '.gnumeric' Return 'application/x-gnumeric' Case '.kml' Return 'application/vnd.google-earth.kml+xml' Case '.kmz' Return 'application/vnd.google-earth.kmz' Case '.gqf' Return 'application/vnd.grafeq' Case '.gif' Return 'image/gif' Case '.gv' Return 'text/vnd.graphviz' Case '.gac' Return 'application/vnd.groove-account' Case '.ghf' Return 'application/vnd.groove-help' Case '.gim' Return 'application/vnd.groove-identity-message' Case '.grv' Return 'application/vnd.groove-injector' Case '.gtm' Return 'application/vnd.groove-tool-message' Case '.tpl' Return 'application/vnd.groove-tool-template' Case '.vcg' Return 'application/vnd.groove-vcard' Case '.h261' Return 'video/h261' Case '.h263' Return 'video/h263' Case '.h264' Return 'video/h264' Case '.hpid' Return 'application/vnd.hp-hpid' Case '.hps' Return 'application/vnd.hp-hps' Case '.hdf' Return 'application/x-hdf' Case '.rip' Return 'audio/vnd.rip' Case '.hbci' Return 'application/vnd.hbci' Case '.jlt' Return 'application/vnd.hp-jlyt' Case '.pcl' Return 'application/vnd.hp-pcl' Case '.hpgl' Return 'application/vnd.hp-hpgl' Case '.hvs' Return 'application/vnd.yamaha.hv-script' Case '.hvd' Return 'application/vnd.yamaha.hv-dic' Case '.hvp' Return 'application/vnd.yamaha.hv-voice' Case '.sfd-hdstx' Return 'application/vnd.hydrostatix.sof-data' Case '.stk' Return 'application/hyperstudio' Case '.hal' Return 'application/vnd.hal+xml' Case '.html' Return 'text/html' Case '.irm' Return 'application/vnd.ibm.rights-management' Case '.sc' Return 'application/vnd.ibm.secure-container' Case '.ics' Return 'text/calendar' Case '.icc' Return 'application/vnd.iccprofile' Case '.ico' Return 'image/x-icon' Case '.igl' Return 'application/vnd.igloader' Case '.ief' Return 'image/ief' Case '.ivp' Return 'application/vnd.immervision-ivp' Case '.ivu' Return 'application/vnd.immervision-ivu' Case '.rif' Return 'application/reginfo+xml' Case '.3dml' Return 'text/vnd.in3d.3dml' Case '.spot' Return 'text/vnd.in3d.spot' Case '.igs' Return 'model/iges' Case '.i2g' Return 'application/vnd.intergeo' Case '.cdy' Return 'application/vnd.cinderella' Case '.xpw' Return 'application/vnd.intercon.formnet' Case '.fcs' Return 'application/vnd.isac.fcs' Case '.ipfix' Return 'application/ipfix' Case Else Return 0 EndSwitch EndFunc