Jump to content

Blocked applications | folder selecting


unuro
 Share

Recommended Posts

Hello!

So That I Could Do is all about myself in the software like this, Expect Improvements from you, Who Wants to Help Develop this script.

Thank you!

I'm sorry for the problems of writing in English, I'm from Romania!

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Crypt.au3>
#NoTrayIcon
$Form1 = GUICreate("Locked Software", 240, 52, -1, -1)
$Button1 = GUICtrlCreateButton("Lock All Files", 8, 16, 99, 25)
$Button2 = GUICtrlCreateButton("Unlock All Files", 120, 16, 107, 25)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Folder = FileSelectFolder("Choose a folder.", "", 1, @DesktopDir,$Form1)
If Not @error Then
$List1 = _FileListToArray($Folder, "*", 1)
For $nr = 1 To $List1[0]
ProcessClose($List1[$nr])
Sleep(1)
_Crypt_EncryptFile($Folder&""&$List1[$nr],$Folder&""&$List1[$nr]&".crypted","unu",$CALG_DES)
Sleep(1)
FileDelete($Folder&""&$List1[$nr])
Next
MsgBox(64,"Info","Finishied Crypt!")
ElseIf @error = 1 Then
ExitLoop($Folder)
Else
MsgBox(16,"Error",@error)
EndIf
Case $Button2
$Folder = FileSelectFolder("Choose a folder.", "", 1, @DesktopDir,$Form1)
If Not @error Then
$List1 = _FileListToArray($Folder, "*.crypted", 1)
For $nr = 1 To $List1[0]
$String = StringTrimRight($Folder&""&$List1[$nr], 8)
_Crypt_DecryptFile($Folder&""&$List1[$nr],$String,"unu",$CALG_DES)
Sleep(1)
FileDelete($Folder&""&$List1[$nr])
Next
MsgBox(64,"Info","Finishied Decrypt!")
ElseIf @error = 1 Then
ExitLoop($Folder)
Else
MsgBox(16,"Error",@error)
EndIf
EndSwitch
WEnd
Edited by unuro
Link to comment
Share on other sites

Looks and sounds like crap...

Looks like crap cause you didn't use AutoIt tags...

Sounds like crap cause you didn't explain what it does.

:mellow:

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Link to comment
Share on other sites

ok, sorry for that... please move this topic to 'General Help and Support "

Thank you!

UPDATE

I need this script as well done ....

I wanted your help on some improvements, if possible ...

such improvements, to remove the ". Crypted" and encrypt the same name.

Edited by unuro
Link to comment
Share on other sites

if the folder you select is empty the script is crash.

this is a fixed code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
#include <Crypt.au3>
#NoTrayIcon
$Form1 = GUICreate("Locked Software", 240, 52, -1, -1)
$Button1 = GUICtrlCreateButton("Lock All Files", 8, 16, 99, 25)
$Button2 = GUICtrlCreateButton("Unlock All Files", 120, 16, 107, 25)

GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$Folder = FileSelectFolder("Choose a folder.", "", 1, @DesktopDir,$Form1)
If Not @error Then
$List1 = _FileListToArray($Folder, "*", 1)
If Not IsArray($List1) Then
MsgBox(0,"error", "the selected folder is empty")
Else
For $nr = 1 To $List1[0]
ProcessClose($List1[$nr])
Sleep(1)
_Crypt_EncryptFile($Folder&""&$List1[$nr],$Folder&""&$List1[$nr]&".crypted","unu",$CALG_DES)
Sleep(1)
FileDelete($Folder&""&$List1[$nr])
Next
MsgBox(64,"Info","Finishied Crypt!")
EndIf
ElseIf @error = 1 Then
ExitLoop($Folder)
Else
MsgBox(16,"Error",@error)
EndIf
Case $Button2
$Folder = FileSelectFolder("Choose a folder.", "", 1, @DesktopDir,$Form1)
If Not @error Then
$List1 = _FileListToArray($Folder, "*.crypted", 1)
If Not IsArray($List1) Then
MsgBox(0,"error", "the selected folder is empty")
Else
For $nr = 1 To $List1[0]
$String = StringTrimRight($Folder&""&$List1[$nr], 8)
_Crypt_DecryptFile($Folder&""&$List1[$nr],$String,"unu",$CALG_DES)
Sleep(1)
FileDelete($Folder&""&$List1[$nr])
Next
MsgBox(64,"Info","Finishied Decrypt!")
EndIf
ElseIf @error = 1 Then
ExitLoop($Folder)
Else
MsgBox(16,"Error",@error)
EndIf
EndSwitch
WEnd
Edited by shai
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...