Jump to content
Sign in to follow this  
MasonMill

@ScriptDir

Recommended Posts

MasonMill

Where is the file containing @ScriptDir?

Share this post


Link to post
Share on other sites
Melba23

MasonMill,

There is no file - @ScriptDir is a macro generated at runtime.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MasonMill

I should have been more clear. When you use iniwrite it writes to a file you designate is what i understand it to do. Where does that file get put? Like for example:

IniWrite(@ScriptDir&"\Set.ini","SetFull","Y1","0")

Share this post


Link to post
Share on other sites
Melba23

MasonMill,

The file will be created in the same folder as the script - that is what the macro @ScriptDir holds.

So if your script was in "C:\MasonMill\Scripts", you would be creating the file "C:\MasonMill\Scripts\Set.ini".

All clear? :idea:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MasonMill

Oh i see it now. The script was on my desktop so it just puts it on my desktop, or where ever the script is. Thanks!

Share this post


Link to post
Share on other sites
ShawnW

except in this case you don't really need to put that. If you just did

IniWrite("Set.ini","SetFull","Y1","0")

I think it would look in the path local to the script by default.

Share this post


Link to post
Share on other sites
Melba23

ShawnW,

I think it would look in the path local to the script by default

Correct! :idea:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
MvGulik
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
Melba23

MvGulik,

You learn something every day - or at least you should! Although in my defence - unless you specify otherwise, the working folder starts as the script folder. :)

Thanks. :idea:

M23

Edit: Altered text - se below.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Richard Robertson

By default, most processes use their folder as the working directory at start time. However, many things can chance the working directory, including a file save dialog.

Share this post


Link to post
Share on other sites
Melba23

Richard Robertson,

2 things in 2 minutes - not sure my aged brain can learn this fast! :idea:

Previous post edited - thanks.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
jaenster

MasonMill,

The file will be created in the same folder as the script - that is what the macro @ScriptDir holds.

So if your script was in "C:\MasonMill\Scripts", you would be creating the file "C:\MasonMill\Scripts\Set.ini".

All clear? :idea:

M23

only when you run that script mainly (Not as an include)

But what he said is true.

If ya run your program, from c:\ , and you use @scriptdir&"\hi.ini" it is in c:\hi.ini

If you ever gonna work with includes, it gonna work a bit harder, It is the current map where you work with

Ever saw the command run() ?

if you do for example, run("c:\dir\Myprogram.exe","c:\","")

Now his workdir is in c:\. This means that @scriptdir = c:\

Someone correct me when i am wrong, didn't used autoit for a long time :)


-jaenster

Share this post


Link to post
Share on other sites
Richard Robertson

only when you run that script mainly (Not as an include)

But what he said is true.

If ya run your program, from c:\ , and you use @scriptdir&"\hi.ini" it is in c:\hi.ini

If you ever gonna work with includes, it gonna work a bit harder, It is the current map where you work with

Ever saw the command run() ?

if you do for example, run("c:\dir\Myprogram.exe","c:\","")

Now his workdir is in c:\. This means that @scriptdir = c:\

Someone correct me when i am wrong, didn't used autoit for a long time :idea:

No, @ScriptDir in your example would still be "C:\dir". @WorkingDir would be "C:\".

Share this post


Link to post
Share on other sites
MHz

The working directory can be @ScriptDir in case of double click in explorer but starting a script from the registry, a command prompt, a shortcut etc can pass a working directory other the @ScriptDir and you need to accept that and use it.

Many installed applications use a passed working directory to access files in the working directory. To have similar behavior for your script, then store the working directory at initial start of script and use that to access files. For some of the examples given, the working directory can be passed to the script and a ini file can be used in the specified working directory.

For example:

; store initial working directory at top of script
Global Const $STARTWORKINGDIR = @WorkingDir

; you can change the working directory of the script but $STARTWORKINGDIR is same
FileChangeDir('Any Dir change will not affect $STARTWORKINGDIR')

; use $STARTWORKINGDIR to access files
IniWrite($STARTWORKINGDIR & '\test1.tmp.ini', 'section', 'key', 'value')

You could use @ScriptDir instead of $STARTWORKINGDIR used above but you lose the option of using the passed working directory.

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  

×