DOpus on U3 -> Making portable apps accessibles from toolbar

I exported my DOpus on USB key with U3.

Everything works fine so far, I was just wondering how I can make toolbars with kind of relative path to access portable apps on the usb key.

The thing is that I can make the user commands and buttons correctly on a computer with the whole path (assigned to the drive letter), but if I connect the key to another pc, the drive letter can change and the buttons wouldn't work.

The first thing that comes to mind would be to assign the USB key with a drive letter W, X, Y or Z as they're not used most of the times. This would work on most computers.

My second idea, for which i would need your help, is it possible to use a script command to go to the root of a drive using its name rather than the drive letter?

Maybe you also have other solutions?

Thanks a lot for your help!

FAQ: Refer to programs on the same drive as portable Opus

I knew I saw a topic dealing about this issue somewhere, but I didn't remembered where.

Thanks leo for the quick answer once again, but still there's some problem about this.

The /home alias would probably work totally fine if DOpus is installed on USB Key without U3 feature.
The bad thing about U3 is that it copies a lot of stuff on the system drive to execute the app (and I guess the usual USB copy doesn't)... so the /home alias points to U3 folder in ApplicationData of the logged user folder.

Hmm, not sure how to solve that. I don't know enough about how U3 works, sorry.

Do U3 provide some kind of tool that can be used to launch apps?

Yeah, there's a launchpad, and it can be modified manually for sure to add these portable apps, but for some utilities, it would be nicer to have some toolbars with the apps in a particular DOpus theme.

Anyways, I'm discovering once again U3, and it doesn't seem to be handy as I would have expected. I also discovered PortableApps platform, and I really think I'm gonna switch to that instead of U3 for various reasons (no CDFS dirve assigned for the system, less files copied on the host computer (i guess), and way more customisable) if it goes in the same direction on U3 while I'm trying some stuff on it.

Anyways, thanks a lot again for your help, it'll be really helpful when i'll switch from U3 to something else :wink:

Alright, I tried without U3, and I guess i'll keep it that way, it seems easier to handle and way more open to anything...

I tried to reply in the topic you gave me the link, but I can't.

So here is what I found:

  • works fine with the 3 different syntaxes in the command line (as DOpus app isn't temporarily copied to system before launching on U3)

  • Commands Icons only accepts one syntax (otherwise the icon isn't displayed):

/home\..\UTILS\HANDY.EXE

Hope this can help, and maybe a little improvement to add to the todo list for DOpus future releases...

Using the /home alias for icon paths doesn't seem very reliable to me (I'm not sure it was envisioned that people would use it, although it's obviously useful).

For me aliases in icon paths do work but only if they point to DLL files. ICO, PNG and EXE files don't work. Is that the same for you?

If it's the same for you I'll file it as a feature request to make it work. Otherwise I'll see if I can work out why it isn't working for me and update the FAQ.

I know it's not the best thing to use, but I don't really want to make a set of icons for these applications. I'm kind of lazy about some issues like that when I think there could be another way to do the same thing (with less efforts?) :wink:

I gave a try to what you told, but it doesn't work for me.
I tried to use the /home alias written this way in icon paths : {alias|home} & {alias|home|}, but both still doesn't work on my comp, even for DLL files.

The only way I can reach the icons is to use this syntax:
/home\ ....
It is not depending on the file type, this works so far with all the files I pointed to, DLL, ICO & EXE. I only didn't try to point PNG file type.

Well, with the searches I made lately on a way to be able to get the drive letter of a usb key through its volume name, I finally found a batch which seems to work perfectly, but it would need to be incorporated into the button directly to work fine on all the computers using win XP...

Here's the link to the page i found the batch, I'll see tomorrow if I can make it work for toolbar buttons correctly, and let know if this works correctly....
http://www.technologyquestions.com/technology/windows-xp/65318-batch-file-convert-volume-name-drive-letter.html

But of course, I don't post the code here as i'm not the writer of this batch

I used part of the script from my previous post to be able to determine the drive letter of my USB key, but still I do encounter some problems.

I used the echo function in my user command to be able to see if the %FLASHDRIVE% is set correctly, and it is.

The problem is when I use %FLASHDRIVE% to launch a command, it keeps telling me the path is not found.

@externalonly 

...

Set FLASHDRIVE=%%I:

Echo My Flashdrive is on drive %FLASHDRIVE%

%FLASHDRIVE%\PortableApps\Outils\EXECUTABLE.exe

I don't understand why it isn't working as %FLASHDRIVE% is correctly defined. Do you have any idea about this?

If you're trying to run that batch file you found by pasting the code directly into an Opus button, that may be why you're having problems. Certain complex batch operations need to be run directly from a batch file for some reason. The batch file you referenced works fine on my machine, I can use it to launch an application on my keyring flash drive just fine.

There are other batch file solutions you can use as well, such as the one following my message here. But all of them that I've tested must be run from an external batch file, and not with the code posted into an Opus button (even when it's set to MS-DOS Batch Function).

[code]@echo off
set VOLNAME=keyring

for /F %%a in ('mountvol /? ^| find ":"') do call :Sub %%a
goto :eof

:Sub
set X=%1
vol %X:~0,-1% 2>NUL|find /i "%VOLNAME%" 1>NUL && echo %VOLNAME% is on drive %X% && pause
goto:EOF[/code]

Have a look in your /temp directory. Opus creates batch files in there before running them, for MS-DOS type buttons. If you sort by date and find the latest temp batch files then you can see exactly what's being run and it'll probably make it obvious what the difference is.

It could be that you need to escape or double-up the % symbols in some places, for example, so that the variables are resolved at the right time.

(BTW, Opus automatically cleans up those temp files, don't worry.)

Leo I just inserted a pause into the button code so my MS-DOS Batch function type command is:

[code]@echo off
pause
set VOLNAME=keyring

for /F %%a in ('mountvol /? ^| find ":"') do call :Sub %%a
goto :eof

:Sub
set X=%1
vol %X:~0,-1% 2>NUL|find /i "%VOLNAME%" 1>NUL && echo %VOLNAME% is on drive %X% && pause
goto:EOF[/code]

But when I look at the temp batch file Opus creates while that pause is in effect, this is all there is:

@echo off chcp 1252 > nul C: cd "\TEMP" pause

Even if I delete everything after the

set VOLNAME=keyring

line the above is all that's in the temp batch file.

John: Try adding @externalonly to the top of the button.

Without that I think your set lines are invoking the Opus set command, not the intended MS-DOS set command.

(Looks like that was already in GoinPostal's button so it isn't that which was causing the original problem. My hunch is if you look at the batch files the % chars will be wrong.)

That did solve that problem Leo, thanks for that (and I should have known that myself!) :blush:

Thanks for the new batch John, it could be nicer than the one I have since it doesn't use temporary files.
In fact, I didn't used the code as it is, I changed some little things to be more the way I need it, but this doesn't really matters.
Also, I didn't used this code directly into a button, but as a user command, so I can call the script in any button I want without pasting all the code.

In fact, I don't have any problem with the script itself, as it works both as a batch or directly into DOpus, but to let you know what the purpose is, I can't afford to run this batch as a separate file because it would defeat the whole purpose of it. To explain some more, I would like to be able to have these toolbar buttons working both for my DOpus install on USB key, but also working on my home computer with the normal DOpus install when the USB key is inserted; that's also why I can't use the /home alias for that as it wouldn't work to find the path of the usb key when running from my home computer DOpus.

Alright, so leo, you guessed right!
The problem I have is that when trying to launch the command, the var is written this way: %%FLASHDRIVE%%.

I tried to escape the % chars with , but it still doesn't work.

I thought it was because I did that in a path, so I tried to use a @set command to define the volume name and escape the characters there, but nothing changes.

I may be a burden on that one, but I really don't see what to do to remove those double %....

PS: a little question on the @nofilenamequoting.... part of the problem was also that DOpus inserted quotes for the command launch, but the ending quote was not at the right place (I used a dlgchoose to be able to put various options), and the ending quote is put at the end of the options. I resolved this problem by putting the quotes myself on the command, but i also tried to use that @nofilenamequoting modifier, but it didn't changed anything. Is that the modifier only works for arguments and not the command itself?

Looking at your batch file from earlier:

[code]@externalonly

...

Set FLASHDRIVE=%%I:

Echo My Flashdrive is on drive %FLASHDRIVE%

%FLASHDRIVE%\PortableApps\Outils\EXECUTABLE.exe[/code]

What's being run is this:

%%I\PortableApps\Outils\EXECUTABLE.exe

But that makes sense because you set FLASHDRIVE to "%%I:" at the start.

The "%%I" stuff in the original batch file only makes sense if it's used in the context of the For command, as in the original:

For /F " tokens=3 " %%I in (VOLLIST.TXT) do SET FLASHDRIVE=%%I:

Inside the For command %%I is a variable called 'I' but outside of it it turns into a literal string, "%%I".

(The DOS batch language, and the For command and %-escaping in particular, are quite confusing IMO.)

BTW, the original script uses DiskPart.exe to get a list of disk labels. That will cause problems on systems which use UAC, and for standard users, since DiskPart.exe requires admin rights. When I run the batch file it triggers a UAC prompt.

I'll see if I can come up with a VBScript which does what you want. The info should be available via the WMI objects... Will reply in a bit.

I wrote a VBScript you can use to do this:

pretentiousname.com/miscsoft ... chViaLabel

LaunchViaLabel.vbs "NameOfYourDrive" __DRIVE__\PortableApps\Outils\Executable.exe

Thanks leo!

The script works fine.

I just have another question. Is it possible to put that script as a user command using the modifier @script vbscript?

I tried that but on the console, it keeps telling me that WScript isn't defined for that line:
Set Args = WScript.Arguments

I watched on the forum to see if I could get some informations, but I didn't found anything yet about this particular problem.

My last question is just to try understand a little more how does vbscript can be implemented in DOpus.

I can easily find a workaround if I need to use this vbscript as an external file.
I can put the script in the DOpus install folder for both my home computer and USB key and call it via /home alias for the path!