How To Run Task If *Not* Connected To Specific Network?

Page 3 of 3 FirstFirst 123

  1. Posts : 11,654
    Windows 10 Home x64 Version 21H2 Build 19044.1776
       #21

    There is something worth trying in the batch file. Replace the line
    "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe"
    with one of two multi-line variations to spawn a parallel vbs process that will run EZ minimised / hidden.

    My notes are not in a state that allows me just to copy & paste a whole solution. If you are going to try this I will look at the subject later today.

    The idea is, in essence,
    1 running an "on the fly" vbs script from the batch file
    2 the vbs script runs EZ minimised / hidden.

    Denis
      My Computer


  2. Posts : 30
    Windows 10
    Thread Starter
       #22

    Ah ok, so change the link to the program to be a 2nd VBS file set up in the same way as the first, but opening the program as opposed to the bat file?
      My Computer


  3. Posts : 11,654
    Windows 10 Home x64 Version 21H2 Build 19044.1776
       #23

    Okay, here it is. Hot off the press, only tested with one sample application.

    These lines of code are to replace the current single line
    Code:
    "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe"
    but I suggest that you run them as separate batch files in the first instance so you can see how EZ responds.

    1 Minimising version - EZ will be seen on the Taskbar
    Code:
    set ThisVBSFolder=%TEMP%
    set ThisVBScript="%ThisVBSFolder%\VBS-OnTheFly-%RANDOM%.vbs"
    echo set WshShell = WScript.CreateObject("WScript.Shell") > %ThisVBScript%
    echo WshShell.Run chr(34) ^& "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe" ^& Chr(34), 7 >> %ThisVBScript%
    echo Set WshShell = Nothing >> %ThisVBScript%
    call %ThisVBScript%
    del %ThisVBScript%

    2 Hiding version - EZ should only be seen in the list of processes in the Task mgr, Processes tab but I have no idea how its Notifications area icon might react or if it can do its job while it's hidden.
    Code:
    set ThisVBSFolder=%TEMP%
    set ThisVBScript="%ThisVBSFolder%\VBS-OnTheFly-%RANDOM%.vbs"
    echo set WshShell = WScript.CreateObject("WScript.Shell") > %ThisVBScript%
    echo WshShell.Run chr(34) ^& "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe" ^& Chr(34), 0 >> %ThisVBScript%
    echo Set WshShell = Nothing >> %ThisVBScript%
    call %ThisVBScript%
    del %ThisVBScript%

    Let me know how you get on running these as separate batch files first. The point of this is just to keep things as simple as possible for testing.

    Denis
      My Computer


  4. Posts : 11,654
    Windows 10 Home x64 Version 21H2 Build 19044.1776
       #24

    I have now corrected the above code.
    - I accidentally included a couple of my test lines.
    - Then I deleted essential lines instead of the test lines I had intended to delete.
    - Then I sorted them out.

    Denis
      My Computer


  5. Posts : 30
    Windows 10
    Thread Starter
       #25

    Thank you very much! Just to confirm, I'll copy these into separate batch files and then replace
    Code:
    "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe"
    with a link to one of those files. I will leave
    Code:
    Start "Starting the application" /MIN
    as-is.

    - - - Updated - - -

    Right! So script 1 has it start minimised (the same as the previous set-up) as expected, but script 2 is just opening the program as normal (as if just opening the program directly (ie window displayed))
      My Computer


  6. Posts : 11,654
    Windows 10 Home x64 Version 21H2 Build 19044.1776
       #26

    No.

    1 Copy the Minimising version code into a batch file of its own and run it.
    - You should see EZ on the taskbar.
    - Check that it does its job when run this way.
    - Then close EZ so you are ready for the second test.

    2 Copy the Hiding version code into a batch file of its own and run it.
    - EZ should only be seen in the list of processes in the Task mgr, Processes tab but I have no idea how its Notifications area icon might react or if it can do its job while it's hidden.
    - Check that it does its job when run this way.
    - Then close EZ so you are ready for running normally.

    3 Decide which you want - Minimised or Hidden.

    4 In [a copy of] your original batch file, replace the single line
    Code:
    "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe"
    with all 7 lines of the chosen [minimising / hiding] code. Do not add any start / Call or anything else. I've written out everything that is required in those 7 lines.

    Denis
      My Computer


  7. Posts : 30
    Windows 10
    Thread Starter
       #27

    Gotcha - I tried running both the .bat files independently before leaving my previous comment
      My Computer


  8. Posts : 11,654
    Windows 10 Home x64 Version 21H2 Build 19044.1776
       #28

    We have been posting at almost the same time.

    I think "script 2 is just opening the program as normal" means that the best you can achieve is having EZ running minimised to the Taskbar.
    I think "script 1 has it start minimised (the same as the previous set-up)" means that there is no point bothering with any more changes to your original batch file. Just leave the line
    Code:
    "C:\Program Files (x86)\ASUSTOR\EZ Connect\EasyConnect.exe"
    as it is.

    Denis
      My Computer


  9. Posts : 30
    Windows 10
    Thread Starter
       #29

    Ah ok, well thanks for trying anyway, very much appreciate all your help! :)
      My Computer


  10. Posts : 11,654
    Windows 10 Home x64 Version 21H2 Build 19044.1776
       #30

    And, for my part, I found that I had not written a general / sample on-the-fly script so I made some progress as well.

    All the best,
    Denis
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 04:51.
Find Us




Windows 10 Forums