You are here

Command line options for PortableAppsPlatform.exe

8 posts / 0 new
Last post
raidscsi
Offline
Last seen: 11 years 6 days ago
Joined: 2013-03-21 13:18
Command line options for PortableAppsPlatform.exe

I would like to be able to use a command line option to close/ kill the PortableAppsPlatform.exe automatically.

I found through a search that PortableAppsPlatform.exe uses a third party eject tool "PortableApps\PortableApps.com\App\Bin\eject.exe", but found nothing regarding the close but not eject button.

Any thoughts.

PortableAppsPlatform.exe /q /quit /exit /close .... something along those lines.

John T. Haller
John T. Haller's picture
Online
Last seen: 5 min 12 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Unplanned

We don't plan on offering the functionality as the PA.c Platform is supposed to be used by the user, not scripted by a 3rd party utility.

Sometimes, the impossible can become possible, if you're awesome!

raidscsi
Offline
Last seen: 11 years 6 days ago
Joined: 2013-03-21 13:18
Thanks for the quick

Thanks for the quick reply.

Since closing the PortableAppsPlatform.exe using the X doesn't close the apps opened from the drive or do a safe dismount, is there any harm in killing it?

The reason I ask is I keep my PortableApps install on a TrueCrypt volume...on the flash drive. I insert the drive, run my batch(which I have also converted to exe), enter my TrueCrypt password, and PortableApps starts automatically.

Closing is the hassle, close all apps, close PortableAppsPlatform.exe, dismount TrueCrypt volume, and eject drive. I would like to script the last 3 steps. All I really need is the easiest way to kill PortableAppsPlatform.exe, assuming its safe. Attached are the scripts I use to start and shutdown.

Startup Script

:top

if exist "z:\PortableApps\PortableApps.com\PortableAppsPlatform.exe" goto runapp

start /b TrueCrypt\truecrypt.exe /v DATA.VOL /l z /q background

goto wait

:wait
if exist "z:\PortableApps\PortableApps.com\PortableAppsPlatform.exe" goto runapp
sleep.exe 2
goto :wait

:runapp

start /b z:\PortableApps\PortableApps.com\PortableAppsPlatform.exe
quit

Shutdown Script, after manually closing apps and PortableAppsPlatform.exe

start /b TrueCrypt\truecrypt.exe /quit /dz
sleep.exe 3
start eject.exe /REMOVETHIS

raidscsi
Offline
Last seen: 11 years 6 days ago
Joined: 2013-03-21 13:18
Why Encrypt It All

Reason for the encryption?, I use KeePass(its DB is encrypted, but I am paranoid...), Thunderbird and Filezilla do not keep their usernames/passwords secret, Firefox also does not encrypt saved passwords.

Not to mention Teamviewer or any other apps I have I wouldn't want someone on the street to just get access to.

Yes, I could disable all the automatic saved passwords, but that's annoying to me when I can protect it all with a single master password on the TrueCrypt Volume. Not to mention FileZilla is useless without saved FTP sites, and Thunderbird shows the last session(current inbox contents) regardless of password or email settings.

Root of my drive has my contact info, TrueCrypt and TrueCrypt Volume, and my mount/dismount utilities.

raidscsi
Offline
Last seen: 11 years 6 days ago
Joined: 2013-03-21 13:18
No thoughts on this? taskkill

No thoughts on this?

taskkill /F /IM PortableAppsPlatform.exe /T

/F forces,
/IM specifies the image name
/T kills all child processes.

This sucessfully kills firefox, thunderbird and a few other Portable Apps that I tested. Doesn't allow apps to save on close, so something may be lost, so for now I will still close my apps manually before executing the exit script.

Tixue
Offline
Last seen: 4 months 3 weeks ago
Joined: 2009-04-04 14:10
Don't use /F, still unsafe, maybe something like will be added?

