topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 6:11 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: change "start in directory" plus command-line arg?  (Read 4120 times)

ottenm

  • Supporting Member
  • Joined in 2008
  • **
  • default avatar
  • Posts: 93
    • View Profile
    • Donate to Member
change "start in directory" plus command-line arg?
« on: February 21, 2008, 06:12 PM »
Basically, I'm trying to launch an executable that takes two command-line arguments, but the executable is in one location, and I need it to run with the current directory (or "Start In" directory) pointing to a different location.  The first command-line argument never changes, the second is passed through from the user/FARR.

In concrete terms, it's a Java Phone Book app that takes a command-line argument (the name or number of the person to lookup).  So it launches like this:
pathA\javaw.exe arg1 arg2
Where arg1 is the name of my app and arg2 is the Name/PhoneNumber I'm searching for.  Trying to follow the 'wiki' and 'maps' examples, I've got the "Results" section of the "Edit Group Alias" dailog set as shown, but with 2 problems:
C:\Program Files\Java\j2sdk1.4.2_01\bin\javaw MyApp $$1

First problem is setting the directory it actually runs from.  Any ideas?  (and if you know Java, it's not enough to just add to the classpath.  The app actually uses the directory it's launched from).  I've tried making a batch file, but I'd rather not open a cmd window and then the Java GUI, too.  I've also made a .lnk shortcut that launches ok, but I can't figure out how to get arg2 passed in from the command line.

Second problem is me not understanding the $$1 parameter.  I have this Alias named "phone".  As I start typing it into FARR, everything starts as expected and I see "phone" up at the top of the list coming from myaliases.alias.  All good until I get to the "e" in phone.  Right then, the drop-down list changes to a smaller font and maybe 20 results instead of 9.  By the time I've typed "phone mike", the list has filtered down to no entries and won't launch anything (much less launch my app with "mike" as an arg).

Thanks for any help, and apologies for my density.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: change "start in directory" plus command-line arg?
« Reply #1 on: February 21, 2008, 06:26 PM »
currently you cant explicitly tell farr which directory to set as working directory from an alias, but i could add that.  having said that, i THOUGHT that farr already tries to set the directory to the app directory when it launches it, but i could be wrong.

did you set the regular expression field for your alias? if not then it wont expect you to type anything after phone, and when you do it will invalidate it.

so you should have for your regular expression something like: ^phone (.*)

(note that you cant pass an argument to a .lnk shortcut so youll have to put an exe in your alias results).

ottenm

  • Supporting Member
  • Joined in 2008
  • **
  • default avatar
  • Posts: 93
    • View Profile
    • Donate to Member
Re: change "start in directory" plus command-line arg?
« Reply #2 on: February 21, 2008, 09:00 PM »
Perfect!  Just needed to set the regular expression field for the alias.  And I copied javaw.exe to the directory I needed (my bad for not trying that in the first place, I never thought it would run with all the other Java binaries back in the install  directory).

Solved!

Also, at least in this case, farr definitely sets the working directory to the one I'm running the exe in.

Thanks for the complete reply, and the confirmation about not passing args to .lnk's.