Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

"Run with switches"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • "Run with switches"

    I've got JellyFishPro in front of me. To my right is another monitor with my file manager opened at the developed ( so far ) exe's folder because I may be messing with ini, dat or whatever files. The exe is looking at me. It uses switches. I right click on the exe and navigate to 'Run with switches' in the context menu. After clicking on that up pops a PB InputBox, I write the switches and click OK. Job done.

    XP Pro SP3; PB9; WIN32API.INC, Last Update: 1 August 2008 [Should work with PB8 & PB7]

    This is RunSwitch.exe.

    Code:
    #Compile Exe "RunSwitch"
    #Dim All
     
    %MB_OK           = &H00000000&
    %MB_ICONQUESTION = &H00000020&
     
    Function PBMain( ) As Long
      Local sExtension, sSwitch, sTitle As String, dummy As Long
     
      sExtension = Right$( LCase$( Command$ ), 3 )
     
      If sExtension <> "exe" Then
        MsgBox sExtension + "?" + " I'd prefer an exe <smile>", %MB_OK + %MB_ICONQUESTION, "RunSwitch"
        Exit Function
      End If
     
      sTitle = Parse$( Command$, "\",  ParseCount( Command$, "\") )
      sSwitch = InputBox$( "Please provide switches" + $CrLf + $CrLf + "Give me nothing and I'll do nothing <smile>", sTitle )
     
      If Len( sSwitch ) = 0 Then Exit Function
     
      dummy = Shell( Command$ + " " + sSwitch )
     
    End Function
    We need some registry entries.

    -----------------------------------------------------------------------
    REGEDIT4

    [HKEY_CLASSES_ROOT\*\shell\RunSwitch]
    @="Run with switches"

    ; Edit the following @= line to reflect your location of RunSwitch.exe
    ; Don't forget to use \\ and not \

    [HKEY_CLASSES_ROOT\*\shell\RunSwitch\command]
    @="C:\\Program Files\\RunSwitch\\RunSwitch.exe %L"
    ; dummy line to make sure that a line is here <smile>
    -----------------------------------------------------------------------

    If you want to undo the registry script then use this
    ---------------------------------------
    REGEDIT4

    [-HKEY_CLASSES_ROOT\*\shell\RunSwitch]
    ; dummy line to make sure that a line is here <smile>
    ---------------------------------------
    Last edited by David Roberts; 11 Dec 2008, 10:42 PM. Reason: Win32AP.inc date

  • #2
    I now have JK - IDE in front of me.

    The above was first used on Windows XP. It was then used with Windows 7. Now it is being used with Windows 10.

    REGEDIT4 is still OK - we are not using Unicode.

    PB's InputBox$ is not a pretty sight so I am now using José Roca's version and I have themed it as well. You may not have José's include files on board so attached is a zip which unzips to RunSwitch.exe.

    This is what it looks like on right clicking SomeApp.exe and choosing 'Run with switches' from the context menu.
    Click image for larger version

Name:	RwithS.jpg
Views:	53
Size:	12.6 KB
ID:	751214

    Added: We are limited to 500 characters - should be enough.
    Attached Files
    Last edited by David Roberts; 24 Jul 2016, 03:14 PM.

    Comment

    Working...
    X