johnmcloud Posted December 29, 2011 Share Posted December 29, 2011 (edited) Sorry guys for the inconvenience, but sometimes I get lost in the myriad functions of autoit, so I need a hand. Hope a day i'll help someone The part of the script i have difficulties: $Folder = GUICtrlRead($InFileInput) If Not FileExists($Folder) Then MsgBox(16, "Error", "no dir") ContinueLoop EndIf $password=GUICtrlRead($PasswordInput) If $password="" Then MsgBox(16,"Error","no pass") ContinueLoop EndIf $Array_Files = _FileListToArray(GUICtrlRead($InFileInput)) For $i = 1 To $Array_Files[0] $success = _Crypt_EncryptFile($Array_Files[$i], $Array_Files[$i] & ".crypt", $password, $algo) If $success Then ConsoleWrite("File " & $Array_Files[$i] & " is crypted" & $Array_Files[$i] & ".crypt" & @CRLF) Else ConsoleWrite("Error: " & @error & @CRLF) EndIf Next The script work, i'll select a dir and make all file of that dir with encryption. The problem is destination, i want to set the same dir of $InFileInput but if i change the destination something goes wrong and i have only 1 file instead of multiple file. Sorry for trouble, thanks for support Edited December 29, 2011 by johnmcloud Link to comment Share on other sites More sharing options...
BrewManNH Posted December 29, 2011 Share Posted December 29, 2011 Look at your For...Next variables, the array of file names is in an array $Array_Files and your loop is looking at $a_files. Not sure, but that might be a typo. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
johnmcloud Posted December 29, 2011 Author Share Posted December 29, 2011 Look at your For...Next variables, the array of file names is in an array $Array_Files and your loop is looking at $a_files. Not sure, but that might be a typo. Ops, It's a copy - paste error, my script has $Array_Files[0]. I have edited the first post. Link to comment Share on other sites More sharing options...
BrewManNH Posted December 29, 2011 Share Posted December 29, 2011 You're not specifying a folder name, just the file names and any folders in that folder. It is probably an error that it's not finding the folder where the files are located. You might want to try using this instead. $success = _Crypt_EncryptFile(GUICtrlRead($InFileInput) & "" & $Array_Files[$i], GUICtrlRead($InFileInput) & "" & $Array_Files[$i] & ".crypt", $password, $algo) I haven't tested it because you didn't post a working example script, and I haven't the time to make it work. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
johnmcloud Posted December 29, 2011 Author Share Posted December 29, 2011 (edited) You're not specifying a folder name, just the file names and any folders in that folder. It is probably an error that it's not finding the folder where the files are located. You might want to try using this instead. $success = _Crypt_EncryptFile(GUICtrlRead($InFileInput) & "" & $Array_Files[$i], GUICtrlRead($InFileInput) & "" & $Array_Files[$i] & ".crypt", $password, $algo) I haven't tested it because you didn't post a working example script, and I haven't the time to make it work. I'm not posting the GUI becouse is not ready, i have only a botton and a inputbox, next time i'll post everithing Your script work fine, my error was: $success = _Crypt_EncryptFile($Array_Files[$i], GUICtrlRead($InFileInput) & $Array_Files[$i] & ".crypt", $Password, $Algo) I don't have make the "" and the GUICtrlRead($InFileInput) for the origin, but it work also without it: $success = _Crypt_EncryptFile($Array_Files[$i], GUICtrlRead($InFileInput) & "" & $Array_Files[$i] & ".crypt", $Password, $Algo) Thanks BrewManNH, you saved many hour of time, i'll never thought to "" Edited December 29, 2011 by johnmcloud 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