Totorian Posted July 2, 2012 Share Posted July 2, 2012 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#NoTrayIcon; Change to OnEvent modeOpt('GUIOnEventMode', 1); GUI CreationGuiCreate("TrueCrypt Volume Manager", 400, 300)GuiSetIcon("icon.ico"); Runs the GUIExit() function if the GUI is closedGUISetOnEvent($GUI_EVENT_CLOSE, 'GUIExit'); Logo / PicGuiCtrlCreatePic("\truecrypt.jpg",120,5,156,160); InstructionsGUICtrlCreateLabel("Choose Mount or Dismount:", 50, 180, 300, 15, 1)GUICtrlSetColor(-1,0xFF0000) ; Makes instructions Red; Button1GUICtrlCreateButton("Mount Volume", 100, 210, 200, 30)GUICtrlSetOnEvent(-1, 'mountvolume') ; Runs website() when pressed; Button2GUICtrlCreateButton("Dismount Volume", 100, 250, 200, 30)GUICtrlSetOnEvent(-1, 'dismountvolume') ; Runs email() when pressedFunc mountvolume() ; Hides the GUI while the function is running GUISetState(@SW_SHOW) ;Run("\TrueCrypt.exe /q /v \truecrypt_volume") ; ExitEndFuncFunc dismountvolume() ; Hides the GUI while the function is running GUISetState(@SW_SHOW) Run("\TrueCrypt.exe /q /d") ; ExitEndFunc; Shows the GUI after the function completesGUISetState(@SW_SHOW); Idles the script in an infinite loop - this MUST be included when using; OnEvent modeWhile 1 Sleep(500)WEnd; This function makes the script exit when the GUI is closedFunc GUIExit() ExitEndFunc Link to comment Share on other sites More sharing options...
SilverSekai Posted July 2, 2012 Share Posted July 2, 2012 (edited) 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 July 2, 2012 by SilverSekai Link to comment Share on other sites More sharing options...
Totorian Posted July 3, 2012 Author Share Posted July 3, 2012 Thank you for the suggestion SilverSekaiI 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") 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