Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/28/2017 in all areas

  1. InunoTaishou

    Help creating GUI!

    Well here's a very very simple one, that shows the concept. #include <GUIConstants.au3> #include <WindowsConstants.au3> Global $hMain = GUICreate("Main Window", 400, 600) Global $hChild = GUICreate("Child Window", 200, 600) GUIRegisterMsg($WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGING) GUISetState(@SW_SHOW, $hMain) GUISetState(@SW_SHOW, $hChild) WinMove($hMain, "", 0, 0) While (True) Switch (GUIGetMsg()) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func WM_WINDOWPOSCHANGING($hWnd, $iMsg, $wParam, $lParam) Local $tWindowPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $iLeft = DllStructGetData($tWindowPos, 3) Local $iTop = DllStructGetData($tWindowPos, 4) Local $iWidth = DllStructGetData($tWindowPos, 5) Local $iHeight = DllStructGetData($tWindowPos, 6) Local Static $iLastX = 0 Local Static $iLastY = 0 Switch ($hWnd) Case $hChild DllStructSetData($tWindowPos, 3, $iLastX) DllStructSetData($tWindowPos, 4, $iLastY) Case $hMain WinMove($hChild, "", $iLeft + $iWidth, $iTop) $iLastX = $iLeft + $iWidth $iLastY = $iTop EndSwitch EndFunc
    1 point
  2. InunoTaishou

    Help creating GUI!

    It's way too late for me to write out the example but you can look at using GUIRegisterMsg($WM_WINDOWPOSCHANGING, WM_WINDOWPOSCHANGING) Func WM_WINDOWPOSCHANGING($hWndFrom, $iMsg, $wParam, $lParam) Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) Local $iWidth = DllStructGetData($stWinPos, 5) Local $iHeight = DllStructGetData($stWinPos, 6) EndFunc This will let you know when a GUI is being moved to adjust the other GUI, or not allow the move (using DLLStructSetData will set the position of the window and interrupt the actual move).
    1 point
  3. You can try: #NoTrayIcon #include <MsgBoxConstants.au3> Global Const $sFileListName = @HomeDrive & "\names.txt" ; path of file list name Global Const $iFile = @HomeDrive & "\system.act" ; Path to file want copy and rename Global Const $iDirCopyTo = @HomeDrive Global Const $iExtFile = ".act" Global Const $sOverWrite = True If Not FileExists($sFileListName) Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "Error 1", "The file doesn't exist: " & @CRLF & $sFileListName) If Not FileExists($iFile) Then Exit MsgBox($MB_ICONERROR + $MB_TOPMOST, "Error 2", "The file doesn't exist: " & @CRLF & $iFile) Global $iNewPath, $sListName = FileReadToArray($sFileListName) ; Read list name to array by line For $i = 0 To UBound($sListName) - 1 $iNewPath = $iDirCopyTo & "\" & $sListName[$i] & $iExtFile ConsoleWrite("Copy (" & $i & ") to :> " & $iNewPath & " :>: " & (FileCopy($iFile, $iNewPath, $sOverWrite) ? "OK" : "Error") & @CRLF) Next
    1 point
  4. It takes a screenshot and finds the image you requested! So it does not work with hidden windows or background processes!
    1 point
  5. @GUI_DragFile will not bring more benefit for the desired action than a simple GuiCtrlRead, as reading @GUI_DragFile gives file names also separated by a pipe OTOH , setting Opt(GUIDataSeparatorChar, ";") doesn't work for this So for an instant display in the input using ";" as separator, the only way is to intercept the message before writing in the input
    1 point
  6. czardas

    Roman (Again)

    Thanks for sharing! Edit - You ought to include some form of validity check because it erroneously returns values for invalid roman numeral sequences and out of range integers - it's something to think about.
    1 point
  7. ProgAndy

    URL Encoding

    I wrote some functions including UTF-8 conversion Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"") Local $nChar $sData="" For $i = 1 To $aData[0] ; ConsoleWrite($aData[$i] & @CRLF) $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar,2) EndSwitch Next Return $sData EndFunc Func _URIDecode($sData) ; Prog@ndy Local $aData = StringSplit(StringReplace($sData,"+"," ",0,1),"%") $sData = "" For $i = 2 To $aData[0] $aData[1] &= Chr(Dec(StringLeft($aData[$i],2))) & StringTrimLeft($aData[$i],2) Next Return BinaryToString(StringToBinary($aData[1],1),4) EndFunc MsgBox(0, '', _URIDecode(_URIEncode("testäöü fv"))) Edit 2012: Fixed bug in _URIEncode, removed debug output
    1 point
×
×
  • Create New...