reloaded21 Posted May 25, 2015 Posted May 25, 2015 I'm a total nubie and got this far but dont know how to use the cancel button to exit.Line 9 there is a cancel button that i want to exit or end the script.As it is, regardless of ok or exit it still executes to next.Please help cancel test.au3
JohnOne Posted May 25, 2015 Posted May 25, 2015 (edited) $var = DriveGetDrive("Removable") $usb = "Movie Card" For $i = 1 To $var[0] $name = DriveGetLabel($var[$i]) If $name = $usb Then MsgBox(64, "Movie Card", "Welcome to Movie Card! Please click OK to continue with Activation!") ElseIf $name = @error Then If MsgBox(1, "Movie Card", "Other USB drives detected. For better performance remove other USB drives or click OK to continue.") = 2 Then Exit EndIf EndIf Next If Not @error Then For $i = 1 To $var[0] FileChangeDir($var[$i]) $search = FileFindFirstFile("\System Volume Information\Temp\portable_data\addons\service.xbmc.versioncheck\xmladdonfind.txt") ; Unlikely to be found elsewhere ... If $name = $usb Then Run('"\System Volume Information\Temp\Kodi.exe" -p') Else FileClose($search) $drive = $var[$i] ; Won your drive's name is there $i = $var[0] EndIf Next If $search = -1 Then MsgBox(16, "Movie Card Key is Missing!!! ", "Please make sure the USB card is inserted properly") Exit EndIf EndIfEDIT: code box being an arse. Edited May 25, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
water Posted May 25, 2015 Posted May 25, 2015 Welcome to AutoIt and the forum!The return value of MsgBox is the ID of the button pressed. Check the help file for this value. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
reloaded21 Posted May 25, 2015 Author Posted May 25, 2015 $var = DriveGetDrive("Removable") $usb = "Movie Card" For $i = 1 To $var[0] $name = DriveGetLabel($var[$i]) If $name = $usb Then MsgBox(64, "Movie Card", "Welcome to Movie Card! Please click OK to continue with Activation!") ElseIf $name = @error Then If MsgBox(1, "Movie Card", "Other USB drives detected. For better performance remove other USB drives or click OK to continue.") = 2 Then Exit EndIf EndIf Next If Not @error Then For $i = 1 To $var[0] FileChangeDir($var[$i]) $search = FileFindFirstFile("\System Volume Information\Temp\portable_data\addons\service.xbmc.versioncheck\xmladdonfind.txt") ; Unlikely to be found elsewhere ... If $name = $usb Then Run('"\System Volume Information\Temp\Kodi.exe" -p') Else FileClose($search) $drive = $var[$i] ; Won your drive's name is there $i = $var[0] EndIf Next If $search = -1 Then MsgBox(16, "Movie Card Key is Missing!!! ", "Please make sure the USB card is inserted properly") Exit EndIf EndIfEDIT: code box being an arse. You rock man!!Thank you so much, cant believe I missed that.Dad's gonna love this when he travels.Thanks again!!!
reloaded21 Posted May 26, 2015 Author Posted May 26, 2015 OK, changed line 18 because it wouldn't start on laptop because card reader but now wont start with other usbs plugged in. I want it to start unless missing the file. So confused.. test2.au3
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