Jump to content

Encrypt directory


Recommended Posts

OK, you straightened me out on part of it. I was reading your WinWaitClose as WinClose, which is not what's there:

if $drv <> "READY" then
    Run ("C:\Programme\TrueCrypt\Truecrypt.exe /v d:\x /lg /a /q")
    Sleep (100)
    Do
        WinwaitActive("Enter")
        WinWaitClose ("Enter")
        $test = 0
        $drv=DriveStatus("G:\")
        if $drv <> "READY"  AND WinExists("TrueCrypt") then
            $test=1
        endif
    Until $test=0   
endif

So, when the "Enter" window closes you have entered the password, and it will now take some time for TrueCrypt to mount the G: drive.

Now you seem to have a race condition: If the drive is not ready yet, but there is no "TrueCrypt" window open (because you used "AND"), the loop exits before the drive is mounted. If the intent is for the drive to be ready AND for the TrueCrypt window to have gone away, then you need OR in that line of code because -- you're not ready if the drive is not ready OR if the TrueCrypt window is still up.

:whistle:

Cannot accept that. Might be there is a 'race condition', but then it should not make a difference if I test the condition in an AND relation or two negated OR conditions - my opinion.

However, I tested the following: In the DO loop I inserted two sleep(500) statements before and after the $drv=DriveStatus("G:\") line. -> No success.

Second try: I deleted the part "AND WinExists("TrueCrypt") in the next line. Also no success.

In both cases the script still pauses and neiter the loop is continued nor the Quicken program starts. I tried both, the interpreter version .au3 and the compiled version .exe

- Wilfried

Link to comment
Share on other sites

Cannot accept that. Might be there is a 'race condition', but then it should not make a difference if I test the condition in an AND relation or two negated OR conditions - my opinion.

However, I tested the following: In the DO loop I inserted two sleep(500) statements before and after the $drv=DriveStatus("G:\") line. -> No success.

Second try: I deleted the part "AND WinExists("TrueCrypt") in the next line. Also no success.

In both cases the script still pauses and neiter the loop is continued nor the Quicken program starts. I tried both, the interpreter version .au3 and the compiled version .exe

- Wilfried

Try it this way:

If $drv <> "READY" Then
    Run("C:\Programme\TrueCrypt\Truecrypt.exe /v d:\x /lg /a /q")
    Sleep(100)
    WinWaitActive("Enter")
    WinWaitClose("Enter")
    Do
        $drv = DriveStatus("G:\")
        Sleep(100)
        TrayTip("G: is " & $drv, "Waiting for TrureCrypt to mount G:...", 5, 16)
    Until $drv = "READY"
    TrayTip("", "", 1)
EndIf

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The big Problem seems to be, that it take very long to open drive G:. If I inserted a sleep(1000) in my original script it works. But this is not what I wanted. So I modified it an shortened it.

I have to monitor the following conditions:

1. If drive G: is already open I start Quicken immediately otherwise

2.1 if I typed in the password correctly, Quicken should start

2.2 if I typed it in wrong, I get another chance

2.3 if I, however, push the "Cancel" button, the script should terminate

It seems, that if I wait, that TrueCrypt disappears, the drive G: has been mounted. So I check that and can fulfill all conditions of 2.

This is my new little script:

; Prüfe ob Laufwerk G vorhanden ist. Wenn nicht öffne es mit Truecrypt.

; Starte Quicken.

$drv=DriveStatus("G:\")

if $drv <> "READY" then

Run ("C:\Programme\TrueCrypt\Truecrypt.exe /v d:\g /lg /a /q")

$ret=WinwaitActive("Enter")

WinWaitClose ("Enter")

do

$test = 0

if WinExists("TrueCrypt") then

$test = 1

EndIf

Until $test = 0

endif

$drv=DriveStatus("G:\")

if $drv <> "READY" then exit

RunWait ("G:\\QUICKEN8\\QW.EXE")

Run("c:\programme\truecrypt\truecrypt /dg /q")

Exit

- Wilfried

Link to comment
Share on other sites

It seems, that if I wait, that TrueCrypt disappears, the drive G: has been mounted. So I check that and can fulfill all conditions of 2.

Or, just Do ... Until $drv = "READY", which is what my last post does much more simply. My loop checks status every 100msec, so I doubt you could notice the delay between the drive finally becoming available and the script continuing.

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Or, just Do ... Until $drv = "READY", which is what my last post does much more simply. My loop checks status every 100msec, so I doubt you could notice the delay between the drive finally becoming available and the script continuing.

:whistle:

Test for $drv="READY" would hang the loop if I "CANCEL" TrueCrypt.

- Wilfried

Link to comment
Share on other sites

Test for $drv="READY" would hang the loop if I "CANCEL" TrueCrypt.

- Wilfried

I see what you mean. What is your expected action for the script in that specific case, where you cancel TrueCrypt without successfully mounting G:?

:whistle:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...