Jump to content

Recommended Posts

Posted (edited)

Hey so I was wondering if I had a file string such as "C:/example/file.exe" would there be any way to pull out the directory from that so I could set a variable to be "C:/example/" only knowing "C:/example/file.exe" automatically?

So for example, If I had this script:

Opt("MustDeclareVars", 1)
Global $file1
Global $directory1

$file1 = FileOpenDialog ("", "", "All Files (*.*)")

how would I be able to set $directory1 as the directory containing selected $file1

Edited by cheeseandcereal
Posted

You could use function _PathSplit ore use a regular expression (some examples can be found on the forum).

My UDFs and Tutorials:

  Reveal hidden contents

 

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
×
×
  • Create New...