Jump to content

Run a script in two modes


Recommended Posts

SCENARIO

I have a script compiled to EXE, which runs in two modes as determined by a commandline parameter:

;   Mode1
;       BiModal.exe -mode_1 <filename>
;
;   Mode2
;       BiModal.exe -mode_2 <filename>
;

    $sX = "$CmdLine[0]=" & $CmdLine[0] & @LF
    for $nX = 1 to $CmdLine[0]
        $sX = $sX & "$CmdLine[" & $nX & "]=" & $CmdLine[$nX] & @LF
    next 
    msgbox (0,"",$sX)
    
exit

REQUIREMENTS

I want to have a separate shortcut for each mode, so that I can drag a file onto either shortcut depending on what I want to do with the file.

PROBLEM

I can't seem to setup a shortcut that will properly pass both the mode and the dragged filename to the script! :(

The following values for the Target setting all just pass the filename, and the mode gets lost:

  • "BiModal.exe" -mode_1
  • "BiModal.exe" -mode_1 %1
  • "BiModal.exe" "-mode_1" "%1"
:ph34r: Any ideas?

Edit: symantics, so as not confuse American cousins :lol:

Edited by trids
Link to comment
Share on other sites

Thanks ezzetabi :( .. I think that's what I'm trying to do with the script I posted - unless I misunderstand you? Do you have any sample code?

For the record, I don't think the the problem/solution lies in AU3 itself, but rather in how I'm building the shortcut :ph34r: .

Link to comment
Share on other sites

"BiModal.exe" -mode_1 works here [Windows XP Pro]

Do I understand that you want to drag a shortcut onto a shortcut and get the command line of the shortcut dragged?

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

"BiModal.exe" -mode_1 works here [Windows XP Pro]

Do I understand that you want to drag a shortcut onto a shortcut and get the command line of the shortcut dragged?

Hmmm .. maybe it's an NT thing then :( (I'm on NT4 SP6 )

What I want to do is drag a file onto either shortcut, in a way that the script knows what the file was, and also onto which shortcut the file was dropped (ie: which mode it must run in).

This seems like such a powerful fundamental feature, is it possible it was overlooked when they built NT4? Or am I missing something obvious? Anyone else having any success / failure? :ph34r:

Link to comment
Share on other sites

Here's a workaround which replaces the shortcuts with BAT files instead. The following BAT file will launch the EXE with commandline parameter -mode_1 .. AND pass the dropped filename too :( :

REM    This BAT file provides a drop-target for an EXE that 
REM    accepts commandline parameters as well as a filename.

    BiModal.exe -mode_1 %1

I know one should expect compromises with workarounds, but I really don't like it opening up a DOS window all the time :ph34r: .. so if anyone has any other ideas, I'm all ears!

BTW .. am I right in understanding from the post above, by this-is-me, that a shortcut in XP will pass both the commandline parameter as well as the name of a file dropped onto it? If this is the case, can some kind XP user please post the shortcut that allows this to happen?

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...