Open an exe (compiled .pb) with the right path ...

Everything else that doesn't fall into one of the other PB categories.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Open an exe (compiled .pb) with the right path ...

Post by SPH »

Hi everybody, :)

I need your knowledge!
My encryption software makes ".mkey2" files
So I said windows it launches my encryptor when we double click on a .mkey2 file
What I would like is that my cryptor opens on the path of the double clicked file (ExplorerTreeGadget)!

Here is a short code that can be considered as my software:

Code: Select all

OpenWindow(0, 0, 0, 749, 515, "SPH", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

Global Repertoire$
calcul=0

ExplorerTreeGadget(1, 11, 73, 230, 280, Repertoire$, #PB_Explorer_NoFiles)
ExplorerListGadget(2, 247,73,490,280, "*.*", #PB_Explorer_NoFolders|#PB_Explorer_NoParentFolder)
SendMessage_(GadgetID(2),#LVM_SETCOLUMNWIDTH,0,188) ; largeur colonne
SendMessage_(GadgetID(2),#LVM_SETCOLUMNWIDTH,1,80) ; largeur colonne

FrameGadget(3, 11,  360, 726,33, "", #PB_Frame_Single)

;titre
TextGadget(4, 20, 370,90,20,"Password :")
;password
StringGadget(5, 80,  366, 570, 20, ""  )

;invisible
ButtonGadget(6, 656,  366, 30, 20, "Hide", #PB_Button_Toggle)


;cls
ButtonGadget(7, 693,  366, 40, 20, "Clear")

Procedure Afficher_fichiers()
  SetGadgetText(2, "")                    ; Vider la liste des fichiers
  Repertoire$ = GetGadgetText(1)          ; Voir quel est le répertoire sélectionné
  SetGadgetText(2, Repertoire$)           ; Remplir la liste avec le répertoire
EndProcedure

BindGadgetEvent(1, @Afficher_fichiers(), #PB_EventType_Change) ; #PB_EventType_LeftClick) 


Repeat
  Evenement = WindowEvent()
  If Evenement = #PB_Event_Gadget
    If EventGadget()=6 ; hide button
      If GetGadgetState(6)=1         
        StringGadget(5, 80,  366, 570, 20, GetGadgetText(5),#PB_String_Password)
      Else
        StringGadget(5, 80,  366, 570, 20, GetGadgetText(5))
      EndIf
      
      
    EndIf
    
   
    window_event = WaitWindowEvent(5) ;changing the progressbar's will always cause this to catch an event
    While window_event <> 0
      If window_event = #PB_Event_CloseWindow : Break 2: EndIf
      window_event = WindowEvent()
    Wend
   
  EndIf
Delay(5)
Until Evenement = #PB_Event_CloseWindow
End

;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;
Thx a lot 8)
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Open an exe (compiled .pb) with the right path ...

Post by Derren »

Code: Select all

path.s = GetPathPart( ProgramFilename() )
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Open an exe (compiled .pb) with the right path ...

Post by SPH »

... no, I do not think that's it.
Basically, my encryptor (a compiled .PB) is closed. When I double click on a ".mkey2" file in the windows browser, my software opens on the path (ExplorerTreeGadget) of the double clicked file!
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Open an exe (compiled .pb) with the right path ...

Post by oreopa »

Code: Select all

; ENSURE WE CD TO PROGRAM DIR IN CASE OF INVOKATION FROM SHELL/OPEN WITH...
SetCurrentDirectory(GetPathPart(ProgramFilename()))
no?
Last edited by oreopa on Thu Aug 15, 2019 5:08 pm, edited 1 time in total.
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Open an exe (compiled .pb) with the right path ...

Post by Derren »

Sorry, misunderstood.

Try

Code: Select all

GetPathPart(Programparameter())
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Open an exe (compiled .pb) with the right path ...

Post by Denis »

SPH,

you want to open your app from windows shell when you click on your file ?

I don't know how to do but may be a key into the register base which associate your extension file and a parameter key to launche your app with the correct name.

Your app have to read parameter to separate file from folder.
You have to use an installer to write the right key to register base.

May be there are register base gurus here.
A+
Denis
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Open an exe (compiled .pb) with the right path ...

Post by Little John »

SPH wrote:My encryption software makes ".mkey2" files
So I said windows it launches my encryptor when we double click on a .mkey2 file
What I would like is that my cryptor opens on the path of the double clicked file (ExplorerTreeGadget)!
Your encryptor program can open the mkey2 file on which you clicked, because the path and name of that file is passed to your program as parameter (provided everything is configured correctly on your Windows system).

So I think this should work:
Derren wrote:Try

Code: Select all

GetPathPart(Programparameter())
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Open an exe (compiled .pb) with the right path ...

Post by SPH »

Everyone is talking about "GetPathPart (Program Parameter ())" but have you tried to include it in my post 1 code?
Try and see if it works ... (I do not believe it)
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
Marc56us
Addict
Addict
Posts: 1477
Joined: Sat Feb 08, 2014 3:26 pm

Re: Open an exe (compiled .pb) with the right path ...

Post by Marc56us »

So I said windows it launches my encryptor when we double click on a .mkey2 file
What I would like is that my cryptor opens on the path of the double clicked file (ExplorerTreeGadget)!

Code: Select all

...
Repertoire$ = GetPathPart( ProgramParameter( 0 ) ) )
ExplorerTreeGadget(1, 11, 73, 230, 280, Repertoire$, #PB_Explorer_NoFiles)
...
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Open an exe (compiled .pb) with the right path ...

Post by Little John »

SPH wrote:but have you tried to include it in my post 1 code?
Try and see if it works ... (I do not believe it)
:lol: :lol: :lol:

A better question is: Have you tried to include it in your code :?:
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Open an exe (compiled .pb) with the right path ...

Post by SPH »

http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
Derren
Enthusiast
Enthusiast
Posts: 313
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

Re: Open an exe (compiled .pb) with the right path ...

Post by Derren »

Speechless. :shock:
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Open an exe (compiled .pb) with the right path ...

Post by SPH »

Derren wrote:Speechless. :shock:
Excuse me, but I think you gave me the answer. It's my fault if I did not know how to use it ... :oops: :oops: :oops:
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
Post Reply