Jump to content

Save the path and file name under filefindfirstfile or nextfile


Recommended Posts

Hi,

Here is what i am trying to do.

A file downloads from a website as a zip file.

There are 3 files in this zip file.

One is an excel file.

It needs to be saved to the computer before it is opened.

The name of the directory is unknown as each computer will open the zip file in a different location

I have written the portion to create a directory and file name to save it as.

Now it is a matter of finding the file to save.

I have looked at copy and paste but similiar limitation apply.

I have used findfilefirstfile and thought that if I can find a way to save this with it's path I could complete my task.

Thanks in advance,

Link to comment
Share on other sites

I am sorry. I should have been more specific.

People, not me, will be downloading the file from my website.

It has to be saved to the computer before it can be opened. This due to the security software to protect the excel workbook formulas and coding.

The problem is that the directory that the file is downloaded to will not be known to have the file saved from.

I would like to be able to have the directory found by Autoit so that it can be saved to specific folder.

I would much rather have the end user click on one button to complete the operation rather than trusting them, or as seen by my inital posting, me to make sure it is saved properly

I hope this clears up the confusion I have created.

Thanks again

Link to comment
Share on other sites

Well basically you are going to need to search the whole computer looking for

this file.

It's my duty as a sane person to point out that this method is quite potty, ok

you can predict where the file might be, but in the end you don't really know

what folders people use.

Anyway. you probably best using something which already exists to search

folders (or arguably lists the files in folders) and I suggest

by Melba23.

However my advice is to let the user locate the file.

If your users are really so simple they cannot then I suggest you serach for a way to.

1. Find the default/current browser in use.

2. Same with it's respective default download folder.

Just to get a better aim at the file you are looking for.

Good luck, and remember the search facility is your friend.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • Moderators

If they are downloading the file(s) from your site, why not set your script up as a "downloader" that is hosted on your site. Have the end user click on the downloader, which downloads the file to a specific spot (e.g. @TempDir). Then you know where it will be.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi John,

From the research and writing I have found findfilefirstfile only looks in the directory that is open at that time. Maybe this is a default causing this.

It seems that since it found the file in that directory, would it also know what the path is to that directory and file?

Maybe not findfilefirstfile to find the path, but another script can list the path attached to what finderfile found.

Or am i asking to much?

J the files are downloaded via an email sent to the customer with a link to the download site.

Maybe Autoit Auto Window will help me do the trick.

Thanks again to both of you

Dave

Link to comment
Share on other sites

Maybe another way to put this is:

If the zip file is open on their desktop, with the AutoIt function button, the one that will run and find the name of the file in it, can autoit find the path of this folder? Then I can add the file name to it and have it autosave in the desired folder that dircreate would make.

Link to comment
Share on other sites

  • Moderators

dshinkel,

I have found findfilefirstfile only looks in the directory that is open at that time. Maybe this is a default causing this

FileFindFirstFile looks in @WorkingDir - I do not see that as a default. ;)

Why not do as JLogan3o13 suggested above. Use FileInstall to wrap the files into an AutoIt executable which asks the user to choose the folder into which the files should be placed. That way you know precisely where they are. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

A zip file is not a folder/directory. Just because Windows treats them this way doesn't make them so. You can't search inside a zip file for the existence of a file in it using _FileFindFirstFile(NextFile). You will need to extract the Excel file from the zip file before you can access it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Melba23,

"FileFindFirstFile looks in @WorkingDir - I do not see that as a default." Is there a way to find what the WorkingDir is? That is what I really need. Knowing the WorkingDir will allow me the move the file from the WorkingDir to a defualt folder made by CreateDir.

Following up on JLogan suggestion may not work. The website is where an email sent to the customer from the website after the payment has been made. This has a link to the download file. I have not found a way to do his suggestion and the people running the website for me have not been much help.

I will continue looking in the forums for answers.

Thanks again for everyones help.

Dave

Link to comment
Share on other sites

  • Moderators

dshinkel,

Is there a way to find what the WorkingDir is?

Easy: :)

MsgBox(0, "WorkingDir", @WorkingDir)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hi all,

With the replies from everyone I was able to figure out what I needed. Big thanks to all of you. Every comment had an effect on finding my solution. The forum is a great place for finding information. Here is the code I came up with last night.

DirCopy ( @ScriptDir &"\test", "C:\litres3" & "\test" ,1)

msgbox(0, "demo,_pathfl", "Saved to C:\Litres3\test")

it works as well with @WorkingDir. This was in the comment from M23 that got me researching in the correct areas. All the others helped me put it together to what it is now.

With 'test" being the directory that would be located in the opened zip file and "C:\litres3" being the directory being created to store the test dicrectory in.

Now onto building a GUI hoping to make it a little more user friendly!

I have only been working with AutoIt less than a week. It is facinating to work with. I also learn a lot about how to pose the questions on the forum.

Thanks again for all your help and suggestions! You made it alot easier to figure out.

Dave

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...