Second.vbs box...

Discussion in 'Scripting' started by timesurfer, Mar 24, 2014.

  1. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    #1 timesurfer, Mar 24, 2014
    Last edited by a moderator: Apr 20, 2017
    Almost finished with my project again except for one thing...

    Code:
    echo :Messagebox>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo set args=WScript.Arguments ^>msgbox.vbs >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) ^>^>msgbox.vbs >>%SystemDrive%\Trial\IR7\IR7.bat 
    echo msgbox.vbs "IR7" "Your 180 day free trial has ended, do you wish to install IR7 again?" 4 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF %%ERRORLEVEL%% EQU 6 del /s /q msgbox.vbs ^>nul ^&^& call :ReinstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF %%ERRORLEVEL%% EQU 7 del /s /q msgbox.vbs ^>nul ^&^& call :UninstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    This .vbs code gives Yes/No message box then redirects to another function either reinstall/uninstall

    I would like it to give second msg box that says

    "One moment please while IR7 is reinstalling" if reinstall is pressed

    If uninstall is pressed I'd like to give message

    "IR7 has been successfully uninstalled"

    I saw somewhere where a msg box button opens up another message box

    Any ideas
     
  2. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    #2 Humphrey, Mar 24, 2014
    Last edited by a moderator: Apr 20, 2017
    rough copy i guess.

    Code:
    @ECHO OFF 
    ECHO set args=WScript.Arguments >>msgbox.vbs
    ECHO.wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) >>msgbox.vbs 
    msgbox.vbs "IR7" "Your 180 day free trial has ended, do you wish to install IR7 again?" 4
    IF %ERRORLEVEL% EQU 6 msgbox.vbs "IR7" "One moment please while IR7 is reinstalling..." 6 & GOTO :REINSTALL
    IF %ERRORLEVEL% EQU 7 GOTO :UNINSTALL
    
    :REINSTALL
    REM Reinstall process. 
    
    :UNINSTALL
    REM Uninstall process. 
    msgbox.vbs "IR7" "IR7 has been successfully uninstalled." 1 & PAUSE >NUL
    
    :EOF
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    #3 timesurfer, Mar 25, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Awesome :)

    Only, I wanted .vbs message box's for each yes/no option

    Remember, I was the one who found out how to run the "check" batch silent, so it won't just give message unless maybe we we're to write it to another batch with echo stuff

    Yea, I have been doing this stuff for too long (4 years) :suicide:...lol

    :shisha:
     
  4. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    Then please explain further what it is you are looking for.
    As the code ive posted goes, the yes/no buttons when pressed trigger another .vbs msg box with the text you requested.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    It looks awesome, will test it now :worthy:...lol
     
  6. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    #6 timesurfer, Mar 26, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Ok, so how do I incorporate this:

    Code:
    IF %%ERRORLEVEL%% EQU 6 msgbox.vbs "IR7" "One moment please while IR7 is reinstalling..." 6 & GOTO :ReinstallIR7
    IF %%ERRORLEVEL%% EQU 7 GOTO :UninstallIR7
    into this:

    Code:
    echo :Messagebox>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo set args=WScript.Arguments ^>msgbox.vbs >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) ^>^>msgbox.vbs >>%SystemDrive%\Trial\IR7\IR7.bat 
    echo msgbox.vbs "IR7" "Your 180 day free trial has ended, do you wish to install IR7 again?" 4 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF %%ERRORLEVEL%% EQU 6 del /s /q msgbox.vbs ^>nul ^&^& call :ReinstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF %%ERRORLEVEL%% EQU 7 del /s /q msgbox.vbs ^>nul ^&^& call :UninstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    Code:
    echo :UninstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    echo msgbox.vbs "IR7" "IR7 has been successfully uninstalled." 1 >NUL
    echo REG  ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation" /v NotificationDisabled /t REG_DWORD /d 0 /f ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /delete /tn "IR7" /f ^>NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /delete /tn "Hybrid2" /f ^>NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /delete /tn "Hybrid3" /f ^>NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /query ^| FINDSTR /I "IORRT" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF ERRORLEVEL 1 ( >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO TrialFolderDelete >>%SystemDrive%\Trial\IR7\IR7.bat
    echo ) ELSE ( >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO IR7FolderDelete >>%SystemDrive%\Trial\IR7\IR7.bat
    echo ) >>%SystemDrive%\Trial\IR7\IR7.bat
    
    echo :TrialFolderDelete>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo rd /s /q %SystemDrive%\Trial ^>NUL ^>^>%SystemDrive%\removeTrial.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo schtasks /delete /tn "removeTrial" /f ^>NUL ^>^>%SystemDrive%\removeTrial.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo del /F /Q %SystemDrive%\removeTrial.bat ^>nul ^>^>%SystemDrive%\removeTrial.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /create /tn "removeTrial" /tr "%SystemDrive%\removeTrial.bat" /sc onlogon /ru "" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /run /tn "removeTrial" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO :Exit >>%SystemDrive%\Trial\IR7\IR7.bat
    
    echo :IR7FolderDelete>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo rd /s /q %SystemDrive%\Trial\IR7 ^>NUL ^>^>%SystemDrive%\removeIR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo schtasks /delete /tn "removeIR7" /f ^>NUL ^>^>%SystemDrive%\removeIR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo del /F /Q %SystemDrive%\removeIR7.bat ^>nul ^>^>%SystemDrive%\removeIR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /create /tn "removeIR7" /tr "%SystemDrive%\removeIR7.bat" /sc onlogon /ru "" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /run /tn "removeIR7" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO :Exit >>%SystemDrive%\Trial\IR7\IR7.bat
    
    For the reinstall when windows closes that msg box will auto close

    But for the uninstall, I wonder how to do message but have the uninstall do it's thing

    Should I put it at end of both :TrialFolderDelete and :IR7FolderDelete functions and again how should I close it after uninstall

    Can I use an ping to give delay to read message

    The reinstall msg box I'll want to be there till it restarts...

    The uninstall can however, say uninstall before it actually uninstall and by the time the uninstall msg box closes it actually will be uninstalled
     
  7. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60

    What?

    You would need to have the uninstall process be called as another command prompt as batch is a one line at a time kinda girl.

    taskkill /f /im wscript.exe kills the process running the msgbox.vbs and could be used to kill the msgbox.

    Ping could be used to delay anything.

    I will have to look into on getting my little code to work into that you've posted cause that batch output and multiple %%%% >>>> etc is just looney.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. s1ave77

    s1ave77 Has left at his own request

    Aug 15, 2012
    16,104
    24,378
    340
    Don't ask how my brain was hurt after getting this done :cool2:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    #9 timesurfer, Mar 26, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I think a

    Code:
    del /s /q msgbox.vbs
    will work cause the reinstall msgbox will close itself cause of restart so no problem there, just del /s /q msgbox.vbs for reinstall, then do "One moment please while IR7 is reinstalling..."

    For uninstall, we can put an

    Code:
    del /s /q msgbox.vbs
    So after 5 second ping we delete "IR7 has been successfully uninstalled." msgbox :shisha:...lol

    [​IMG]
     
  10. Humphrey

    Humphrey MDL Expert

    Dec 13, 2011
    1,466
    990
    60
    [​IMG]
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    :roflmao:...lol
     
  12. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    #12 timesurfer, Mar 26, 2014
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I think this does it!?

    Code:
    echo :Messagebox>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo set args=WScript.Arguments ^>msgbox.vbs >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo wscript.quit MsgBox(Replace(Replace(args.item(1),"{cr}",vbNewLine,1,-1,1),"{qt}",Chr(34),1,-1,1),args.item(2),args.item(0)) ^>^>msgbox.vbs >>%SystemDrive%\Trial\IR7\IR7.bat 
    echo msgbox.vbs "IR7" "Your 180 day free trial has ended, do you wish to install IR7 again?" 4 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF %%ERRORLEVEL%% EQU 6 del /s /q msgbox.vbs ^&^& msgbox.vbs "IR7" "One moment please while IR7 is reinstalling..." 0 ^&^& call :ReinstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF %%ERRORLEVEL%% EQU 7 del /s /q msgbox.vbs ^>nul ^&^& call :UninstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    
    echo :UninstallIR7>>%SystemDrive%\Trial\IR7\IR7.bat
    echo msgbox.vbs "IR7" "IR7 has been successfully uninstalled..." 0 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo REG  ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation" /v NotificationDisabled /t REG_DWORD /d 0 /f ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /delete /tn "IR7" /f ^>NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /delete /tn "Hybrid2" /f ^>NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /delete /tn "Hybrid3" /f ^>NUL 2>&1 >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /query ^| FINDSTR /I "IORRT" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo IF ERRORLEVEL 1 ( >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO TrialFolderDelete >>%SystemDrive%\Trial\IR7\IR7.bat
    echo ) ELSE ( >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO IR7FolderDelete >>%SystemDrive%\Trial\IR7\IR7.bat
    echo ) >>%SystemDrive%\Trial\IR7\IR7.bat
    
    echo :TrialFolderDelete>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo rd /s /q %SystemDrive%\Trial ^>NUL ^>^>%SystemDrive%\removeTrial.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo schtasks /delete /tn "removeTrial" /f ^>NUL ^>^>%SystemDrive%\removeTrial.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo del /F /Q %SystemDrive%\removeTrial.bat ^>nul ^>^>%SystemDrive%\removeTrial.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /create /tn "removeTrial" /tr "%SystemDrive%\removeTrial.bat" /sc onlogon /ru "" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /run /tn "removeTrial" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO :Exit >>%SystemDrive%\Trial\IR7\IR7.bat
    
    echo :IR7FolderDelete>>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo rd /s /q %SystemDrive%\Trial\IR7 ^>NUL ^>^>%SystemDrive%\removeIR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo schtasks /delete /tn "removeIR7" /f ^>NUL ^>^>%SystemDrive%\removeIR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo echo del /F /Q %SystemDrive%\removeIR7.bat ^>nul ^>^>%SystemDrive%\removeIR7.bat >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /create /tn "removeIR7" /tr "%SystemDrive%\removeIR7.bat" /sc onlogon /ru "" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo schtasks /run /tn "removeIR7" ^>NUL >>%SystemDrive%\Trial\IR7\IR7.bat
    echo GOTO :Exit >>%SystemDrive%\Trial\IR7\IR7.bat
     
  13. Compo

    Compo MDL Member

    Mar 29, 2011
    136
    106
    10
    Just in case you've missed this post, I provided you with a very simple solution to help manage multiple nesting of your scripts.
     
  14. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,112
    270
    Thank you for your help

    Right now I'm just trying to add the two msg box's that are given whether or not Yes/No button is pressed

    :D