Sign in to follow this  
Followers 0
Mizerak

Location of Temporary Internet Files Directory

9 posts in this topic

Greetings!  I have tried looking through the forums for an answer to this, but either I am going about this the wrong way or no one has had this question before.

I have written a script that logs into surveymonkey, jumps through some hoops, sets up a survey download, and then downloads a zip file containing the survey data.  I then need to get to that zip file so that I can unzip it, or at least get to a subdirectory of it and copy one of the files from the zip file to another directory.

Running this under IE8 was relatively easy, as the Save As... dialogue would pop up, and I would populate the text field with the path and filename that I wanted to use.  Then I would know where the file was, and I could go from there.

IE9 has thrown a wrench into the mix.   The little windows that pop up asking if you want to run/save the downloaded file

a) do not have a window name, and

B) do not have a way to specify file location

As a result, my file ends up in a directory path like:

C:UsersmizerakAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE56YI2MLP4

I would imagine that this path is not the same every time I do a download, and the directory name would not be the same on someone else's machine, either.  I can get the profile directory for the user using @UserProfileDir, but that only gets me to "C:Usersmizerak". 

Is there a variable that holds the location of temporary files that I can pull at runtime?  I cannot use INetGet or INetGetSource (it seems), because I need to be logged in.  I did see one post about embedding the IE window and then using one of those, but I am a relative newbie and I have not messed with embedding yet.  This is my first project, and it has taken me hours of work just to get here.

What am I missing?  Has anyone else run into this before with IE9?  A lot of the posts that I found in my searches seemed to be from at least 3 years ago...maybe people were not using IE9 at that point.  I do not remember when it came out.

Thanks for any help.

Share this post


Link to post
Share on other sites



Hi,

You can use @AppDataDir, then you will have to make a file search to find the file you're looking for.

I don't know if it's possible to retrieve the temporary download folder.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you for the quick reply!  AppDataDir takes me to C:UsersmizerakAppDataRoaming, which seems out of the path that I want.

One possibility I thought of - one of the options after downloading a file is to open it.  If I choose that, I am taken to the inside of the downloaded zip file in a Windows Explorer window.  I then tried getting the text of the directory path, and then later used that to find the file again.  The problem there is that there are restrictions on opening the file - I am told that my Internet options keep me from opening the file.

I looked, but could not find what options would make it possible for me to open the zip file after downloading it.  Any ideas?  I tried making the surveymonkey site a Trusted Site in IE, but it did not make a difference.

Edited by Mizerak

Share this post


Link to post
Share on other sites

%userprofile%Local SettingsTemporary Internet Files = DIRID 16416

Global Const $CSIDL_INTERNET_CACHE = 0x0020

; dwFlags values for use with SHGetFolderPath
; current value for user, verify it exists
Global Const $SHGFP_TYPE_CURRENT = 0x0000
; default value
Global Const $SHGFP_TYPE_DEFAULT = 0x0001

MsgBox(0, 1, _WinAPI_SHGetFolderPath(16416))
;;Or
MsgBox(0, 1, _WinAPI_SHGetFolderPath($CSIDL_INTERNET_CACHE))

Func _WinAPI_SHGetFolderPath($nFolder, $dwFlags = $SHGFP_TYPE_CURRENT)
    Local $path = DllStructCreate("wchar[260]")
    Local $folder = DllCall("shell32.dll", "int", "SHGetFolderPathW", _
                                            "hwnd", 0, _
                                            "int", $nFolder, _
                                            "ptr", 0, _
                                            "dword", $dwFlags, _
                                            "ptr", DllStructGetPtr($path) _
                                            )
    If $folder[0] < 0 Then Return SetError(1, "", "")
    Return DllStructGetData($path, 1)
EndFunc

Ciao.

1 person likes this

OneDrive_Logo.png drive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Umm....that was cool, and all, but it does not get the temporary directory,  It does get me closer...but given the following directory (to continue my example), only the bold part is brought back by the function.

C:UsersmizerakAppDataLocalMicrosoftWindowsTemporary Internet FilesContent.IE56YI2MLP4

I am new at this, it is true, but how do I get the file I am looking for when all I have is what is in bold?

EDIT:  Had the idea of copying the file to a new location before unzipping it.  I am optimistic...will post here if it works.

Edited by Mizerak

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

16416 is official directory that microsoft itself uses

http://www.autoitscript.com/autoit3/docs/functions/FileFindFirstFile.htm

http://www.autoitscript.com/autoit3/docs/functions/FileFindNextFile.htm

Local $aFileList, $sDirSearch = _WinAPI_SHGetFolderPath(16416)

; Shows the filenames of all files in the current directory
Local  $file, $search = FileFindFirstFile($sDirSearch & "\Content.IE5\*")

; Check if the search was successful
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern")
    Exit
EndIf

While 1
    $file = FileFindNextFile($search)
    If @error Then ExitLoop
    If Not @extended Then ContinueLoop

    $aFileList &= $file & @LF
WEnd

; Close the search handle
FileClose($search)

If $aFileList Then
    $aFileList = StringSplit(StringTrimRight($aFileList, 1), @LF)
    For $i = 1 To $aFileList[0]
        ;If FileExists($sDirSearch & "\Content.IE5\" & $aFileList[$i] & "\*") Then ect ect
        ;ect ect ect
    Next
EndIf

Func _WinAPI_SHGetFolderPath($nFolder, $dwFlags = 0)
    Local $path = DllStructCreate("wchar[260]")
    Local $folder = DllCall("shell32.dll", "int", "SHGetFolderPathW", _
                                            "hwnd", 0, _
                                            "int", $nFolder, _
                                            "ptr", 0, _
                                            "dword", $dwFlags, _
                                            "ptr", DllStructGetPtr($path) _
                                            )
    If $folder[0] < 0 Then Return SetError(1, "", "")
    Return DllStructGetData($path, 1)
EndFunc

Ciao.

Edited by DXRW4E

OneDrive_Logo.png drive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

or

'?do=embed' frameborder='0' data-embedContent>>

#include <_FileListToArrayEx.au3>

;Local $aFileList = _FileListToArrayEx(_WinAPI_SHGetFolderPath(16416), "*.*", 12) ;; Return All (files & Folders)
;Local $aFileList = _FileListToArrayEx(_WinAPI_SHGetFolderPath(16416), "*.*", 13) ;; Return Files only
Local $aFileList = _FileListToArrayEx(_WinAPI_SHGetFolderPath(16416), "*.*", 14) ;; Return Folders only

If @Error Then
    MsgBox(0, @Error, "No files/directories matched the search pattern")
    Exit
EndIf

For $i = 1 To $aFileList[0]
    ;$aFileList[$i] ect ect
    ;ect ect ect
Next

Func _WinAPI_SHGetFolderPath($nFolder, $dwFlags = 0)
    Local $path = DllStructCreate("wchar[260]")
    Local $folder = DllCall("shell32.dll", "int", "SHGetFolderPathW", _
                                            "hwnd", 0, _
                                            "int", $nFolder, _
                                            "ptr", 0, _
                                            "dword", $dwFlags, _
                                            "ptr", DllStructGetPtr($path) _
                                            )
    If $folder[0] < 0 Then Return SetError(1, "", "")
    Return DllStructGetData($path, 1)
EndFunc

Ciao.

Edited by DXRW4E

OneDrive_Logo.png drive_app_badge.png box-logo.png new_logo.png MEGA_Logo.png

Share this post


Link to post
Share on other sites

So now I can get the directory, and the filename, and I am trying to use FileCopy to copy the file to another directory.  I am running into an issue because Windows seems to think that the file being copied is potentially harmful to my computer.  When I try to copy the file manually, as a test, I get a popup stating that "These files might be harmful to your computer".  When I do it manually, I can tell it to bypass the warning, but FileCopy just fails (no popup, just a return code of 0).

Has anyone been able to bypass this warning?  I looked online to see how people set various Internet settings to keep the warning from coming up, but I have not been successful in just shutting it off.

The file is not being copied from a network...it is being copied from my own machine to another directory on my own machine. 

I am stuck, and would appreciate any help.

Share this post


Link to post
Share on other sites

Has no one run into this before?  Download a file using IE.au3 and then try and copy it elsewhere under Windows 7 and IE 9?

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
Sign in to follow this  
Followers 0