mIRC Home    About    Download    Register    News    Help

Print Thread
#7815 22/01/03 02:16 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
Is there a way to get mirc to create a shortcut? Or does mirc only copy files??

Thanks for any replies! smile

#7816 22/01/03 02:48 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Shortcut - you mean a LNK file? well, that needs some look at microsoft references (if any :tongue:), but at the meanwhile you'd want to create a batch file:

/write notepad-shortcut.bat notepad.exe

and /run notepad-shortcut.bat to launch it...

Batch file guide

If I get an idea on how to create LNK files, I'll post here.

#7817 22/01/03 08:21 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Finally. Well, it mustn't work correctly, as it's too much for my mind. Apologizes for any error...
Code:
[color:green];
; /shortcut <path\shortcut name> <path\program file> [path\icon [index]]
;[/color]
alias shortcut {
  [color:green];
  ; This regular expression is for reordering quoted parameters
  ; in the $N identifiers.
  ;[/color]
  if $regsub($1-,/("[^"]+"|\S+)\s?/g,\1 $+ $lf,%a) {
    tokenize 10 %a 
    unset %a
  }
  [color:green];
  ; Creation of an INF file that contains the shortcut info
  ;[/color]
  var %shortName = $+("",$nopath($1),"")
  var %shortPath = $nofile($shortfn($1))
  var %shortDesc = $+(",$nopath($2),")
  var %progFullName = $+(",$2,")
  if !$regex($2,^\S+://) {
    [color:green];
    ; Set working path only if it's not a URL...
    ;[/color]
    var %progPath = $nofile($gettok($shortfn($2),1,32))
  }
  window -h @sc
  var %c = aline @sc
  %c [version]
  %c signature="$chicago$"
  %c [DefaultInstall]
  %c UpdateInis=Addlink
  %c [Addlink]
  %c setup.ini, progman.groups,, "group1= $+ %shortPath $+ "
  %c setup.ini, group1,," $+ %shortName $+ , $+ %progFullName $+ , $+ $&
    $3 $+ , $+ $4 $+ ,, $+ %progPath $+ , $+ %shortDesc $+ "
  savebuf @sc sc.inf
  window -c @sc
  [color:green];
  ; Installation...
  ; [/color]
  run rundll setupx.dll,InstallHinfSection DefaultInstall 132 $mircdirsc.inf
  [color:green];
  ; And removal of the INF file after reasonable delay.
  ;[/color]
  .timersc 1 5 .remove sc.inf
}

Worked examples:

//shortcut $+(",$mircdirOpen Notepad") c:\windows\notepad.exe
//shortcut $+(",$mircdirmircscripts.org") http://www.mircscripts.org/ $+(",$mircexe,") 0
//shortcut $+(",$mircdirmIRC link") $+(",$mircexe,")

- Tested on win98se, mIRC 6.03.

Reference

#7818 23/01/03 05:59 AM
Joined: Dec 2002
Posts: 56
G
Babel fish
Offline
Babel fish
G
Joined: Dec 2002
Posts: 56
What is a 'Worked example'? Ive seen that phrase only on scripting websites...

#7819 23/01/03 09:27 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Something that works...

#7820 23/01/03 01:02 PM
Joined: Dec 2002
Posts: 143
A
Vogon poet
Offline
Vogon poet
A
Joined: Dec 2002
Posts: 143
a "Worked Example" is an example of how something works that you can follow, usually step-by-step!

(me thinks!)


Aubs.
cool

#7821 23/01/03 10:55 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Yea, Aubs, I think you're right.

Just s short detail on the /shortcut commad: if the /run line fails to execute, due to missing setupx.dll, replace it by the (recommended) command:
Code:
run rundll32.exe setupapi,InstallHinfSection DefaultInstall 132 $mircdirsc.inf

Or... use Necroman's nLINKn.dll (damn me, if I knew about its existence I wouldn't bother creating the /shortcut command, but it's always nice to work without dlls... thanks qwerty smile).


Link Copied to Clipboard