Launching different programs depending on pc

Discuss anything related to portable freeware here.
Post Reply
Message
Author
guilhermebf
Posts: 6
Joined: Wed Mar 12, 2008 7:08 pm

Launching different programs depending on pc

#1 Post by guilhermebf »

Hi all,

I really like PStart, but i'd like to choose what programs i will launch depending on pc (hostname for ex.). The Toucan (file sync program) does a similar thing...

Anybody knows another program launcher that have this option?

Any ideas?

Thanks,

User avatar
Zach Thibeau
Posts: 251
Joined: Tue Nov 28, 2006 3:26 pm
Contact:

You could always try...

#2 Post by Zach Thibeau »

ASuite should be able to do that if I remember correctly and the interface is much like PStart and will import Pstart settings too ;)

guilhermebf
Posts: 6
Joined: Wed Mar 12, 2008 7:08 pm

Where in asuite i can find this?

#3 Post by guilhermebf »

Hi thibeaz, thanks for the response.

I think Asuite doesnt have this option or i cant find it. :?

Gawran
Posts: 6
Joined: Wed Sep 05, 2007 1:09 am

#4 Post by Gawran »

I don't know what do you need this for, but what about writing a batch script that chooses which program to run based on computer name. Something like this:

LAUNCH.BAT

Code: Select all

if [%COMPUTERNAME%] == [HOMECOMP] goto run_home
if [%COMPUTERNAME%] == [WORKCOMP] goto run_work
goto :eof

:run_home
:: starts application(s) for home computer
start %windir%\notepad.exe
goto :eof

:run_work
:: starts application(s) for work computer
start %windir%\calc.exe
goto :eof
You have to use "start application.exe", because otherwise you're stuck with command prompt box until you close that application. Also, you can run multiple applications from single batch file.

So, you keep using pstart, but instead of linking shortcut to you app(s), you link it to this batch file. You can use relative paths (e.g. "..\notepad++\notepad++.exe"), but have to set home dir (in shortcut properties) to location of launch.bat

Hope this helps!

guilhermebf
Posts: 6
Joined: Wed Mar 12, 2008 7:08 pm

#5 Post by guilhermebf »

Hi Gawran,

I'm using this solution since it's the best until now. But I don't like it. Supose I want to launch the same program on three (and only on these) computers. I will have to add the path three times in the batch file.

Tell the program in what pcs it has to be lauched it's easier than do the reverse. It's my opinion...

But thanks anyway! :D

Gawran
Posts: 6
Joined: Wed Sep 05, 2007 1:09 am

#6 Post by Gawran »

Why not write something like this:

Code: Select all

if [%COMPUTERNAME%] == [COMP1] goto run
if [%COMPUTERNAME%] == [COMP2] goto run
if [%COMPUTERNAME%] == [COMP3] goto run
goto :eof

:run
start %windir%\notepad.exe
goto :eof 
Then the same code is run for all three computers (COMP1, COMP2, COMP3), and it's skipped for all other computers.

BTW, if program you launch decides about running itself, you have to run it anyway, and than the program closes itself in case it's run on a wrong computer (if I got you right), which is a waste of time. This approach is I think much faster and more flexible, and you can use it for any list of commands you wish.
Last edited by Gawran on Fri Mar 14, 2008 5:49 am, edited 1 time in total.

guilhermebf
Posts: 6
Joined: Wed Mar 12, 2008 7:08 pm

#7 Post by guilhermebf »

Hummm, looks better!

I will try for sometime...

Thanks!

User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

#8 Post by Local »

I don't really understand what is wanted here.
Are your programs set to run on insertion of the usb?

That's the only reason I could think that this would be a problem.
If not Qsel has the option of running different configurations by running from different directories

I'd probably set up a small autorun launcher like popsel with the options for three configurations.

Home = .\Qsel\Qsel.exe
Directory .\Qsel\Home

Work = .\Qsel\Qsel.exe
Directory .\Qsel\Work

Then you can specify which programs will be in the launcher on each PC with the click of a button

guilhermebf
Posts: 6
Joined: Wed Mar 12, 2008 7:08 pm

#9 Post by guilhermebf »

Local,

I think we're not talking the same problem.
PStart has a autorun function. That is, call some programs that you choose when PStart starts. What I want is call different programs depending on the pc I'm starting PStart.

It's obvious that PStart, in that case, will be running on an usb drive.

Qsel has something like this?

Thanks,

User avatar
Local
Posts: 238
Joined: Fri Aug 03, 2007 3:48 am

#10 Post by Local »

Ahh, as I said this idea would be useless if atorun was needed.

Can you not, though, use a launcher as I mentioned but to start pstart with different profiles?
The worst case scenario has three different Pstart apps on your pen drive the best, three configurations launched by switches.

Basically all you would gain over the bat file is no cmd boxes on screen

User avatar
Cornflower
Posts: 244
Joined: Fri Aug 31, 2007 7:58 am
Location: Canada's capital

#11 Post by Cornflower »

I found a workaround.
I keep pstart.xml for my USB-only commands, that don't need changing from computer to computer.

I create a %COMPUTERNAME%.xml file for each of my computers, containing computer-specific specs. I choose a different colour icon for each

I wrote a 2-line batch file
auto.bat
PStart :: to start pstart.xml
PStart %COMPUTERNAME% :: for the specific ones

and altered the autorun.inf file
open=auto.bat


Now I get two system tray PStart icons, but it is clear to me which is which, and I get computer-specific settings.

Previously I would add two entries for each of those, but this problem has spurred it on for me. Thanks.

User avatar
lococobra
Posts: 127
Joined: Fri Aug 03, 2007 10:42 am
Location: USA
Contact:

#12 Post by lococobra »

What about writing an autoit script? It's pretty much built for this kind of thing and it can be compiled to a stand-alone portable EXE.

For some examples of how you'd do it...

Code: Select all

#NoTrayIcon ;Just for aesthetics...
#include <Array.au3>
Dim $homeComps[2]
$homeComps[0] = "HomeComputer" ;Some computer names to test for
$homeComps[1] = "2ndHomeComputer"

Dim $schoolComps[2]
$schoolComps[0] = "schoolComputer" ;Some computer names to test for
$schoolComps[1] = "other school computer"

$detectSchool = "someidentifier" ;If all the computers at your school begin with "Lincoln High" or something

$thisComp = @ComputerName ;Find the current computers name

if StringRegExp($thisComp, $detectSchool) then
   run("filename") ;Run a program
   run("filename", "", @SW_HIDE) ;Run a program hidden
   exit ;If we've met this condition... probably a good idea to stop execution
endif

For $testComp In $homeComps
   if $testComp = $thisComp then
      run ;see above...
   endif
Next

For $testComp In $schoolComps
   if $testComp = $thisComp then
      run ;see above...
   endif
Next
You probably get the idea...

User avatar
Devils Advocate
Posts: 14
Joined: Wed Jul 25, 2007 1:23 am
Location: Perth, Australia

#13 Post by Devils Advocate »

Hi guilhermebf

For the first time in nearly 20 years I've written a program in AutoIt for a purpose very similar to your own. On launching the program (as it's written at the moment) lets you choose your 'location' ie home or office etc. It then brings up a checklist of programs on my portable drive which can chosen and then be run. Each location menu has its own list which can be added or deleted to.

If you drop me a line, I'll flick the program & source code across. It's not the prettiest program in the world, but is exactly what I needed and may be of use to yourself. I'm happy to alter the program to suit your needs if its of assistance or you can adapt it to suit your exact purposes.


[/img]

guilhermebf
Posts: 6
Joined: Wed Mar 12, 2008 7:08 pm

#14 Post by guilhermebf »

Hi,

I have no idea what Autoit is until lococobra talks about it. So, now I'm planning write my own launch program with all I really want.

Please, send me your program! I think it will really help me...

Thanks,

User avatar
Devils Advocate
Posts: 14
Joined: Wed Jul 25, 2007 1:23 am
Location: Perth, Australia

#15 Post by Devils Advocate »

No problem - I just need your email address. Send me a PM with your email & I'll get it back to you.

The program uses relative paths so any change in drive letter is accomodated.

Post Reply