Sign in to follow this  
Followers 0
njdev1k

File Open Dialog return just file name to label

4 posts in this topic

I am trying to return just the file name and not the entire path to the file using FileOpenDialog to a label, how do I break it down to just file name selected?

Partial code below

FileInstall("C:\TargetReset\TargetReset.exe", $destination2, 1)

FileInstall("C:\TargetReset\radesdkpia.dll", $destination3, 1)

FileInstall("C:\TargetReset\TargetReset.pdb", $destination4, 1)

FileInstall("C:\TargetReset\TargetReset.vshost.exe", $destination5, 1)

FileInstall("C:\TargetReset\info.txt", $destination6, 1)

$filelbl = GuiCtrlCreateLabel("Select profile to reset", 10, 20, 100, 20)

$filebutton = GuiCtrlCreateButton("Select Profile", 10, 40, 100, 20)

$filelbl2 = GuiCtrlCreateLabel("Select cab file GUID to reset", 260, 20, 150, 20)

$filebutton2 = GuiCtrlCreateButton("Select Cab", 280, 40, 100, 20)

$info1 = GUICtrlCreateLabel("Profile: ", 10, 80, 480, 40)

$info2 = GUICtrlCreateLabel("GUID: ", 10, 160, 300, 20)

;$Proglbl = GuiCtrlCreateLabel("Target Reset Utility", 10, 10, 220, 20)

;$guidlbl = GuiCtrlCreateLabel("Enter GUID to reset", 10, 80, 220, 20)

;$guid = GUICtrlCreateInput("", 10, 100, 300, 20)

$Runlbl = GuiCtrlCreateLabel("Execute against target", 10, 220, 140, 20)

$Runbutton = GuiCtrlCreateButton("Run", 10, 240, 100, 20)

$Cancelbutton = GuiCtrlCreateButton("Quit", 280, 240, 100, 20)

$var = ""

$bLoop = 1

While $bLoop = 1

$msg = GuiGetMsg()

Select

Case $msg = -3

Exit

Case $msg = $filebutton

$var = FileOpenDialog("Select profile", @ScriptDir, "Profiles (*.profile)", 1)

$chosen = ($var)

GUICtrlSetData($info1, "Profile: " & $chosen)

$bLoop = 1

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0