Jump to content

@ScriptDir


Recommended Posts

  • Moderators

MasonMill,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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")

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

ShawnW,

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

Correct! :idea:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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 ...
 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

Richard Robertson,

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

Previous post edited - thanks.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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:\".
Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...