johnmcloud Posted December 12, 2011 Share Posted December 12, 2011 (edited) The FileMove command is simple FileMove("C:Test", "D:Test") But if i want to use it with different dir, for example put it in "SendTo" dir? Like a script .bat. So the first dir change, and the second is always the same. It's possible? Thanks Edited December 12, 2011 by johnmcloud Link to comment Share on other sites More sharing options...
magodiez Posted December 12, 2011 Share Posted December 12, 2011 check the function reference: http://www.autoitscript.com/autoit3/docs/functions/FileMove.htmI'm not sure what you are trying to do, but you can use wildcards or put it in a loop to do it with different source directory Link to comment Share on other sites More sharing options...
johnmcloud Posted December 12, 2011 Author Share Posted December 12, 2011 I know the fuction reference. I'll do an example: Take this .bat: Dir %1 /oe > c:windowstempList.txt Save it in SendoTo folder ( %APPDATA%MicrosoftWindowsSendTo ) If right click on a folder -- Send To -- Bat, i have a list of that directory. I want do the same with autoit, with the function FileMove Right click on a folder -- Send To -- Autoit .exe result: Move the folder to destination directory ( the destination is always the same ) I hope I was clear, Thanks for support Link to comment Share on other sites More sharing options...
magodiez Posted December 12, 2011 Share Posted December 12, 2011 (edited) you can do it with a batch: move "%1*.*" D:Test or in Autoit: $destination = "D:Test" If($CmdLine[0] > 0) Then FileMove ( $CmdLine[1], $destination) Else MsgBox(0x10,"Error!",$CmdLine[0] & " arguments passed!") EndIf Note: This only would move the files in the folder, but no sub-folders Edited December 12, 2011 by magodiez Link to comment Share on other sites More sharing options...
JohnOne Posted December 12, 2011 Share Posted December 12, 2011 Take a look at provided by guinness 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...
guinness Posted December 12, 2011 Share Posted December 12, 2011 Thanks JohnOne. johnmcloud, At the top of your script add something like this >> If $CmdLine[0] Then For $A = 1 To $CmdLine[0] If StringInStr(FileGetAttrib($CmdLine[$A]), "D") Then ; Is a Folder/Directory DirMove($CmdLine[$A], "<DESTINATIONPATH>") Else ; Otherwise it must be a file. FileMove($CmdLine[$A], "<DESTINATIONPATH>") EndIf Next EndIf UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
johnmcloud Posted December 12, 2011 Author Share Posted December 12, 2011 (edited) johnmcloud, At the top of your script add something like this >> Thanks guinness, You script work only with single file, not with directory ( don't doing nothing ) And if can explain the first part of the script? I don't understand this part: If $CmdLine[0] Then For $A = 1 To $CmdLine[0] I am here also to learn, thanks for support Edited December 12, 2011 by johnmcloud Link to comment Share on other sites More sharing options...
magodiez Posted December 12, 2011 Share Posted December 12, 2011 $CmdLine[0] is number of parameters (for more info http://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine)to work with Directories add the flag 1 to overwriteDirMove($CmdLine[$A], $destination,1)and you can also add the flag 8 for files, in case the destination folder is not createdFileMove($CmdLine[$A], $destination,8)$destination = "D:\Test" If $CmdLine[0] Then For $A = 1 To $CmdLine[0] If StringInStr(FileGetAttrib($CmdLine[$A]), "D") Then ; Is a Folder/Directory DirMove($CmdLine[$A], $destination,1) Else ; Otherwise it must be a file. FileMove($CmdLine[$A], $destination,8) EndIf Next EndIf Link to comment Share on other sites More sharing options...
somdcomputerguy Posted December 12, 2011 Share Posted December 12, 2011 I'm not sure why this doesn't work with directories, but for the 'first part' thing, see this in the Help file:Command Line ParametersFor...Next - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
guinness Posted December 12, 2011 Share Posted December 12, 2011 (edited) Seems people have answered already. When I said 'like this' I should have mentioned that please read the additional remarks in the Help file for the functions DirMove & FIleMove. Edited December 12, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
johnmcloud Posted December 12, 2011 Author Share Posted December 12, 2011 (edited) $CmdLine[0] is number of parameters (for more info http://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine) to work with Directories add the flag 1 to overwrite DirMove($CmdLine[$A], $destination,1) and you can also add the flag 8 for files, in case the destination folder is not created FileMove($CmdLine[$A], $destination,8) $destination = "D:Test" If $CmdLine[0] Then For $A = 1 To $CmdLine[0] If StringInStr(FileGetAttrib($CmdLine[$A]), "D") Then ; Is a Folder/Directory DirMove($CmdLine[$A], $destination,1) Else ; Otherwise it must be a file. FileMove($CmdLine[$A], $destination,8) EndIf Next EndIf Thanks man, work, but i need another example for learn better the function. I have now made this script: $source = "C:" $dest = "C:Test.txt" RunWait(@ComSpec & " " & "/k" & " "& "dir >" & " " &$dest& " " &$source& "&& Echo. && Echo finished") Working fine, create a file in C: with the directory of C: Now i want to apply your scipt into this, but not work, What i'm doing wrong? $dest = "C:Test.txt" If $CmdLine[0] Then For $A = 1 To $CmdLine[0] If StringInStr(FileGetAttrib($CmdLine[$A]), "D") Then ; Is a Folder/Directory RunWait(@ComSpec & " " & "/k" & " "& "dir >" & " " &$dest& " " &$CmdLine[$A]& "&& Echo. && Echo finished") EndIf Next EndIf Edited December 12, 2011 by johnmcloud Link to comment Share on other sites More sharing options...
magodiez Posted December 12, 2011 Share Posted December 12, 2011 that code works fine in my computer... Do you get any error??? Link to comment Share on other sites More sharing options...
johnmcloud Posted December 12, 2011 Author Share Posted December 12, 2011 (edited) that code works fine in my computer... Do you get any error??? Now Work, i don't know what was the problem. I'll post again: $dest = "C:TestFile.txt" If $CmdLine[0] Then For $A = 1 To $CmdLine[0] If StringInStr(FileGetAttrib($CmdLine[$A]), "D") Then ; Is a Folder/Directory RunWait(@ComSpec & " " & "/c" & " "& "dir >" & " " & '"'&$dest& '"' & " " & '"' &$CmdLine[$A]& '"' & " " & "&& Echo. && Echo finished", "", @SW_HIDE) EndIf Next EndIf N.B Why i can't post like Autoit code?. I click OK but nothing happens, maybe is a browser problem... Thanks guys for support, in particularly magodiez and guinness. Edited December 12, 2011 by johnmcloud Link to comment Share on other sites More sharing options...
guinness Posted December 12, 2011 Share Posted December 12, 2011 Thanks guys for support, in particularly magodiez and guinness.You're welcome but I only did about 5% of the work. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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