dshinkel Posted October 8, 2012 Share Posted October 8, 2012 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 More sharing options...
JohnOne Posted October 8, 2012 Share Posted October 8, 2012 Let me get this straight, you are downloading a file from the internet, and you have no idea where you are downloading it to? Please show your download code. 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 More sharing options...
dshinkel Posted October 9, 2012 Author Share Posted October 9, 2012 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 More sharing options...
JohnOne Posted October 9, 2012 Share Posted October 9, 2012 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, okyou can predict where the file might be, but in the end you don't really knowwhat folders people use.Anyway. you probably best using something which already exists to searchfolders (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 More sharing options...
Moderators JLogan3o13 Posted October 9, 2012 Moderators Share Posted October 9, 2012 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 More sharing options...
dshinkel Posted October 9, 2012 Author Share Posted October 9, 2012 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 More sharing options...
dshinkel Posted October 9, 2012 Author Share Posted October 9, 2012 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 More sharing options...
Moderators Melba23 Posted October 9, 2012 Moderators Share Posted October 9, 2012 dshinkel,I have found findfilefirstfile only looks in the directory that is open at that time. Maybe this is a default causing thisFileFindFirstFile 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 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
BrewManNH Posted October 10, 2012 Share Posted October 10, 2012 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 GudeHow 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 More sharing options...
dshinkel Posted October 11, 2012 Author Share Posted October 11, 2012 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 More sharing options...
Moderators Melba23 Posted October 11, 2012 Moderators Share Posted October 11, 2012 dshinkel, Is there a way to find what the WorkingDir is?Easy: MsgBox(0, "WorkingDir", @WorkingDir) M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dany Posted October 11, 2012 Share Posted October 11, 2012 Maybe the [url=" UDF is of any use. Specifically _Zip_Unzip. [center]Spiderskank Spiderskank[/center]GetOpt Parse command line options UDF | AU3Text Program internationalization UDF | Identicon visual hash UDF Link to comment Share on other sites More sharing options...
dshinkel Posted October 11, 2012 Author Share Posted October 11, 2012 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 More sharing options...
dshinkel Posted October 11, 2012 Author Share Posted October 11, 2012 Hi John,Your is invaluable in my learning and research. It added greatly to what I learned in the tutorial. I suggest it to be a must read for all Absolute BeginnersDave[ autoit ] ( )Run('hh mk:@MSITStore:'&StringReplace(@AutoItExe,'.exe','.chm')&'::/html/tutorials/helloworld/helloworld.htm','',@SW_MAXIMIZE) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now