Killing the tree is a really bad idea as as far as the programs are concerned it's no different from just unplugging the computer from the wall, they don't get to save any settings or stop using whatever file they may be writing to, etc. so you not only end up with junk getting left behind, but you also can easily corrupt data.
Leave off the /F and it becomes slightly less dangerous (programs will get the chance to finish writing files they might have open and they can give you a chance to save your work if you have unsaved changes in a document or something) however I don't think any of the PortableApps.com Launchers understand the command that it will send just yet, so you'll probably still have your PortableApps' stuff get left behind anyway.

For now just shut each program down manually first (like you said you do), something may be done about this in the future, IDK.

Rijul Ahuja
Offline
Last seen: 10 years 11 months ago
Joined: 2013-03-30 13:09
I use AutoHotkey for this

Install Autohotkey. It's a great scripting language.
Create a script with the following contents, compile it and set it to autostart with the portableapps.com menu.
Press Control+Alt+X to close the menu anytime.

#NoTrayIcon ;Hide the tray icon
#NoEnv
; Control+alt+x closes the menu
^!x::
DetectHiddenWindows, On
ControlClick, Close, ahk_class TfrmMenu
return

or you can just type the following in a script, compile it and have it called by your batch file at the time of exit (i think that's batch, not sure)

#NoTrayIcon
#NoEnv
DetectHiddenWindows, On
ControlClick, Close, ahk_class TfrmMenu
ExitApp ;exit the script

page2pagepro
Offline
Last seen: 9 months 2 weeks ago
Joined: 2012-05-24 17:01
PortableApps AutoIt Mount+Start and UMount+Stop Scripts

This thread got me thinking...

Not only does the TrueCrypt container keep non-Keypass items secure, but for me I was searching for a syncing solution.

If you are like me, you keep dozens of apps on a thumb drive, many which are from Linux design utilizing hundreds if not thousands of "micro" files (files sub 4k). If you are familiar with read/write speeds of EVERY storage medium (SSD, HDD, USB, SDHC, etc.) you will know what I mean.

Examples:

  • UltraStarDeluxe= 2,000+ files
  • Uniserver = 2,000+ files
  • Inkscape = 2,600+ files
  • Gimp = 3,000+ files
  • AutoIt = 3,000+ files
  • Eclipse = 3,000+ files
  • "R" Language = 3,000+ files
  • DevCPP = 3,000+ files
  • Python = 4,000+ files
  • OpenOffice = 4,000+ files
  • Cygwin = 6,000+ files
  • CodeBlocks = 20,000+ files

So for twelve (12) apps, there are 60k objects yet barely 4GB. To transfer this 4GB data from a decent USB 2.0 Drive to computer can take over ten minutes (more if writing TO the USB drive).

Yet my entire collection of portable apps being housed in a 14.5GB container can we written from PC to USB within 8 minutes.

Incidentally I upgraded from my beloved 16GB Patriot Rage XT to Sandisk 64GB Extreme (3.0) and despite feeling cheap, performance is significantly enhanced.

Also, a concept I'd like to share is how I am able to use Sardu (with GParted, Backtrack5, F4UBCD, WinXP Installer, Win7 Installer, and others) which is not compatible with NTFS, while also allowing for a TrueCrypt container over the FAT32 4.0GB limitation.

  1. Partition USB 50/50 with Bootice.exe
  2. Install Sardu on 1st bootable partition
  3. Use either Hitachi MicroDrive driver (cfadisk.sys) or Soviet Direct Hooking (dummy.sys) link
  4. Setup 2nd Partition like so:
    1. /autorun.inf
    2. /bin/
    3. /bin/source/PortableAppsMountStart.au3
    4. /bin/source/PortableAppsUMountStop.au3
    5. /bin/TrueCrypt/
    6. /bin/USBTools/
    7. /bin/USBTools/BootIce.exe
    8. /bin/USBTools/HookingDrivers
    9. /bin/PortableAppsMountStart.exe
    10. /bin/PortableAppsUMountStop.exe
    11. /bin/YourTrueCryptFileName.tc

Below are my source-codes for AutoIt (Feel free to use/modify and share your results!):

PortableAppsMountStart.au3

#NoTrayIcon
#AutoIt3Wrapper_Icon=gnome_system_run.ico
#AutoIt3Wrapper_Res_Fileversion=1.2.6.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2013 Page2PagePro.com
#AutoIt3Wrapper_Res_Language=1033

#include "GuiConstants.au3"
#include "GuiConstantsEx.au3"
#include "WindowsConstants.au3"
#include "StaticConstants.au3"
#include "Constants.au3"
#include "WinAPI.au3"
#include "String.au3"
#include "Array.au3"

Opt('MustDeclareVars', 1)

Run ("TrueCrypt\truecrypt.exe /v SysVol /l p /q background /p ""xxxxxx""")
While Not FileExists("P:\PortableApps\PortableApps.com\PortableAppsPlatform.exe")
	Sleep(1000)
WEnd
Run("P:\PortableApps\PortableApps.com\PortableAppsPlatform.exe")

PS: If you want to be prompted for your TrueCrypt password, exclude the /p "xxxxxx" section

PortableAppsUMountStop.au3

#NoTrayIcon
#AutoIt3Wrapper_Icon=gnome_system_run.ico
#AutoIt3Wrapper_Res_Fileversion=1.2.6.0
#AutoIt3Wrapper_Res_LegalCopyright=Copyright © 2013 Page2PagePro.com
#AutoIt3Wrapper_Res_Language=1033

#include "GuiConstants.au3"
#include "GuiConstantsEx.au3"
#include "WindowsConstants.au3"
#include "StaticConstants.au3"
#include "Constants.au3"
#include "WinAPI.au3"
#include "String.au3"
#include "Array.au3"

Opt('MustDeclareVars', 1)

; Close One or Multiple Portable Apps Instances
ClosePortableAppsInteractive()

; Unmount TrueCrypt Partition
UnmountTrueCrypt("P")

Exit

; ---------------------------------------------------------------------------

Func ClosePortableAppsInteractive()
	Local $hHandles, $hHandle, $sReturn, $sPath
	Const $sTitlePart = "PortableApps.com Platform"
	$hHandles = WinList("[CLASS:TfrmMenu]")
	For $i = 1 To $hHandles[0][0]
		If StringInStr($hHandles[$i][0], $sTitlePart , 1, 1, 1) Then
			If $hHandles[0][0] = 1 Then
				$hHandle = ControlGetHandle($hHandles[$i][1], "", "[CLASS:TButton; TEXT:Close]")
;~ 				MsgBox(64, "Handle for this Close button.", $hHandle)
				ControlClick($hHandle, "", "")
				ExitLoop
			EndIf

			; Do Dialog Questions Since more than one instance found
			$sPath = StringReplace($hHandles[$i][0],$sTitlePart & " - ", "")
			$sReturn = MsgBox(48 + 4, "Do you want to Close this Portable Apps Instance?", $sPath)

			If $sReturn = 6 Then
				$hHandle = ControlGetHandle($hHandles[$i][1], "", "[CLASS:TButton; TEXT:Close]")
;~ 				MsgBox(64, "Handle for this Close button.", $hHandle)
				ControlClick($hHandle, "", "")
			EndIf
		EndIf
	Next
EndFunc   ;==>ClosePortableAppsInteractive

Func UnmountTrueCrypt($sLetter)
	If StringLen($sLetter)  1 Then
		MsgBox(64,"Error!", "Drive Letter needs to be only ONE (1) character long!")
		Exit
	EndIf

	$sLetter = StringUpper($sLetter)
	If Not StringRegExp($sLetter, "^[A-Z]+$") Then
		MsgBox(64,"Error!", "Drive letter (" & $sLetter & ") must be A-Z only!")
		Exit
	EndIf

	If Not FileExists($sLetter & ":\") Then
		MsgBox(64,"Error!", "Drive letter (" & $sLetter & ") does NOT exist!")
		Exit
	EndIf

;~ 	MsgBox(64,"","Found Drive!")
	Run ("TrueCrypt\truecrypt.exe /q /d " & $sLetter)
EndFunc

You may notice that I use "P" as my portableApps Drive letter - that is because MOST corporate environments tend to map X,Y,Z etc.

Thank you for reading!
-Page2PagePro

Log in or register to post comments