ImOracle Posted January 20, 2015 Share Posted January 20, 2015 So i have been making a little program that helps my mom with copying mp3 files onto her mp3-player-usb-stick-thingy. i already did the part with the copying onto the mp3-player but now i have to get the file that she downloaded. It seems to be pretty hard for her to find the file she just downloaded thats why i wanted to find it and automatically copy it over to the mp3-player. i've already thought about getting the amount of files in the download directory and then comparing it against the amount after the download and spotting the file like that but its very complicated and maybe there is some function in an UDF i dont know about that would help me with this problem. she is using firefox. thanks, Oracle Link to comment Share on other sites More sharing options...
SadBunny Posted January 21, 2015 Share Posted January 21, 2015 Try doing a search for "synchronize directories" and/or "synchronize folders". There are multiple examples. If you run into specific challenges, be sure to raise a more specific question here on the forum. Good luck! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
ImOracle Posted January 21, 2015 Author Share Posted January 21, 2015 Try doing a search for "synchronize directories" and/or "synchronize folders". There are multiple examples. If you run into specific challenges, be sure to raise a more specific question here on the forum. Good luck! To form my question again (it was a bit late yesterday and i was in quite a hurry) I want my script to wait until a certain download is finished. thats all. But quite complicated nonetheless... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 21, 2015 Moderators Share Posted January 21, 2015 ImOracle,I have used seangriffin's FileSystemMonitor UDF very successfully to detect new files being created. Give it a go and come back if you run into problems. M23 ImOracle 1 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...
ImOracle Posted January 21, 2015 Author Share Posted January 21, 2015 ImOracle, I have used seangriffin's FileSystemMonitor UDF very successfully to detect new files being created. Give it a go and come back if you run into problems. M23 I knew there was an UDF somewhere out there! thanks! quite weird with the _FileSysMonActionEvent function call but okay... Link to comment Share on other sites More sharing options...
ImOracle Posted January 21, 2015 Author Share Posted January 21, 2015 yea okay i dont get it. i dont know anything about COM objects neither do i understand the example he has provided in his thread... i know that at some point the _FileSysMonDirEventHandler() calls _FileSysMonActionEvent() but i dont know when and what to do with the parameters im quite new to autoit... as you can tell Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 21, 2015 Moderators Share Posted January 21, 2015 ImOracle,Try reading this thread and running the code in post #2 - that might make it a bit clearer. If you still have problems let me know and I will try and explain (as much as I can) when I next have some free time - probably tomorrow afternoon. 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...
ImOracle Posted January 22, 2015 Author Share Posted January 22, 2015 i think i understood it, mostly. whats the $event_type parameter for? or what does it mean? $event_id can contain certain hex values that define certain events that have happened to the drive (like file/folder added or folder removed) $event_value contains the name of the folder or file... yea i only need $event_type now... thanks in advance youre really helping me! Link to comment Share on other sites More sharing options...
ImOracle Posted January 22, 2015 Author Share Posted January 22, 2015 (edited) Okay i have kind of threw together a prototype that will just pop up a msgbox when a file has been added to C:Users@UserNameDownloads and a msgbox when the file is a *.mp3 file. the last part with the mp3 doesnt quite work because the file that the UDF returns, is a .tmp file with a random name. #include <FileSystemMonitor.au3> _FileSysMonSetup(3, "C:\Users\"&@UserName&"\Downloads", "") While 1 Sleep(250) ToolTip("waiting");just a little tooltip to see if we're still in the while-loop _FileSysMonDirEventHandler() WEnd Func _FileSysMonActionEvent($event_type, $event_id, $event_value) If $event_type = 0 Then If $event_id=0x00000001 Then MsgBox(0, 0, $event_value);more or less a debugging msgbox to get the file that had been located If StringInStr($event_value, ".mp3") > 0 Then MsgBox(0, 0, "mp3 file added to downloads") EndIf EndIf EndIf EndFunc it doesnt seems to care about the .mp3 file at all. I will keep searching and maybe i will find a solution myself as i said above, thanks again EDIT: okay i have read through the whole thread you provided and found your modded version of the UDF i wanted to test it but failed because of my limited knowledge about COM... $fs_event.item(Hex(0x00000001)) = "file added to the directory|FILE_ACTION_ADDED" $fs_event.item(Hex(0x00000002)) = "Non-folder item created|SHCNE_CREATE" those values seem like they could help me but i have no idea how to use them... maybe there is actually no way to determine if the file downloaded is an mp3 but i could manually delete every mp3 file in the download folder (i dont think she will download music that she doesnt want on her mp3 player) and whenever a file has been added to the download folder i could search the whole folder for a mp3 file. if there is one copy it over to the usb, and delete the mp3 in the downloads folder. if the usb isnt connected wait until it has, copy all mp3s over and delete them on the pc. maybe i will do that... Or i might have to show her how to find the files in browser. but that would be more complicated than reprogramming the whole OS just for the sake of that function xD didnt know that this could be so complicated. thanks anyways Edited January 22, 2015 by ImOracle Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 22, 2015 Moderators Share Posted January 22, 2015 ImOracle, the file that the UDF returns, is a .tmp file with a random nameI wonder if that is the downloader creating a temporary file during the download process which will be renamed after the download finishes. Perhaps you need to look for a file rename event which follows the file creation. didnt know that this could be so complicatedAlas, in computing things which to us humans appear simple are often thus. >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...
ImOracle Posted January 22, 2015 Author Share Posted January 22, 2015 I wonder if that is the downloader creating a temporary file during the download process which will be renamed after the download finishes. Perhaps you need to look for a file rename event which follows the file creation. Might actually be the case... Im tired now, on my end of the world its about 11 pm and i have been looking at code the whole day. Im gonna bring up a new Edit tomorrow Link to comment Share on other sites More sharing options...
ImOracle Posted January 25, 2015 Author Share Posted January 25, 2015 UPDATE: finally got it. Minor tweaks did it for some reason i dont know wether the .tmp file created is actually the file im looking for but somewhen a file (<filename>.mp3.crdownload) is created and when the file has finished downloading its renamed to the actual <filename>.mp3 (the one im looking for) for some reason the msgbox pops up twice but thats no big deal #include <FileSystemMonitor.au3> _FileSysMonSetup(3, "C:\Users\"&@UserName&"\Downloads", "") While 1 Sleep(250) ToolTip("waiting");just a little tooltip to see if we're still in the while-loop _FileSysMonDirEventHandler() WEnd Func _FileSysMonActionEvent($event_type, $event_id, $event_value) If $event_type = 0 Then ;If $event_id=0x00000005 Then If StringInStr($event_value, ".mp3") > 0 And StringInStr($event_value, "crdownload") = 0 Then MsgBox(0, "Success", "mp3 file ("&$event_value&") added to downloads") EndIf ;EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 25, 2015 Moderators Share Posted January 25, 2015 ImOracle, finally got itDelighted - perseverance paying off is always nice to see. 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...
ImOracle Posted January 25, 2015 Author Share Posted January 25, 2015 only problem is it doesnt work on my moms pc... but that shouldnt be too much of a problem... i guess i could close the thread or whatever this is actually my first time posting a thread 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