Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Editing filetype - impossible to pass just the filename?

- - - - -

  • Please log in to reply
6 replies to this topic

#1
caps_buster

caps_buster

    Member

  • Member
  • PipPip
  • 117 posts
When adding new filetype to Windows, there it is possible to define the operations with it. I choose usually the "open" operation and choose just the executable it should use and that it is. Fairly simple, huh?

Windows itself add after the full path of the executable file the "%1" variable, witch should pass the full path and filename of the file user clicked on. So far, so good. However a nightmare begin, when this don't work and the application refuse to accept anything EXCEPT the filename. Then it looks like it is IMPOSSIBLE to setup in Windows, because no-one of the variables listed that I found seems to pass the much desired filename only:

%* - replace with all parameters
%~ - replace with all parmaters starting with and following the second parameter
%0 or %1 the first file parameter. For example “C:\Users\Eric\Destop\New Text Document.txt”.
%<n> (where N is 2 - 9), replace with the nth parameter
%s – show command
%h – hotkey value
%i – IDList stored in a shared memory handle is passed here.
%l – long file name form of the first parameter for win32 apps, win16 get short file name. Specifying %L is preferred.
%d – desktop absolute parsing name of the first parameter (for items that don’t have file system paths) (this won't work either)
%v – for verbs that are none implies all, if there is no parameter passed this is the working directory
%w – the working directory
http://superuser.com...ell-command-for
http://networkadmink...ters-class.aspx

I was not managed to find anything usefull. The app in qestion is eDuke32... When starting demo as by shel command: eduke32 -nologo -Ddemo8.dmo
...then everything works just fine. God forbid you expect this works as when you click on the file in windows... :(

Or can it be done?


PS. looked there: http://www.microsoft...t.mspx?mfr=true
...and find things like "%~n1 - Expands %1 to a file name." or "%~nx1" - Expands %1 to a file name and extension." ...however neither "%~n1", "%~nx1", "%1%~n1" or "%1%~nx1" works... That suxx.

Edited by caps_buster, 25 March 2013 - 11:14 AM.

Disclaimer: Any errors in spelling, tact, or fact are transmission errors.


How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,266 posts
  • OS:none specified
  • Country: Country Flag
You can add one or more parameter to the file association command, see:
http://www.la-soluti...ssociations.htm
http://www.vbacceler...ons/article.asp

If this command works for you in a command line:
eduke32 -nologo -Ddemo8.dmo

and you make an association to (say) file type .dmo, you will have in it something like:
"C:\whatever_path\eduke32" -nologo -D"%1"
or
"C:\whatever_path\eduke32" -nologo -D%1
or
"C:\whatever_path\eduke32" -nologo "-D%1"

If it doesn't work, you can use an indirect way, by using cmd.exe (but you will have an open "cmd window") or Nirsoft nicmd.exe (that can be run in "hidden mode") and have them call the eduke32 as if it was done on command line.
http://www.nirsoft.n...ils/nircmd.html

jaclaz

#3
caps_buster

caps_buster

    Member

  • Member
  • PipPip
  • 117 posts
Yep, as you quessed it, neither of the suggested works :(
Using shell it always works, but never using normal windows explorer. And that is the desired effect. Click on demo and make it PLAY. Nothing else. Using shell is kinda... ehm... errr... NO. I did not want to go there. Things should work by clicking and not by typing things, especially when we are supposedly in windows!

Oh, well. Sorry, I looking only for a way to make things work easily, not hard way... :(
Disclaimer: Any errors in spelling, tact, or fact are transmission errors.

#4
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,266 posts
  • OS:none specified
  • Country: Country Flag
Look, the general idea is to solve issue (if possible), not to solve them AND solve them in the way you thing "nice" or "easy" or simply "fancy".

This may be "hard" :unsure: , but works:
Dukem.cmd
@eduke32.exe -nologo -D%~nx1
In file association, "open" command:
"nircmd.exe" exec hide Dukem.cmd "%1"

jaclaz

#5
caps_buster

caps_buster

    Member

  • Member
  • PipPip
  • 117 posts
Well, the nircmd.exe have only 40k, so adding these two small files in the system32 win dir is a good price to pay for easy access to any demo of choice! And it works just great! Purrfect, thanks a lot, mate! :thumbup It is maybe not the most cleanest solution, but sure as hell it WORKS :yes:

Thank you very much, you are a good inspiration for all!



...now what two files to delete in system32 dir to make it even... :ph34r:
Disclaimer: Any errors in spelling, tact, or fact are transmission errors.

#6
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,266 posts
  • OS:none specified
  • Country: Country Flag

It is maybe not the most cleanest solution, but sure as hell it WORKS :yes:

Sure :)
Posted Image

OT, but not much ;), if you ever happen to stab a Marine :w00t:, watch your step! :ph34r:

Spoiler


:angel :lol:

jaclaz

#7
caps_buster

caps_buster

    Member

  • Member
  • PipPip
  • 117 posts
LOL... thanks anyway. Your spoiler is funny. Somehow I did not believe someone could sustain so much injuries for one simple fall :) But looks like we never know :D After all, the wordings "conspiration theoretic" are suggested to be used by CIA, right after public have hard time to swallow "the magic bullet" theory, where one single bullet can do sever different injuries to two men's ;)
One fell = many injuries.
One bullet = many injuries.
Looks like these guys learned well, how to spin what happend... and who can blame them, true. But it is not the truth, not even a tiny fraction of it :)
Disclaimer: Any errors in spelling, tact, or fact are transmission errors.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN