Search the Community
Showing results for tags 'Config'.
-
Is there any way to use a .au3 file as a config file? From what I understand, when you #include a file, it gets added to the script and they are both compiled together. Is it possible to compile only the script and then "include" the file at runtime? So that you would have "Script.exe" and a "Config.au3" and when you run Script.au3, it would add everything in config.au3 and then run? Or is this a horriable idea for some reason I'm not aware of yet
-
The below functions are to write data to a configuration or property file and also read them back. BuildLocation:C:\Build BuildExe : setup.exe Release:r9.7 Silent:No InstallPath:default Compare :No MartUpgrade :Yes Bit:64 ERwinUpgrade:No License_File:150416-1952 Navigator (ca.com).lic You can change the character from ":" to "=" or whatever based on your requirement and update the code also accordingly. Property.au3
-
Hi, I have a property file format configuration file for our project. The sample file is as below. BuildLocation:C:\Build BuildExe:erwin Data Modeler r9.7 (64-bit)_2378.exe Release:r9.64.02 Silent:No InstallPath:default Compare :No MartUpgrade :Yes Bit:64 ERwinUpgrade:No License_File:150416-1952 Navigator (ca.com).lic To read this file, I am using below code. Func readConfig($sFilePath,$intStartCode) ;Usage: MsgBox(0,"Silent",readConfig(@ScriptDir&"\Config.txt","Silbent")) ;$sReplaceText = "Mani Prakash" ;$sFilePath = "C:\Users\KIRUD01\Desktop\Config.txt" ;$intStartCode = "BuildExe" $arrRetArray = "" $s = _FileReadToArray($sFilePath, $arrRetArray);Reading text file and saving it to array $s will show status of reading file.. For $i = 1 To UBound($arrRetArray)-1 $line = $arrRetArray[$i];retrieves taskengine text line by line If StringInStr($line, $intStartCode) Then ConsoleWrite ("Starting point "& $line & @CRLF) return StringStripWS(StringSplit($line,":")[2],$STR_STRIPLEADING + $STR_STRIPTRAILING ) EndIf if $i = UBound($arrRetArray)-1 then return "Not Found" Next EndFunc The above code is working to read the particular key value. But problem is , if I try to read the key "Bit" it is giving the value of key "BuildExe" as the line contains the word "bit".. Can you suggest how to do this. If possible I need to fix writeConfig also. Func writeConfig($sFilePath,$intStartCode,$sReplaceText) ;$sReplaceText = "Mani Prakash" ;$sFilePath = "C:\Users\KIRUD01\Desktop\Config.txt" ;$intStartCode = "BuildExe" $arrRetArray = "" $s = _FileReadToArray($sFilePath, $arrRetArray);Reading text file and saving it to array $s will show status of reading file.. $intStartingPointFound = 0 For $i = 1 To UBound($arrRetArray)-1 $line = $arrRetArray[$i];retrieves taskengine text line by line If StringInStr($line, $intStartCode) Then $intStartingPointFound = 1;if found the starting point of the module to copy then set this variable to 1 ConsoleWrite ("Starting point " & @CRLF) $arrRetArray[$i] = $intStartCode & ": " & $sReplaceText ExitLoop EndIf if $i = UBound($arrRetArray)-1 then ConsoleWrite("Not Found" & @CRLF) Next _FileWriteFromArray ($sFilePath, $arrRetArray,1) EndFunc
-
I have a custom configuration file which has key-value pairs as in below format. BuildLocation:C:\Build BuildExe:setup.exe Release:r9.64.02 Silent:No InstallPath:default Compare :No MartUpgrade :Yes Bit:64 ERwinUpgrade:No I need to change the value of "BuildExe" using my program. Is there any inbuilt function already available for these kind of files?. Can any one help me how to do this.
-
I've never worked with an array or dropdown menu before and I can't seem to wrap it around my head this morning. Maybe I just need more coffee but I'm trying to populate a GUI dropdown menu with section names of a .ini file. Here is what I have for this part but I don't know where to go from here. The msgbox thing was only testing it but I kinda got stuck here. local $aSectionnames = IniReadSectionNames(@DesktopDir & "\Scripts\BatteryConfig.ini") if Not @error Then For $i = 1 to $aSectionnames[0] MsgBox($MB_SYSTEMMODAL, "Test", $aSectionnames[$i]) Next EndIf Here is my very basic dropdown menu I want to populate #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 413, 213, 192, 124) $Combo1 = GUICtrlCreateCombo("Combo1", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Thanks!
-
I am currently working on a (small) project, which will set my pc screen blank for x seconds and then turn it back on. The code looks like this now (I've copied the blackscreen func and put some other variables in): func BlackFor($time) Global $untilback = $time EndFunc BlackFor(5000); Sets how long the screen should be black, in milliseconds. func screenFlicker() Opt("WinTitleMatchMode", 4) $WM_SYSCommand = 274 $SC_MonitorPower = 61808 $Power_On = -1 $Power_Off = 2 $X = 1 $HWND = WinGetHandle("classname=Progman") DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Power_Off) Sleep($untilback) DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", $Power_On) endFunc screenFlicker() But, when I start a project and it works, I want to make it even better. So I thought about a GUI which sets the milliseconds to a config file. I understand the GUI part, but I need a solution of a config file. I saw a topic some months ago with a config script saver - which I can't find anymore. I've searched on Google, AutoIt forums.. can't find that excact one. It had functions like ConfgWrite and ConfgRead I think. I've looked into the AutoIt config systems, but I really want a config to be saved somewhere on a pc - easy to edit even without the editor I'll make for the script. The reason I want this screen-flicker, is that it might come good in the future :3 Even though I know that there are lots of these already... -CasterAnd