Sign in to follow this  
Followers 0
myksharma

@ScriptDir

35 posts in this topic

How can I define a specific directory in @scriptdir.

I'm trying to recompile an .au3 that was written by somebody else.

Now I need to edit the @scriptdir at every reference which is kind of annoying.

Appreciate it someone could assist in this!

Share this post


Link to post
Share on other sites



thanks JohnOne but that'd not really solve my purpose.

I'd want to know how the @scriptdir is declared so I can use it in other .au3's as well.

Share this post


Link to post
Share on other sites

anyone!

Share this post


Link to post
Share on other sites

CTRL + H in SciTE?


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

Let me explain the scenario a bit.

This is what I've at the moment--

$GUIFont = IniRead("C:UsersXXXXXXDesktopCode1" & 'DialogControl.ini', 'GUIControl', 'GUIFont', 'Tahoma')

How I want it to look like--

$GUIFont = IniRead(@ScriptDir & 'DialogControl.ini', 'GUIControl', 'GUIFont', 'Tahoma')

So I'd like to how is this @ScriptDir is declared..

thanks in advance..

Share this post


Link to post
Share on other sites

It's a macro, it can't be changed as your script location is static until moved. Look at @WorkingDir and FileChangeDir() instead.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Thanks Guinness.

How can I get it to work as a dynamic one then?

To give you a background I'm using this .au3 compiled executable for OS Deployment purpose & when the executable runs it doesn't read from the subsections given in the dialog.ini file.

If you could share some URL's that I can go through to make it, that'll be high appreciated.

Share this post


Link to post
Share on other sites

Yes I got that from the Helpfile. however I'd like to know how to incorporate this macro in the .au3.

Do I need to declare the @Scriptdir location somewhere before I use it in my code or it'll automatically use the executable location on the fly.

If it takes on the fly, then probably it's not working as expected in my case.

Share this post


Link to post
Share on other sites

Snip from my code--

; Get WMI section Font and Colors from INI
$WMIFontColor = IniRead(@ScriptDir & 'DialogControl.ini', 'GUIControl', 'WMIFontColor', '0x646464')
$GUIFont = IniRead(@ScriptDir & 'DialogControl.ini', 'GUIControl', 'GUIFont', 'Tahoma')
 
this is from the dialogcontrol.ini
 
 
[GUIControl]
WMIFontColor=0xFFFFFF
GUIFont=Tahoma
 
When I run the program, it doesn't show these fonts & colors.

Share this post


Link to post
Share on other sites

It is.-)

Share this post


Link to post
Share on other sites

Is there anything that's required other than keeping the file in the scripts directory. For instance, anything to tick during compilation..

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

The approach works fine for me.  Make sure you are reading in the ini values by adding ConsoleWrite($WMIFontColor) and ConsoleWrite($GUIFont) after the iniread call.  Then make sure you are actually using those variables after they are read like this:

GUICtrlSetFont(-1, 17, 400, 0, $GUIFont)
GUICtrlSetColor(-1, $WMIFontColor)
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


; Get WMI section Font and Colors from INI
$WMIFontColor = IniRead(@ScriptDir & '\colors.ini', 'GUIControl', 'WMIFontColor', '0x646464')
ConsoleWrite($WMIFontColor)
$GUIFont = IniRead(@ScriptDir & '\colors.ini', 'GUIControl', 'GUIFont', 'Tahoma')
ConsoleWrite($GUIFont)

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
$Label1 = GUICtrlCreateLabel("This is some text", 96, 152, 184, 33)
$Label1 = GUICtrlCreateLabel("This is some text", 96, 152, 184, 33)
GUICtrlSetFont(-1, 17, 400, 0, $GUIFont)
GUICtrlSetColor(-1, $WMIFontColor)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd
Edited by Jfish

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

You put it in the same folder with the executable, and probably dont care what that folder is, so how about not using scriptdir at all , just:

iniread( "colors.ini." , ...)

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

I've tried re-checking the code but I really don't know what is not making it to run.

looks to be a silly thing, probably someone could have a look & suggest!

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