FMS Posted August 15, 2012 Share Posted August 15, 2012 Hello, I hope somebody can help me whit a problem i got. There's a program on mine computer that automaticly create's PDF file's in a map called C:\Test. I maked a mapping to a networkdisk K:\test Now i want to make a program in autoit that checks if there is a *.PDF file in C:\Test and if so cut and past it into K:\test. Is there somebody who can help me to point the wright way? thnx in advanced. greeting FMS as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Scriptonize Posted August 15, 2012 Share Posted August 15, 2012 (edited) So at what point are you stuck? Can you show us some of the code you have so far? Edited August 15, 2012 by Scriptonize If you learn from It, it's not a mistake Link to comment Share on other sites More sharing options...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 I've something like this at the moment ( please don't run because isn't working) i can't let it stay in a loop because of CPU issues (trown that script away and started again) $search = FileFindFirstFile("C:TEST*.pdf") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) FileCopy( $file , "K:Test") ;here something like if files exist in both directorys then delete file FileDelete("C:TEST*.pdf") WEnd FileClose($search) as u can probely see a little noobish written but i'm still trying to learn;) as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
BrewManNH Posted August 15, 2012 Share Posted August 15, 2012 Look at FileMove, it does the copy and delete in one function. 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...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 thnx brewman, does it also check if the replace is done? so i don't delete the file if it isn't there? gr. (this is what i got this far what do you guys think about it?any pointers? $search = FileFindFirstFile("C:\TEST\*.pdf") If $search = -1 Then sleep(60000) EndIf While 1 $file = FileFindNextFile($search) filemove($file,"K:\Test\",8) WEnd FileClose($search) as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
BrewManNH Posted August 15, 2012 Share Posted August 15, 2012 You need to include the full path before the file name returned by FileFindNextFile when you use FileMove. FileFindNextFile only returns the file name, not the full path. 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...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 sorry i dont realy quite understand what u mean.... could u explain it in a script? thnx in advanced. gr.FMS as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 This isn't also not $search = FileFindFirstFile("C:\TEST\*.pdf") If $search = -1 Then sleep(5000) EndIf While 1 $file = FileFindNextFile($search) FileCopy("C:\TEST\" And $file,"C:\Test2\",8) FileDelete("c:\TEST\*.pdf") WEnd FileClose($search) This only deletes the original file plz help... as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
BrewManNH Posted August 15, 2012 Share Posted August 15, 2012 http://www.autoitscript.com/wiki/Tutorials#AutoIt_beginner Go through the basics of how the language works before you attempt to do things that are beyond your abilities. 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...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 thats why i was asking....... do you always answer a question whit RTFM ? This is not very helpfull..... i'm trying mine best over here..... as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 This wasn't it eather :S $search = FileFindFirstFile("C:\TEST\*.pdf") If $search = -1 Then sleep(5000) EndIf While 1 $file = FileFindNextFile($search) filemove("C:\TEST\"And $file,"C:\Test2\",8) WEnd FileClose($search) as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
RedneckTech Posted August 15, 2012 Share Posted August 15, 2012 I'm not one for RTFM as a constant answer, but if you look at the help file, it is full of examples and "Related Functions" most examples actually are very close to what you are doing. You may also want to just use DOS code if you're having trouble with the autoIT code until you have a better grasp, then go back and convert your DOS to AutoIT. Thats how i started. Use what you know then build up. RunWait( "xcopy C:Test*.pdf K:Test /d /c /e /h /r /q /y") RunWait( "Del /f /s /q /a C:Test*.pdf") its not all autoIT, but it will at least get you a working function till you can figure it out Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 15, 2012 Moderators Share Posted August 15, 2012 thats why i was asking....... do you always answer a question whit RTFM ? This is not very helpfull..... i'm trying mine best over here..... I think BrewManNH's suggestion was very appropriate, as you've got a lot of clutter in your script. For example, this line: filemove("C:TEST"And $file,"C:Test2",8) going through the tutorials instead of trying to jump right in would show you why this is not working. Modifying your script in post #11 works just fine for me: $search = FileFindFirstFile("C:TEST*.pdf") While 1 If $search = -1 Then sleep(5000) Else $file = FileFindNextFile($search) filemove("C:TEST" & $file,"C:Test2",8) EndIf WEnd "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...
BrewManNH Posted August 15, 2012 Share Posted August 15, 2012 thats why i was asking.......do you always answer a question whit RTFM ?When it's obvious that the person posting doesn't have even the basic knowledge of the language, I suggest they learn it. So, short answer is yes, if you don't know how to use the things you're using, then RTFM is the best answer I can give you. If I showed you the correct code, you'd learn nothing from it, and you'll be back in 15 minutes asking an equally simplistic question.This is not very helpfull..... i'm trying mine best over here.....No you're not trying your best, you're trying anything that you can think of and not trying to figure out WHY it doesn't work, you just jump back here asking us to fix it for you and you don't do any of the background work necessary to learn how to use the language. If all you want is someone to write the script for you, and you're not willing to learn how it works, then I don't see any reason why you're using this website when vCoder will do it for you as long as you're willing to pay for 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...
FMS Posted August 15, 2012 Author Share Posted August 15, 2012 thnx guys for your reply's rednecktech, brewmannh and Jlogan. now i understand what was wrong whit the original script. I realy understand it better if i write a script how i think i should be, afther that compare it whit how it should or could be and learn from it more this way. It's not that i wan't a writtin script whitout doing nothing about it brew.... (thats why i was asking what other poeple think about the original) There are multiple way's to rome..... so i dont wanna mess up CPU or walk a realy long route.... thnx... FMS as finishing touch god created the dutch Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 15, 2012 Moderators Share Posted August 15, 2012 I realy understand it better if i write a script how i think it should be,afther that compare it whit how it should or could beIf this is your plan of attack, you're going to hate programming.... "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...
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