myksharma Posted June 6, 2014 Share Posted June 6, 2014 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! Link to comment Share on other sites More sharing options...
JohnOne Posted June 6, 2014 Share Posted June 6, 2014 StringReplace() <- help file. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 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. Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 anyone! Link to comment Share on other sites More sharing options...
AlmarM Posted June 6, 2014 Share Posted June 6, 2014 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. Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 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.. Link to comment Share on other sites More sharing options...
guinness Posted June 6, 2014 Share Posted June 6, 2014 It's a macro, it can't be changed as your script location is static until moved. Look at @WorkingDir and FileChangeDir() instead. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _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 parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 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. Link to comment Share on other sites More sharing options...
jguinch Posted June 6, 2014 Share Posted June 6, 2014 @ScriptDir is a dynamic macro. If you move your script, @ScriptDir changes too. Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
JohnOne Posted June 6, 2014 Share Posted June 6, 2014 I'm still a bit confused as to what you actually need. You understand that @ScriptDir means the location from where your exe or code is located when ran? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 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. Link to comment Share on other sites More sharing options...
JohnOne Posted June 6, 2014 Share Posted June 6, 2014 It.s on the fly if I understand you correctly. Compile this script, and run it from different locations on you machine. MsgBox(0, "You ran me from", @ScriptDir) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 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. Link to comment Share on other sites More sharing options...
Jfish Posted June 6, 2014 Share Posted June 6, 2014 This may be a silly question but is the DialogControl.ini file located in the same directory as your script? If not, it won't be read. Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 It is.-) Link to comment Share on other sites More sharing options...
myksharma Posted June 6, 2014 Author Share Posted June 6, 2014 Is there anything that's required other than keeping the file in the scripts directory. For instance, anything to tick during compilation.. Link to comment Share on other sites More sharing options...
JohnOne Posted June 6, 2014 Share Posted June 6, 2014 No. Perhaps you should create a small runnable reproducer script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Jfish Posted June 6, 2014 Share Posted June 6, 2014 (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 June 6, 2014 by Jfish Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
iamtheky Posted June 6, 2014 Share Posted June 6, 2014 (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 June 6, 2014 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
myksharma Posted June 9, 2014 Author Share Posted June 9, 2014 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! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now