Jump to content

Search and set files attributes


Recommended Posts

Hello everyone,

I used AutoIt and would like to create a script for Customize the Quick Launch shortcut :

I search a script for search a file with the full path ex file : Microsoft Office Excel 2003.lnk and put on the file the attributes Hidden

Do you have an idea ?

Many thanks for your help

Christophe

Link to comment
Share on other sites

  • Moderators

Sorcier062,

Welcome to the AutoIt forum. :)

Look at the RecFileListToArray UDF in my sig - this will let you find your .lnk file wherever it is on your drive. Then you can use FileSetAttrib to change its attributes. :D

Have a go at coding it yourself - you know where we are if you run into difficulties. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I try the script and it work correctly but i don't know how to set attribute (Hidden) with the Array :

#include<Array.au3>

#include"_FileListToArrayEx.au3"

$ar_Array = _FileListToArrayEx("c:", "Microsoft Office Excel 2003.lnk", 1, 2)

;_ArrayDisplay($ar_Array, "Liste fichier") ; Ceci est facultatif, c'est juste pour afficher la liste des fichiers.

_ArrayDisplay($ar_Array,"Liste fichier") ; Ceci est facultatif, c'est juste pour afficher la liste des fichiers.

;~ MsgBox(1,"Test", $ar_Array)

FileSetAttrib($ar_Array, "+H", 1)

Link to comment
Share on other sites

  • Moderators

Sorcier062,

What you need to do is to loop through the elements of the array and set the attribute for each one.

As you didi nto use my UDF I have no idea about the format of the elements within your $ar_Array - I will assume it is the full path with a count in element [0]:

#include"_FileListToArrayEx.au3"
; Find the files
$ar_Array = _FileListToArrayEx("c:", "Microsoft Office Excel 2003.lnk", 1, 2)
;Loop through the array
For $i = 1 To $ar_Array[0]
    ; And for each file in the array we set the attribute
    FileSetAttrib($ar_Array[$i], "+H") ; Do not use 1 here - we do nto want recursion ;)
Next

Array and loops are fundamental parts of a coders toolbox - you need to learn how to use them. Have you looked at the excellent AutoIt tutorials here and here. There is also an Arrays tutorial in the Wiki that would be worth a look. ;)

Good luck. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Sorcier062,

i'm a beginner

We all were at one time. :D

Those tutorials are very good - I do suggest reading/running them. :)

And you know where we are if you have questions - as long as you have looked in the Help file first! ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...