Jump to content
Sign in to follow this  
Guest blackhawk

Function current path

Recommended Posts

Guest blackhawk

Hello,

I´m searching for a funktion, which i can find out the current path of the file.

Share this post


Link to post
Share on other sites
buzz44

Hello,

I´m searching for a funktion, which i can find out the current path of the file.

<{POST_SNAPBACK}>

@ScriptFullPath
eg. "C:\Temp\test.txt"

@ScriptDir
eg. "C:\Temp\"

this should be in the suport forum btw :lmao:


qq

Share this post


Link to post
Share on other sites
Guest blackhawk

the path should be variable.

example:

a user save the files on his desktop.

The script should copy the file from the current path (which must be variable) to

an fix path (c:\temp)

and another user could nsave the file in c:

then the script must copy the file from c: to c:\temp.

Share this post


Link to post
Share on other sites
Chris_1013

What file? The AutoIt script, a file you select from the script, or something else? Might wanna have a poke in the help file at the File* functions under Function Reference->File, Directory and Disk Management to see if anything there gives you inspiration and post whatever script you have so far.

Share this post


Link to post
Share on other sites
Guest blackhawk

yes a file that i select from the script.

Share this post


Link to post
Share on other sites
Chris_1013

Take a look at FileOpenDialog - does this help?

Share this post


Link to post
Share on other sites
Guest blackhawk

where can i find this ?

Share this post


Link to post
Share on other sites
Chris_1013

Open the help file... read some stuff... try some things out... then come here when you have problems...

Share this post


Link to post
Share on other sites
zcoacoaz

we need a way to make people read the whole help file before coming here (jk)

use this

$file = FileOpenDialog ( "title", "default dir", "filter (*.*)" )
FileCopy ( $file, "C:\temp" )

ta-da!

EDIT: let me correct myself

we need a way to FORCE people to read the whole help file before coming here

jk of couse :lmao: Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites
SlimShady

Try this one.

$file = FileOpenDialog ( "title", "default dir", "filter (*.*)" )
;FileCopy ( $file, "C:\temp" )
$Folder = _GetFolder($file)
MsgBox(64, "Test", "The folder of the selected file:" & @CRLF & $Folder)

Func _GetFolder($gFile)
   Local $Match
   $Match = StringInStr($gFile, "\", 0, -1)
   Return StringLeft($gFile, $Match - 1)
EndFunc

BTW, you can select a folder y'know using a function: FileSelectFolder()

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  

×