Dnelre Posted February 26, 2010 Share Posted February 26, 2010 Hello. I'm a complete beginner with AutoIt, but that doesn't stop me from trying to create a time saving script! The script's purpose is to change permissions on folders, with the SETACL.EXE tool. I use AutoIt to get some answers from the user, for example WHICH folders to change permissions on, and which template of permissions that I want to apply. Now on to the problem: The SETACL.EXE tool takes parameters, like this: "SetACL.exe -on "C:\clue" -ot file -actn ace -ace "n:ewg;p:full;i:so,sc;m:set;w:dacl"" Since the permissions will be different from folder to folder, I can't hard-code the permissions in the script, so I've chosen to read the permissions from ini-files instead. I'm aware of the fact that I need to double-quote etc, but no matter what I do, I am unable to read the $PATH variable from the ini as anything else than plain text. Am I doing something wrong? SETACL.exe just complains that it cannot find the path $path... I get my $PATH from a simple $path = FileSelectFolder in the script, and that part works. The script works perfectly if the permissions are hard-coded. But with this ini..... [permissions] TPGPERMS=""-on & $path & -ot file -actn ace -ace ""n:ewg;p:full;i:so,sc;m:set;w:dacl"" ...it just won't work. Here's the "action" part of the script. $perms = IniRead(@ScriptDir & "\tpg.ini", "permissions", "TPGPERMS", "") and ShellExecuteWait(@ScriptDir & "\SETACL.EXE", $perms) What am I doing wrong? ..and one more thing! Even with the permissions hard-coded in the script, I'm having troubles if the $path contains spaces. What would the proper quoting be? Let me know if you need more details! Thanks in advance. Link to comment Share on other sites More sharing options...
BrettF Posted February 26, 2010 Share Posted February 26, 2010 (edited) Welcome to the forums Dnelre. The follow code will work with little modification to the ini and the script. Opt ("ExpandVarStrings", 1) $path = "C:\Nowhere\" $str = "-on $path$ -ot file -actn ace -ace ""n:ewg;p:full;i:so,sc;m:set;w:dacl" MsgBox (0, "", $str) As you can probably see i've set the script to parse $var_name$ in strings as variables. Similar to going "string..." & $var_name & "...string". I'm wondering if your logic is correct though. How are you generating this ini? Is it done manually? Is there a way to do it using AutoIt alone? Is it really neccessary. Maybe if we had some idea to what your end result was we could assist a little more. Cheers, Brett And sorry for my rude reply before. I was in a rush not to burn the house down... Edited February 26, 2010 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
MHz Posted February 26, 2010 Share Posted February 26, 2010 (edited) Welcome to the forum Dnelre, This may help you. ; get value for $path variable $path = FileSelectFolder('dialog text', '') ;if $path variable value is different to "" then process If $path <> "" Then ; read command from ini file $perms = IniRead(@ScriptDir & "\tpg.ini", "permissions", "TPGPERMS", "") ; replace literal string $path with value of $path variable $perms = StringReplace($perms, '$path', $path) ; execute the command ShellExecuteWait('"' & @ScriptDir & '\SETACL.EXE"', $perms) EndIf Edit: do the ini like this [permissions] TPGPERMS=-on "$path" -ot file -actn ace -ace "n:ewg;p:full;i:so,sc;m:set;w:dacl" Edited February 26, 2010 by MHz Link to comment Share on other sites More sharing options...
COD3369 Posted October 13, 2012 Share Posted October 13, 2012 Thanks mate for this its works flawlessly Link to comment Share on other sites More sharing options...
COD3369 Posted October 22, 2012 Share Posted October 22, 2012 (edited) my script code #include <Crypt.au3> $encryption = FileReadLine ( "users.txt" , 1 ) $key = FileReadLine ( "users.txt" , 2 ) $filename = FileReadLine ( "users.txt" , 3 ) $outname = FileReadLine ( "users.txt" , 4 ) $sSourceFile = $filename $sDestinationFile = $outname $vCryptKey = $key $iALG_ID = $encryption _Crypt_EncryptFile($sSourceFile, $sDestinationFile, $vCryptKey, $iALG_ID) users.txt $CALG_RC4 "123456" "data.txt" "data2.txt" not working what i am doing wrong ??? please help Edited October 22, 2012 by verma123 Link to comment Share on other sites More sharing options...
water Posted October 22, 2012 Share Posted October 22, 2012 Not working is a bit vague! You should always check the return value and macros @error and @extended when you don't get the expected result! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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