Natalia96 Posted February 8, 2014 Share Posted February 8, 2014 (edited) Hi all ,I am a beginner in this language I'm trying to make a code that Creat Shortcut for all files in a directory I tried to use $K = 'directory' $S = _FileListToArray($K), "*.*", 1) But it did not work & i couldnt finish the code please help me Edited February 8, 2014 by Natalia96 Link to comment Share on other sites More sharing options...
JohnOne Posted February 8, 2014 Share Posted February 8, 2014 Perhaps you don't have a folder named "directory". What language are you familiar with? 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...
Natalia96 Posted February 8, 2014 Author Share Posted February 8, 2014 Perhaps you don't have a folder named "directory". What language are you familiar with? 'directory' is the path for ex : "C:UsersUsernameDocuments" VB.NET Link to comment Share on other sites More sharing options...
JohnOne Posted February 8, 2014 Share Posted February 8, 2014 $S = _FileListToArray($K, "*.*", 1) 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...
l3ill Posted February 8, 2014 Share Posted February 8, 2014 Natalia96 Welcome to the Forums ! Here is the FileListToArray from the help file change a little to produce your request: #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; List all the files and folders in the desktop directory using the default parameters. Local $aFileList = _FileListToArray(@DesktopDir & "\test", "*", 1, True) ;======CHANGED If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf ; Display the results returned by _FileListToArray. _ArrayDisplay($aFileList, "$aFileList") ;=================================================================== For $i = 1 To $aFileList[0] ;LOOP THROUGH THE ARRAY AND CREATE SHORTCUTS FileCreateShortcut($aFileList[$i], $aFileList[$i]) Next ;=================================================================== EndFunc ;==>Example Let us know if you have any questions... Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted February 8, 2014 Share Posted February 8, 2014 (edited) I just noticed your request about the icons: This is also possible in the FileCreatShortcut Parameters Also have a look at the Directory Macros to point to your "C:UsersUsernameDocuments" @MyDocumentsDir Edited February 8, 2014 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Natalia96 Posted February 8, 2014 Author Share Posted February 8, 2014 Natalia96 Welcome to the Forums ! Here is the FileListToArray from the help file change a little to produce your request: #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> Example() Func Example() ; List all the files and folders in the desktop directory using the default parameters. Local $aFileList = _FileListToArray(@DesktopDir & "\test", "*", 1, True) ;======CHANGED If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf ; Display the results returned by _FileListToArray. _ArrayDisplay($aFileList, "$aFileList") ;=================================================================== For $i = 1 To $aFileList[0] ;LOOP THROUGH THE ARRAY AND CREATE SHORTCUTS FileCreateShortcut($aFileList[$i], $aFileList[$i]) Next ;=================================================================== EndFunc ;==>Example Let us know if you have any questions... Bill Thank u I tried it but i didn't got any shortcut It didn't wok Link to comment Share on other sites More sharing options...
l3ill Posted February 8, 2014 Share Posted February 8, 2014 They should be there where the other files are... (it's just an example). Where do you want them to go? My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
l3ill Posted February 8, 2014 Share Posted February 8, 2014 (edited) This (for instance) will send them to the desktop: needs this include to work #include <WinAPIShPath.au3> ;=================================================================== For $i = 1 To $aFileList[0] ;LOOP THROUGH THE ARRAY AND CREATE SHORCUTS $fileName = _WinAPI_PathStripPath($aFileList[$i]) FileCreateShortcut($aFileList[$i], @DesktopDir & "\" & $fileName) Next ;=================================================================== Edited February 8, 2014 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example 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