Jump to content

youtuber

Active Members
  • Posts

    538
  • Joined

  • Last visited

Recent Profile Visitors

1,095 profile views

youtuber's Achievements

Universalist

Universalist (7/7)

6

Reputation

  1. @pixelsearch thanks, Your suggestion is not suitable for me as I want the user to make manual changes to the ini file. I solved this works fine for me. $RegExpRepSpaceAndQuotesControl = StringRegExpReplace($ReadComboLoadValue, '^\"|\"$', '"$1$2"') $RegExpRepSpaceAndQuotesControl = StringRegExpReplace($ReadComboLoadValue, '^\s|\s$', '$1 " $2') ;or ;$RegExpRepSpaceAndQuotesControl = StringRegExpReplace($ReadComboLoadValue, '^\s|\s$', ' $1"$2 ') Edit: The problem continues @pixelsearch I think you're right, I'll have to use your suggestion, it doesn't seem to have an end, if there are quotes with spaces, it still won't work. sample $valuesini = GUICtrlCreateInput('" ","event":"(.*?)"timing":" "', 16, 67, 473, 25)
  2. IniRead ignores spaces and quotes if the values written in the ini file start and end with a space and start with a double quote and end with a double quote, I want to avoid this before writing to the ini file. For example, if the user makes an regex input to the input as in the following example. $valuesini = GUICtrlCreateInput('","event":"(.*?)"timing":"', 16, 67, 473, 25) I want it to be written to the ini file like this [Values] Value="","event":"(.*?)"timing":""
  3. Is there a quotation mark and a space at the beginning and end when writing in an INI file? I want to check it using RegExpReplace. If there are spaces and quotation marks at the beginning and end, I want to add them. Then, I want to write it to the INI file. I am sure that my regex pattern is working, but I don't know how to use it with StringRegExpReplace. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $aDirPro = @ScriptDir & "\IniFolder" If FileExists($aDirPro) = 0 Then DirCreate($aDirPro) $SectionName = "Values" $Form1 = GUICreate("Form", 500, 200) $valuesini = GUICtrlCreateInput("", 16, 67, 473, 25) $ButtonSaveIni = GUICtrlCreateButton("Save", 16, 100, 475, 70) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ButtonSaveIni $ReadComboLoadValue = GUICtrlRead($valuesini) $RegExpRepSpaceAndQuotesControl = StringRegExpReplace($ReadComboLoadValue, '^\"|\"$', '$1"$2"') $RegExpRepSpaceAndQuotesControl = StringRegExpReplace($ReadComboLoadValue, '^\s|\s$', '$1"$2"') $Ini_FileNameReadCombo = $aDirPro & '\' & "IniFile" & '.ini' If Not GUICtrlRead($valuesini) = "" Then IniWrite($Ini_FileNameReadCombo, $SectionName, 'Value', $RegExpRepSpaceAndQuotesControl) GUICtrlSetData($valuesini, "") GUICtrlSetData($valuesini, IniRead($Ini_FileNameReadCombo, $SectionName, 'Value', '')) MsgBox(0, "Saved Ok.", "Saved Ok.", 3) Else MsgBox(48, "Incorrect operation!", "Cannot be empty...", 5) GUICtrlSetState($valuesini, $GUI_FOCUS) EndIf EndSwitch WEnd
  4. [RegexPatterns] REGEXPATTERN=(.com|\.net|\.org|\.info|\.biz|\.eu|\.fr|\.ch|\.kr|\.edu|\.us)(.*) Test.ini
  5. same problem persists when i try by reading from ini file #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> $aDirPro = @ScriptDir & "\IniFolder" If FileExists($aDirPro) = 0 Then DirCreate($aDirPro) $SectionName = "RegexPatterns" $Form1 = GUICreate("Form", 500, 200) $ComboSelectIniFile = GUICtrlCreateCombo("SelectIniFile", 160, 24, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) $ComboLoadPattern = GUICtrlCreateCombo("SelectPattern", 16, 56, 473, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) SetCombo($ComboLoadPattern, '(.com|\.net|\.org|\.info|\.biz|\.eu|\.fr|\.ch|\.kr|\.edu|\.us)(.*)', Chr(5)) GUICtrlSetData($ComboLoadPattern, 'Item 1|Item 2') $ButtonSaveIni = GUICtrlCreateButton("SaveRegex", 16, 100, 475, 70) GUISetState(@SW_SHOW) _FUNC_INI_READ() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ComboSelectIniFile $Ini_FileNameReadCombo = $aDirPro & '\' & GUICtrlRead($ComboSelectIniFile) & '.ini' If GUICtrlRead($ComboSelectIniFile) <> 'SelectIniFile' Or GUICtrlRead($ComboSelectIniFile) > 0 Then GUICtrlSetData($ComboLoadPattern, "") GUICtrlSetData($ComboLoadPattern, IniRead($Ini_FileNameReadCombo, $SectionName, 'REGEXPATTERN', '')) EndIf Case $ButtonSaveIni $Ini_FileNameReadCombo = $aDirPro & '\' & GUICtrlRead($ComboSelectIniFile) & '.ini' If Not GUICtrlRead($ComboLoadPattern) = "" Then IniWrite($Ini_FileNameReadCombo, $SectionName, 'REGEXPATTERN', GUICtrlRead($ComboLoadPattern)) MsgBox(0, "Saved Ok.", "Regex pattern Saved Ok.", 3) GUICtrlSetData($ComboLoadPattern, "") GUICtrlSetData($ComboLoadPattern, IniRead($Ini_FileNameReadCombo, $SectionName, 'REGEXPATTERN', '')) Else MsgBox(48, "Incorrect operation!", "Cannot be empty - Regex patterns...", 5) GUICtrlSetState($ComboLoadPattern, $GUI_FOCUS) EndIf EndSwitch WEnd Func SetCombo($cComboX, $sData, $sSeparator) Local $sPrevSeparator = AutoItSetOption('GUIDataSeparatorChar', $sSeparator) GUICtrlSetData($ComboLoadPattern, $sData) AutoItSetOption('GUIDataSeparatorChar', $sPrevSeparator) EndFunc Func _FUNC_INI_READ() Local $INI_READ Local $VAR_READ $aIni_List = _FileListToArray($aDirPro, "*.ini", 1) $sIni_List = "" If Not @error Then For $i = 1 To $aIni_List[0] $sIni_List &= "|" & StringTrimRight($aIni_List[$i], 4) Next GUICtrlSetData($ComboSelectIniFile, $sIni_List) EndIf EndFunc ;==>_FUNC_INI_READ
  6. Thank you, but it must be a character not in regex pattern. Do you have a different solution for this? For example, if the user enters an regex pattern like this... ^.*\\|\..*$
  7. The regex pattern that the user entered in the ComboBox, here are sometimes separators in my regex patterns that I print to the ini file, Separator : | And an example of my regex pattern: (.com|\.net|\.org|\.info|\.biz|\.eu|\.fr|\.ch|\.kr|\.edu|\.us)(.*) When I read from the ini file and set data to the combobox, the regex pattern divides into parts, how can I prevent this? Thanks. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> $aDirPro = @ScriptDir & "\IniFolder" If FileExists($aDirPro) = 0 Then DirCreate($aDirPro) $SectionName = "RegexPatterns" $Form1 = GUICreate("Form", 500, 200) $ComboSelectIniFile = GUICtrlCreateCombo("SelectIniFile", 160, 24, 145, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) $ComboLoadPattern = GUICtrlCreateCombo("SelectPattern", 16, 56, 473, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) $ButtonSaveIni = GUICtrlCreateButton("SaveRegex", 16, 100, 475, 70) GUISetState(@SW_SHOW) _FUNC_INI_READ() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ComboSelectIniFile $Ini_FileNameReadCombo = $aDirPro & '\' & GUICtrlRead($ComboSelectIniFile) & '.ini' If GUICtrlRead($ComboSelectIniFile) <> 'SelectIniFile' Or GUICtrlRead($ComboSelectIniFile) > 0 Then GUICtrlSetData($ComboLoadPattern, "") GUICtrlSetData($ComboLoadPattern, IniRead($Ini_FileNameReadCombo, $SectionName, 'REGEXPATTERN', '')) EndIf Case $ButtonSaveIni $Ini_FileNameReadCombo = $aDirPro & '\' & GUICtrlRead($ComboSelectIniFile) & '.ini' If Not GUICtrlRead($ComboLoadPattern) = "" Then IniWrite($Ini_FileNameReadCombo, $SectionName, 'REGEXPATTERN', GUICtrlRead($ComboLoadPattern)) MsgBox(0, "Saved Ok.", "Regex pattern Saved Ok.", 3) GUICtrlSetData($ComboLoadPattern, "") GUICtrlSetData($ComboLoadPattern, IniRead($Ini_FileNameReadCombo, $SectionName, 'REGEXPATTERN', '')) Else MsgBox(48, "Incorrect operation!", "Cannot be empty - Regex patterns...", 5) GUICtrlSetState($ComboLoadPattern, $GUI_FOCUS) EndIf EndSwitch WEnd Func _FUNC_INI_READ() Local $INI_READ Local $VAR_READ $aIni_List = _FileListToArray($aDirPro, "*.ini", 1) $sIni_List = "" If Not @error Then For $i = 1 To $aIni_List[0] $sIni_List &= "|" & StringTrimRight($aIni_List[$i], 4) Next GUICtrlSetData($ComboSelectIniFile, $sIni_List) EndIf EndFunc ;==>_FUNC_INI_READ
  8. @Danp2 Thanks but... Earlier I have seen a code snippet that checks service status without recursively checking or checking from the loop. But I don't remember under which topic I found those codes. I guess it was something like this. Local Static $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Service WHERE name = "' & $CheckServiceServiceName & '" and state = 'Running'")
  9. I couldn't answer because of my busy work, now I tried again with different scenarios, my problem still continues. Stops the service after Script Ends. #RequireAdmin $oShell = ObjCreate("shell.application") If @OSVersion = "WIN_10" Then $sStatus = _CheckService("DPS") If $sStatus = 1 Then $oShell.ServiceStop("DPS", False) MsgBox(0, "$oShell.ServiceStop", $sStatus) ;or _StopService("DPS") MsgBox(0, "_StopService", $sStatus) ;or RunWait(@ComSpec & " /c " & 'net stop DPS', "", @SW_HIDE) MsgBox(0, "RunWait net stop", $sStatus) Else MsgBox(0, "", "Status 2 And 3" & $sStatus) RunWait(@ComSpec & " /c " & 'net start DPS', "", @SW_HIDE) EndIf EndIf Func _CheckService($CheckServiceServiceName) Local $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Service WHERE Name = "' & $CheckServiceServiceName & '"') If Not IsObj($colItems) Then Exit MsgBox(0, "", "Not an object : DPS", 5) If Not $colItems.count Then Return 0 ; Service not found For $oItem In $colItems If $oItem.State = "Running" Then Return 1 If $oItem.State = "Stopped" Then Return 2 If $oItem.State = "Not Installed" Then Return 3 Next EndFunc Func _StopService($StopServiceName) Local $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Local $oServiceList = $oWMI.ExecQuery('SELECT * FROM Win32_Service WHERE Name = "' & $StopServiceName & '"') For $sService In $oServiceList $sService.StopService() Next EndFunc
  10. DPS Service can't get status to "Stopped" return value is always 1 #RequireAdmin If @OSVersion = "WIN_10" Then $sStatus = _CheckService("DPS") If $sStatus = 1 Then MsgBox(0, "", "Status1 : " & $sStatus) RunWait(@ComSpec & " /c " & 'net stop DPS', "", @SW_HIDE) MsgBox(0, "", "Status2 : " & $sStatus) RunWait(@ComSpec & " /c " & 'net start DPS', "", @SW_HIDE) Else RunWait(@ComSpec & " /c " & 'net start DPS', "", @SW_HIDE) EndIf EndIf Func _CheckService($s_ServiceName) Local $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") Local $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Service WHERE Name = "' & $s_ServiceName & '"') If Not IsObj($colItems) Then Exit MsgBox(0, "", "Not an object : DPS", 5) If Not $colItems.count Then Return 0 ; Service not found For $oItem In $colItems If $oItem.State = "Running" Then Return 1 If $oItem.State = "Stopped" Then Return 2 If $oItem.State = "Not Installed" Then Return 3 Next EndFunc ;==>_CheckService
  11. This will bring it back. #RequireAdmin RegWrite('HKCU\Software\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('0'))
  12. I tried all possibilities for this but unfortunately, People Bar is still available in Taskbar 😃 I even cleared the cache of the icons, maybe it will work, but unfortunately. #RequireAdmin RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People', 'PeopleBand','REG_DWORD',Number('0')) RegWrite('HKCU\Software\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('1')) RegWrite('HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('1')) _Update_Explorer() Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters ,1 ,True") Run("ie4uinit.exe -ClearIconCache") DllCall("shell32.dll", "int", 660, "int", 1) ;660 = FileIconInit Func _Update_Explorer() Local $bOld = Opt("WinSearchChildren", True) Local $a = WinList("[CLASS:SHELLDLL_DefView]") For $i = 0 To UBound($a) - 1 DllCall("user32.dll", "long", "SendMessage", "hwnd", $a[$i][1], "int", 0x111, "int", 28931, "int", 0) Next Opt("WinSearchChildren", $bOld) EndFunc ;==>_Update_Explorer I even searched for the "TraySettings" parameter in Spy++, which is in the solution with the url on stackoverflow sent by your @rsn friend. There is no such parameter. ;SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) TEXT("TraySettings"))
  13. @rsnThe Task at the url you posted hides the view, I converted it to autoit code but People Bar does not hide. #RequireAdmin Global $HWND_BROADCAST = 0xffff Global $WM_SETTINGCHANGE = 0x001A Global $WM_ERASEBKGND = 0x0014 RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced', 'ShowTaskViewButton','REG_DWORD',Number('0')) RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People', 'PeopleBand','REG_DWORD',Number('0')) RegWrite('HKCU\Software\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('1')) RegWrite('HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('1')) ;SendNotifyMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) TEXT("TraySettings")) DllCall("user32.dll", "lresult", "SendNotifyMessage", _ "int", $HWND_BROADCAST, _ "int", $WM_SETTINGCHANGE, _ "int", $WM_ERASEBKGND, _ "str", "TraySettings")
  14. How does the Windows operating system do it manually? There must be a magic code or deceptive code for this 😕 #RequireAdmin RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People', 'PeopleBand','REG_DWORD',Number('0')) RegWrite('HKCU\Software\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('1')) RegWrite('HKLM\SOFTWARE\Policies\Microsoft\Windows\Explorer', 'HidePeopleBar','REG_DWORD',Number('1'))
  15. Yes this worked for me thank you.😃 mspaint.exe /ForceBootstrapPaint3D Where did you get this parameter information?
×
×
  • Create New...