Sign in to follow this  
Followers 0
johnmcloud

[SOLVED] FileSetAttrib - Variable & Macro

5 posts in this topic

#1 ·  Posted (edited)

Hi guys, i have a question.

Why this work:

FileSetAttrib("C:\Documents and Settings\Windows Xp\Desktop\Test", "+SH",1)

And this not?

$Folder="test"
FileSetAttrib('"' & @WorkingDir & "\" & $Folder & '"', "+SH",1)

Is a limitation or my error?

Thanks for support

Edited by johnmcloud

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The only reason that wouldn't work is if @WorkingDir isn't the directory you think it is.

Uh? Is the same directory, i have create a "Test" folder. Take a look:

$NewFolder="Test"
MsgBox(0,0,'"' & @WorkingDir & "" & $NewFolder & '"')

The result is the same dir of the script with full path, so is the same.

Edited by johnmcloud

Share this post


Link to post
Share on other sites

johnmcloud,

You have superfluous quotes in your "file pattern" parameter - try this:

FileSetAttrib(@WorkingDir & "" & $Folder, "+SH",1)

You do not need quotes around variables, only strings. You need additonal quotes around path strings when you pass them to the DOS console using Run(@ComSpec & " /c "....) and they contain spaces - but not with the AutoIt native commands. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites

johnmcloud,

You have superfluous quotes in your "file pattern" parameter - try this:

FileSetAttrib(@WorkingDir & "" & $Folder, "+SH",1)

You do not need quotes around variables, only strings. You need additonal quotes around path strings when you pass them to the DOS console using Run(@ComSpec & " /c "....) and they contain spaces - but not with the AutoIt native commands. :)

M23

You have right, i have made the " " becouse i have try without it and not work. The problem was in my script i need to add a Sleep(500) between DirCreate and FileSetAttrib, withuot it i don't know why don't work on my system, maybe becouse the folder has a long name.

Thanks all

Share this post


Link to post
Share on other sites

johnmcloud,

in my script i need to add a Sleep(500) between DirCreate and FileSetAttrib

You have to give the system time to recognize the new folder. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • Revelation343
      Mailing from Excel/variable storing
      By Revelation343
      Purpose of script: To send emails in Outlook based on data in an excel spreadsheet. From: fields are entered for purposes of sending on behalf of (delegate), copies A2 cell from excel for To: field, Subject field is a static value and entered, returns to excel spreadsheet to read A1 and copy the first name and insert into the body of a template at an insertion point. The From, and the body of the email change based on region, so currently I have 6 different scripts that do essentially the same thing with some minor changes and want to consolidate into one script to save time.
      Question:
      To expedite the process of this and cut down on the amount of scripts, 6 in total I use daily, is it possible for me to somehow add the region to column C in excel, have autoit read column C values per row, and then decide which function, within a master script, to execute and loop this until there is no value in column C field?
      Example spreadsheet:
      Rob | rob@annuity.com |Midwest
      Annie | annie@agency.com | Midwest
      Kyle | kyle@agency.com | MidAtlantic
      Rick | rick@megasales.com | MidAtlantic
      Blank | Blank | Blank |
      Example execution:
      Run Birthday.au3, execute loop part through hotkey
      Reads row 1, C1, value is Midwest, calls Midwest(), script runs as Midwest Birthday.au3 does currently
      Reads row 2, C2, value is Midwest, calls Midwest(), script runs as Midwest Birthday.au3 does currently
      Reads row 3, C3, value is MidAtlantic, calls MidAtlantic(), script runs as MidAtlantic Birthday.au3 currently
      Reads row 4, C4, value is MidAtlantic, calls MidAtlantic(), script runs as MidAtlantic Birthday.au3 currently
      Reads row 5, C5, value is null or blank, ends script through Exit
       
      Everything I have coded in my time in AutoIt has been based mostly on mouse based movements and I don't have variable programming knowledge so I feel like I'm close to understanding how to do this, but the reading/storing variables part is beyond my current skill set. Help is appreciated.
      Mail Merges don't work as delegated in Outlook 07, for those that might be questioning why I just don't do that.
       
      MidAtlantic Birthday.au3
      Midwest Birthday.au3
    • ur
      AutoItSetOption for arrays
      By ur
      If we give the below line in our script, we can expand the variables in double quotes to its values.
      AutoItSetOption ("ExpandVarStrings", 1) Like, 
      Local $b=4 MsgBox(0,"$b$","See subject") But coming to variables, they are not getting expanded.
      Local $a[3]=[1,2,3] Local $b=4 _ArrayDisplay($a) MsgBox(0,"$a$$b$","See subject") Could anyone please help me on this.
    • LegitStack
      Run variable as script
      By LegitStack
      Is there a way to execute the text inside a variable is if it was part of the script?
      In this example I'd like to get a message box pop up but I don't: 
      ;testme.au3   local $var = 'msgbox(64,"hello","world")'   $var is there a command that can be used like maybe 'Exec' or 'Execute' or something?
        local $var = 'msgbox(64,"hello","world")'   Execute $var  
    • Reizvoller
      Subscript Used on Non-Accessible Variable WinGetPos error
      By Reizvoller
      Func workSpaceSetup () ConsoleWrite ("workSpaceSetup" &@CRLF) $workSpace = WinGetHandle ("some site - Google Chrome") ConsoleWrite ($workSpace&@CRLF) $pos1 = WinGetPos ($workSpace) WinMove ($workSpace , "", $pos1[0] , $pos1[1] , 1366, 768, 0) EndFunc So the script is first, the error I get is second in the quote.
      This is one function of many for an app I am building but it is the first one that runs so I know there aren't other things at play here.
      The idea is to keep the window in the same space it is when the script runs but just resize it as this app is used across multiple computers with different screen resolutions.
      Could someone please elaborate upon what "Subscript used on non-accessible variable" means? 
      Oh and the variable is declared as "Global $pos1 = 0" at the top outside of any functions with the other global variables.
      Any advice would be greatly appreciated!
      -Reiz
    • RamPalav
      Send text to VBA form
      By RamPalav
      Hi,
      I want to send text into a VBA form's text field. Can someone please guide me on the autoit script that can help me.
      Below is the sample code that I need help on:
      #include <Excel.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> @ScriptDir ="D:\\AutoIT\" $sFilePath = @ScriptDir & "\ExcelForm.xlsm" Local $oAppl = _Excel_Open() ;Local $oAppl = _Excel_Open(False, Default, Default, Default, True) Local $sWorkbook = $sFilePath Local $oWorkbook = _Excel_BookOpen($oAppl, $sWorkbook) ConsoleWrite('before opening macro.........1') $oAppl.Run('mymacro') Sleep(3000) ConsoleWrite('After opening macro.........1') Send('First text') ConsoleWrite('After opening macro.........2') Send('{TAB}') ConsoleWrite('After opening macro.........3') Send('Second text') ConsoleWrite('After opening macro.........4') Send('{TAB}') Send('{Enter}') ConsoleWrite('After opening macro.........5') thanks,