Jump to content
Sign in to follow this  

Trouble with "Run" command for Mounting Truecrypt Volume

Recommended Posts


I'm extremely new to Autoit, let alone scripting as a whole. I'm trying to use the below code to create a simple menu that will mount or dismount a TrueCrypt Volume. I'm trying to run this from a flash drive and don't know what Drive letter might be assigned to the machine I plug the flash drive in to. The problem area is in red text below. When running the script it will launch truecrypt but it can't find the volume. If I add "F:\" (which is what the drive letter is on my machine) it works fine. Please help.

; Includes the GuiConstants (required for GUI function usage)

#include <GuiConstants.au3>

; Hides tray icon


; Change to OnEvent mode

Opt('GUIOnEventMode', 1)

; GUI Creation

GuiCreate("TrueCrypt Volume Manager", 400, 300)


; Runs the GUIExit() function if the GUI is closed


; Logo / Pic


; Instructions

GUICtrlCreateLabel("Choose Mount or Dismount:", 50, 180, 300, 15, 1)

GUICtrlSetColor(-1,0xFF0000) ; Makes instructions Red

; Button1

GUICtrlCreateButton("Mount Volume", 100, 210, 200, 30)

GUICtrlSetOnEvent(-1, 'mountvolume') ; Runs website() when pressed

; Button2

GUICtrlCreateButton("Dismount Volume", 100, 250, 200, 30)

GUICtrlSetOnEvent(-1, 'dismountvolume') ; Runs email() when pressed

Func mountvolume()

; Hides the GUI while the function is running


;Run("\TrueCrypt.exe /q /v \truecrypt_volume")

; Exit


Func dismountvolume()

; Hides the GUI while the function is running


Run("\TrueCrypt.exe /q /d")

; Exit


; Shows the GUI after the function completes


; Idles the script in an infinite loop - this MUST be included when using

; OnEvent mode

While 1



; This function makes the script exit when the GUI is closed

Func GUIExit()



Share this post

Link to post
Share on other sites

I did this.

I made a shortcut in c: (CursorLock.lnk

The shortcut contains windows parameters that it seems autoit doesn't understand (maybe a include.au3 will resolve this) I.E. ""C:Program Files (x86)Cursor LockCursorLock.exe" /A:"D:ExampleDirNOTAGAME.exe" /M:2"

Then I used a function in autoit that is included in process.au3

So you'll have to write

#include <Process.au3>

in the first line of the script then when you need to run your executable you'll write

Local $rc = _RunDos("start C:CursorLock")

I dono if it works or if there's a better way, I just started learning 3 days ago with no previous programming experience, still, it works for me...

EDIT: BTW you'll have to create a shortcut that has no spaces in the path or the name of the .lnk for _RunDos to work... I.E. C:My testCursor lock will not work, cheers

Edited by SilverSekai

Share this post

Link to post
Share on other sites

Thank you for the suggestion SilverSekai

I tried using the code below as well but had the same outcome. TrueCrypt will open, I can type my password and then when it attempts to load volume it fails because it can't find the volume. Adding the current drive letter assigned fixes the issue, but that's not really what I'm looking for. I have a menu batch file that does the same task flawlessly. In the DOS batch file the command line to mount volume is --> Start %~dp0%TrueCrypt.exe /q /v %~dp0%truecrypt_volume. The reason I added "%~dp0%" is because it's on a flash drive and I don't always know what drive letter will be assigned to that drive. I'm trying to accomplish the same thing in Autoit as I have in DOS.

#include <Process.au3>

Local $rc = _RunDos("TrueCrypt.exe /q /v truecrypt_volume")

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