Natalia96 Posted February 8, 2014 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
JohnOne Posted February 8, 2014 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.
Natalia96 Posted February 8, 2014 Author 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
JohnOne Posted February 8, 2014 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.
l3ill Posted February 8, 2014 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
l3ill Posted February 8, 2014 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
Natalia96 Posted February 8, 2014 Author 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
l3ill Posted February 8, 2014 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
l3ill Posted February 8, 2014 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
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