Jump to content

Help with cancel button.


Recommended Posts

 

$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
EndIf

EDIT: code box being an arse.

 

Edited 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

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 - 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 (NEW 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

 

Link to comment
Share on other sites

 

$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
EndIf

EDIT: 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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...