AJJ Posted April 6, 2009 Share Posted April 6, 2009 Does anyone have any idea how you tell the code that the folder title (for example in a shellexecute) is variable - for instance "C:\Users\Adam\My Documents" could also be "C:\Users\Brian's Love Machine\My Documents" and so on. In MS DOS .bat files the code would be " "%userprofile%"\Documents\*.* " or similar. any ideas? Link to comment Share on other sites More sharing options...
AJJ Posted April 6, 2009 Author Share Posted April 6, 2009 Also, another question that is related to this topic - i am trying to run the app from a memory stick, how can i tell it what letter drive the memory stick is if i had to "SEND("m:/folder/file")" Thanks Link to comment Share on other sites More sharing options...
erik7426 Posted April 6, 2009 Share Posted April 6, 2009 Does anyone have any idea how you tell the code that the folder title (for example in a shellexecute) is variable - for instance "C:\Users\Adam\My Documents" could also be "C:\Users\Brian's Love Machine\My Documents" and so on. In MS DOS .bat files the code would be " "%userprofile%"\Documents\*.* " or similar. any ideas? @UserProfileDir & "\Documents" or @MyDocumentsDir Link to comment Share on other sites More sharing options...
erik7426 Posted April 6, 2009 Share Posted April 6, 2009 Also, another question that is related to this topic - i am trying to run the app from a memory stick, how can i tell it what letter drive the memory stick is if i had to "SEND("m:/folder/file")" Thanks If the script is on the removable drive with the app this would work to give you the drive letter... $myPath = StringLeft(@ScriptDir,3) Link to comment Share on other sites More sharing options...
AJJ Posted April 6, 2009 Author Share Posted April 6, 2009 thanks, thats great but how can i use it in the code? where would i put it? if it had FileCopy("@UserProfileDir & "\Documents"", "$myPath = StringLeft(@ScriptDir,3)") would that work? im not familiar with any coding language at all (apart from HTML) so i apologise for being a n00b! what do i need to change. I would be interested to know what each part of the code means (what on earth is string left?) Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 7, 2009 Share Posted April 7, 2009 if im not mistaken (often am) but FileCopy() you cant use variables in the source... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Valik Posted April 7, 2009 Share Posted April 7, 2009 if im not mistaken (often am) but FileCopy() you cant use variables in the source...I suggest you not spread misinformation like this. Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 7, 2009 Share Posted April 7, 2009 I suggest you not spread misinformation like this. :S sorry i guess i was thinking of Fileinstall () Filecopy () this is straight from help file source - The source path of the file(s) to copy. Wildcards are supported. dest - The destination path of the copied file(s). flag - [optional] this flag determines whether to overwrite files if they already exist. Can be a combination of the following: 0 = (default) do not overwrite existing files 1 = overwrite existing files 8 = Create destination directory structure if it doesn't exist (See Remarks). my bad... :S [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AJJ Posted April 7, 2009 Author Share Posted April 7, 2009 does anyone have any ideas what i need to do to put this into my code, im not really sure? Link to comment Share on other sites More sharing options...
Danny35d Posted April 7, 2009 Share Posted April 7, 2009 StringLeft = Returns a number of characters from the left-hand side of a string.FileCopy = Copies one or more files.@ScriptDir = Directory containing the running script.@UserProfileDir = Path to current user's Profile folder.$myPath = StringLeft(@ScriptDir,3) FileCopy(@UserProfileDir & "\Documents\*.*", $myPath, 9) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
AJJ Posted April 7, 2009 Author Share Posted April 7, 2009 hmm, thanks thats a bit clearer, - am i right in thinking that the first line in this code defines where the code is run from (lets call it "A" ) and then the second line says "copy this file: "ADAM\documents\*.*" into directory "A"" what does the 9 mean? ahhhhh also "stringleft = return "3" characters from the left hand side of the directory which would be "D" ":" and "\"" If thats what i think it is GENIUS! is there anything you cant do with this program??? the $mypath is just a label isnt it? awesome. Is this Basic or VB or C or what? thanks alot dude Link to comment Share on other sites More sharing options...
AJJ Posted April 7, 2009 Author Share Posted April 7, 2009 also, on this note, and this might be impossible, but is there a way to just copy subfolders and not the stuff in the root directory? also, is there a way of just copying certain types of files, like eg HTML docs or something and leave everything else? Link to comment Share on other sites More sharing options...
Danny35d Posted April 7, 2009 Share Posted April 7, 2009 also, on this note, and this might be impossible, but is there a way to just copy subfolders and not the stuff in the root directory? also, is there a way of just copying certain types of files, like eg HTML docs or something and leave everything else?Look at the links that I provide you it give you more information about FileCopy(). When you use FileCopy() 9 mean overwrite existing files and create destination directory structure if it doesn't exist. If you want to copy different types of file use the wildcards Ex:(*.htlm, *.doc) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
AJJ Posted April 7, 2009 Author Share Posted April 7, 2009 sweet ive just discovered wild cards actually! but what about sub folders? Link to comment Share on other sites More sharing options...
Danny35d Posted April 7, 2009 Share Posted April 7, 2009 sweet ive just discovered wild cards actually! but what about sub folders?You can do sub folders only, but you script will be a little bigger. You need to open the help file and search _FileReadToArray() and For...To functions.1) You need to create a list of sub folders, for that use _FileReadToArray()2) Then use For...To and combination of FileCopy() to copy the files from the sub folders. AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
rajeshontheweb Posted April 7, 2009 Share Posted April 7, 2009 (edited) can u check if this works? u might need to add expandcollapse popupCopySubFolders(@UserProfileDir & "\Documents\*.*", $myPath, 9) Func CopySubFolders($SourceFolder,$DestPath ) ; If C:\Temp contains a, b, c and destpath is a: Then A: will contain a,b,c Local $Search, $File , $Attributes , $FullPath ;Remove the end \ If specified If StringRight($SourceFolder,1) = "\" Then $SourceFolder = StringTrimRight($SourceFolder,1) $Search = FileFindFirstFile($SourceFolder & "\*.*") While 1 If $Search = -1 Then ExitLoop $File = FileFindNextFile($Search) If @error Then ExitLoop $FullPath = $SourceFolder & "\" & $File $Attributes = FileGetAttrib($FullPath) IF @ERROR Then ExitLoop If StringInStr($Attributes,"D") Then FileCopy($FullPath,$DestPath,9) Else CopySubFolders($FullPath, $DestPath) EndIf WEnd FileClose($Search) EndFunc Edited April 7, 2009 by rajeshontheweb Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 7, 2009 Share Posted April 7, 2009 @MyDocumentsDir ?? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
AJJ Posted April 7, 2009 Author Share Posted April 7, 2009 erm what? Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 7, 2009 Share Posted April 7, 2009 the path to your documents... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] 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