azkerm Posted January 1, 2021 Share Posted January 1, 2021 Hi There, So, I'm not an expert when it comes to coding and I have been using AutoIT with a basic script given by one of my friend. I was using it with only one application execution at a time. Now I'm struggling to set two. For example, below scripts checks and mounts my secure partition by assigning a drive letter (upon typing my password at the prompt). Once the partition is mounted, the script will run the Google drive application (this is to avoid application turning on before partition is available). Mount Script #AutoIt3Wrapper_icon=lock.ico #include"_TC.au3" _TC_Path("C:\Program Files\TrueCrypt\TrueCrypt.exe") $result=True if DriveStatus("S:\")<> "INVALID" Then ;Check if we're already mounted $result=True else $result =_TC_Mount("C:\SecureDrive\SecDrive.tc","S") EndIf If $result = True Then $PID = ProcessExists("googledrivesync.exe") ; Will return the PID or 0 if the process isn't found. If not $PID Then $result= Run ("C:\Program Files\Google\Drive\googledrivesync.exe") if not $result then MsgBox(0,"Error", "Could not load GoogleDrive",5) EndIf Else MsgBox(0,"Mount Cancelled","Secure Partition has not been mounted.",1) EndIf Unmount Script #include"_TC.au3" _TC_Path("C:\Program Files\TrueCrypt\TrueCrypt.exe") $result=True $PID = ProcessExists("googledrivesync.exe") and ; Will return the PID or 0 if the process isn't found. If $PID Then $result=ProcessClose($PID) If not $result Then MsgBox(0,"Unmount Aborted","Could not shutdown properly") Else ;Stop the indexing service as we use this primarily for items on secure drive $result = RunWait(@ComSpec & " /c " & 'sc stop wsearch', "", @SW_HIDE) if DriveStatus("S:\")<> "INVALID" Then $result =_TC_UnMount("S",1) if not $result then MsgBox(0,"Error Unmounting","An error occured unmounting the secure drive") Else MsgBox(0,"Secure Partition Not Found","It appears as if the secure partition is not mounted",2) EndIf EndIf What I'm trying to achieve here is, add one more .exe process execute during mount and kill during unmount... with the current script above, I will add dropbox as my second process. I'm quiet unsure how to add this. Appreciate any help on this. Link to comment Share on other sites More sharing options...
Nine Posted January 1, 2021 Share Posted January 1, 2021 What is the full path/name of the drop box exe ? Add a run and an error handling after the run statement. Try something, and post full code if that does not work. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
azkerm Posted January 8, 2021 Author Share Posted January 8, 2021 On 1/1/2021 at 8:12 PM, Nine said: What is the full path/name of the drop box exe ? Add a run and an error handling after the run statement. Try something, and post full code if that does not work. I'm not sure if I'm following you... I'm trying to add two apps on the same code... above is what I use... Link to comment Share on other sites More sharing options...
Nine Posted January 8, 2021 Share Posted January 8, 2021 For Google Drive the full path/name is "C:\Program Files\Google\Drive\googledrivesync.exe" I am asking you the same thing for Drop Box, what is it ? Because if you want to check if the process exists, you need the name of the exe, right ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
azkerm Posted January 9, 2021 Author Share Posted January 9, 2021 Okay I got it.. Apologies, its not dropbox, its onedrive... and the full path for that is C:\Users\Admin\AppData\Local\Microsoft\OneDrive hope this helps! Link to comment Share on other sites More sharing options...
Nine Posted January 9, 2021 Share Posted January 9, 2021 Maybe this : #AutoIt3Wrapper_icon=lock.ico #include"_TC.au3" _TC_Path("C:\Program Files\TrueCrypt\TrueCrypt.exe") $result = True If DriveStatus("S:\") <> "INVALID" Then ;Check if we're already mounted $result = True Else $result = _TC_Mount("C:\SecureDrive\SecDrive.tc", "S") EndIf If $result Then $PID = ProcessExists("googledrivesync.exe") ; Will return the PID or 0 if the process isn't found. If Not $PID Then $result = Run("C:\Program Files\Google\Drive\googledrivesync.exe") If Not $result Then Exit MsgBox(0, "Error", "Could not load GoogleDrive", 5) EndIf $PID = ProcessExists("SkyDrive.exe") If Not $PID Then $result = Run("C:\Users\Admin\AppData\Local\Microsoft\OneDrive\SkyDrive.exe") If Not $result Then Exit MsgBox(0, "Error", "Could not load OneDrive", 5) EndIf Else MsgBox(0, "Mount Cancelled", "Secure Partition has not been mounted.", 1) EndIf I will leave you the pleasure of doing the unmount counterpart. azkerm 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
azkerm Posted January 9, 2021 Author Share Posted January 9, 2021 Hey.. thank you so much, that worked. however I tried unmount part as below but it only closes the onedrive not the googledrivesync... any idea why? #include"_TC.au3" _TC_Path("C:\Program Files\TrueCrypt\TrueCrypt.exe") $result=True $PID = ProcessExists("googledrivesync.exe") ; If $PID Then $result=ProcessClose($PID) $PID = ProcessExists("OneDrive.exe") ; If $PID Then $result=ProcessClose($PID) If not $result Then MsgBox(0,"Unmount Aborted","Could not shutdown properly") Else ;Stop the indexing service as we use this primarily for items on secure drive $result = RunWait(@ComSpec & " /c " & 'sc stop wsearch', "", @SW_HIDE) if DriveStatus("S:\")<> "INVALID" Then $result =_TC_UnMount("S",1) if not $result then MsgBox(0,"Error Unmounting","An error occured unmounting the secure drive") Else MsgBox(0,"Secure Partition Not Found","It appears as if the secure partition is not mounted",2) EndIf EndIf Link to comment Share on other sites More sharing options...
Nine Posted January 9, 2021 Share Posted January 9, 2021 (edited) You got the process name wrong. Check carefully my code... Also the first $result is erased by the second, careful about that you are missing a possible error there ! Finally you do not check result of RunWait, you should to get a robust script. Edited January 9, 2021 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
azkerm Posted January 11, 2021 Author Share Posted January 11, 2021 Hey thank you so much for the support. I managed to replicate it to unmount and it worked.. Googledrive has two processes to kill and I repeated the processes in the code, it worked. 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