Jump to content

GordonFreeman

Active Members
  • Posts

    294
  • Joined

  • Last visited

Recent Profile Visitors

950 profile views

GordonFreeman's Achievements

  1. Hi guys, i'm trying to match an string first than another. In this case regex should match ZA if ZA exists and after match Z if exists. But getting unexpected results getting A in the second scenario In other words the first part of regex should try match first ZA, WA or VA and if not match one then try Z,W or V Other logic point view of same problem is match Z or W or V with A and if not match one of these, match one alone #include <StringConstants.au3> #include <Array.au3> $pattern = '([ZA,WA,VA,Z,W,V])([0-9]{1,3})(?:[-])([0-9]{1,3})([y,Y]{0,1})' ; Possible scenario 1: Works as expected ( Row 1 equal Z) $s1 = 'Z01-02y' ; Possible scenario 2: Not works as expects (Row 1 should be ZA instead of A) $s2 = 'ZA01-02Y' $as1 = StringRegExp($s1, $pattern, $STR_REGEXPARRAYFULLMATCH) _ArrayDisplay($as1) $as2 = StringRegExp($s2, $pattern, $STR_REGEXPARRAYFULLMATCH) _ArrayDisplay($as2) ; Other example scenarios ;W881-12Y (Row 1 should be W) ;WA02-921 (Row 1 should be WA) ; Most part is working nice, the only problem relies on the first part of regex thanks in advance for any efforts
  2. Hi, i'm trying to save data in an ini key that contains @LF and @CRLF (to use in an edit control). But @LF and @CRLF cause error in ini files (because it breaks the line). Then im trying to find a workaround. Here's the script thanks in advance: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $hEDIT = GUICtrlCreateEdit("",11,11,600,400) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### IniWrite("JustATest.ini","TestSec","TestKey","TestValue " & @CRLF & "Testing" & @LF & "test") $sData = IniRead("JustATest.ini","TestSec","TestKey","") GUICtrlSetData($hEDIT,$sData) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
  3. Thanks i found this buts are to old and i get some errors when tried run the samples and i cannot fix. Can you help me? All Mouse constants say that already declared but when i remove cannot run the sample script
  4. You can also run directly like: $sFile = "C:\Windows\notepad.exe" ShellExecute($sFile) ; or Run(@ComSpec & " /c " & '"' & $sFile & '"', "", @SW_HIDE)
  5. ShellExecute("C:\Windows")
  6. Hi, i searched some topics but cannot found a simple way to do that: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) ; I tried this but user reported that it work in 2006, not seems work actually $filemenu = GUICtrlCreateMenu ("&File") $fileitem = GUICtrlCreateMenuitem ("Open",$filemenu) GuiCtrlSetImage($fileitem, "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Also tried: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 615, 438, 192, 124) GUISetState(@SW_SHOW) $filemenu = TrayCreateMenu("&File") $fileitem = TrayCreateItem("Open",$filemenu) ;GuiCtrlSetImage($fileitem, "shell32.dll", 4) ;GuiCtrlSetImage(TrayItemGetHandle($fileitem), "shell32.dll", 4) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Well.. thanks in advance! Ok. I found this working example from Yashied. If i cannot find a simple then i will go with it #Include <GUIConstantsEx.au3> #Include <GUIMenu.au3> #Include <Constants.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $hMenu, $hForm, $hFile = 1000, $idNew, $idExit $hForm = GUICreate('Menu', 400, 300) $hFile = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem ($hFile, 0, ' &Favorites', $idNew) _GUICtrlMenu_InsertMenuItem ($hFile, 1, '', 0) _GUICtrlMenu_InsertMenuItem($hFile, 2, ' E&xit', $idExit) $hMenu = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hMenu, 0, '&File', 0, $hFile) _GUICtrlMenu_SetMenu($hForm, $hMenu) _GUICtrlMenu_SetItemBmp($hFile, 0, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 43, 16, 16)) _GUICtrlMenu_SetItemBmp($hFile, 2, _CreateBitmapFromIcon(_WinAPI_GetSysColor($COLOR_MENU), @SystemDir & '\shell32.dll', 27, 16, 16)) GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func _CreateBitmapFromIcon($iBackground, $sIcon, $iIndex, $iWidth, $iHeight) Local $hDC, $hBackDC, $hBackSv, $hIcon, $hBitmap $hDC = _WinAPI_GetDC(0) $hBackDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateSolidBitmap(0, $iBackground, $iWidth, $iHeight) $hBackSv = _WinAPI_SelectObject($hBackDC, $hBitmap) $hIcon = _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) If Not @error Then _WinAPI_DrawIconEx($hBackDC, 0, 0, $hIcon, 0, 0, 0, 0, $DI_NORMAL) _WinAPI_DestroyIcon($hIcon) EndIf _WinAPI_SelectObject($hBackDC, $hBackSv) _WinAPI_ReleaseDC(0, $hDC) _WinAPI_DeleteDC($hBackDC) Return $hBitmap EndFunc ;==>_CreateBitmapFromIcon Func _WinAPI_PrivateExtractIcon($sIcon, $iIndex, $iWidth, $iHeight) Local $hIcon, $tIcon = DllStructCreate('hwnd'), $tID = DllStructCreate('hwnd') Local $Ret = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sIcon, 'int', $iIndex, 'int', $iWidth, 'int', $iHeight, 'ptr', DllStructGetPtr($tIcon), 'ptr', DllStructGetPtr($tID), 'int', 1, 'int', 0) If (@error) Or ($Ret[0] = 0) Then Return SetError(1, 0, 0) EndIf $hIcon = DllStructGetData($tIcon, 1) If ($hIcon = Ptr(0)) Or (Not IsPtr($hIcon)) Then Return SetError(1, 0, 0) EndIf Return $hIcon EndFunc ;==>_WinAPI_PrivateExtractIcon Ok, i noticed that is a pain create submenu with _GUICtrlMenu_CreatePopup to do like in Tray, and Tray better located, then i need images/icon with Tray functions, some workaround??
  7. Well i instaled a game for my cousin and i get an error when launch then i searched on google and this tell to replace this file to work, i replaced and game works, the (new) file are small than the original file. I scanned on virustotal and get (0/All) for the original file and (1/All) for the modified file. Probably a false positive, theres a way to check more deeply (Only with basic knowledge in the area that i have)? And i also think theres no effect blocking an sys file in Windows firewall, right? Thanks in advance !
  8. I want know if can a .sys file have dangerous code that will stole my information and send via internet? I think .sys file itself cannot access internet but are possible that a "infected" .sys file access internet through other file and steal my information? Ps.: my english are rusty Well, thanks in advance!
  9. I am declaring the value of some coordinates of a config section, and i am thinking that i will need make more declarations, then in one line it looks better
  10. Hi, i having a throuble trying to do it (in one line) IniRead("Example.ini","test","value","100,200") ; in one line, then line above will be: Global $aValue = [100,200] I tried StringSplit but it create an array instead of a value, then i cannot not Ok. it worked. $aValue = StringSplit(IniRead("Example.ini","test","value","100,200"),",",2) MsgBox(0,"",$aValue[1])
  11. I think the best way is whitelist EXEs i use. Thanks orbs. I found this help: http://superuser.com/questions/811147/how-to-whitelist-which-programs-can-access-the-internet @iamtheky Sorry i dont understand your proposal. abc just an example, can be any exe of a software. Anyway, thanks by the help
  12. A general solution
  13. Thanks orbs, but blocking the traffic (with hosts file or wildcarded hosts like) mean in a lot of research and something can pass. I think in remove write permission but it will turn some programs unusable (if not will be the best solution i think). Whitelist also looks lot of research because i use a lot of programs. But i will search a little more methods to find a solution. Thanks
×
×
  • Create New...