reloaded21 Posted May 25, 2015 Share 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 Link to comment Share on other sites More sharing options...
JohnOne Posted May 25, 2015 Share 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. Link to comment Share on other sites More sharing options...
water Posted May 25, 2015 Share 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
reloaded21 Posted May 25, 2015 Author Share 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!!! Link to comment Share on other sites More sharing options...
reloaded21 Posted May 26, 2015 Author Share 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 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