Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/18/2014 in all areas

  1. funkey

    DllCall confusion

    You are welcome, but why not use inbuild ShellExecute() function?
    1 point
  2. When you start to get more sophisticated with your scripting, you can then look for only windows created from the process produced by the Run() command. That way, you don't pick up on a similarly named window, but your exact window. Then, when there are popups, you can get the parent hwnd, and use that to get the 'enabled popups' via: $hYourPopup = _WinAPI_GetWindow($hYourParent,6)  Enabled popups are: ("[CLASS:#32770]")
    1 point
  3. jdelaney

    IE Basic Task

    Look through the HTML source, and check if one of your nodes ancestors is a <Frame> or <iFrame>. If it is, in the loop you just posted, use: $oYourobject = _IEGetObjById($oFrame,"yourNameYouWantToGet")
    1 point
  4. Glad to help you!
    1 point
  5. First, I need to say "compile" (in fact, it's not compile at all, I often use another word "build to .exe") a script will do 3 jobs: Include any #include file to a larger script. Compress & Tokenize that script. Embed autoit3.exe to the "compiled" file The side effect is: Since autoit3.exe is embeded directly to .exe file, then the script will run with the exactly version you want. So no need to care about AutoIt is installed or not or "script breaking changes" when update to newer version of AutoIt. The .au3 need 1 line: #include , when the .exe include entire the filename.au3 into it. Plus additional space for autoit3.exe file, so yes, the size of the .exe file is sure larger than the .au3 file. When not "compile", autoit3.exe interprete the .au3 file, line by line. No additional memory is used. When "compile", the .exe file load both the autoit3.exe AND the tokenized script into memory. Easily guess, the "compiled" file will eat more memory. Execute the "compiled" file is totally NOT slower than the "uncompiled". And also, not at the same speed. In fact, the "compiled" file is far fasted. That is, because when not "compile", the autoit3.exe need to read the script file line by line in STRING form, uncompressed. But when "compile", it only need to read the compressed & tokenized data, which is both SMALLER & in a FAMILIAR structure with the computer. It's not make sense with small script. Try to execute a script with a/many loop(s), and use Timer function to benchmark, you will get the result! Editing the .au3 file is easy, but it may be a rick! In the opposite, editing .exe file is impossible (I don't count the option of decompile it, edit the decompiled script and recompile). Use additional resources (ex: image or music files) is far easier with .au3 form. When "compile", you need far more step to get the resources embeded to .exe file and retrieved correctly. Let me try to sum up: = Pros of uncompiled script = Uncompiled file is more space saver, memory saver than the compiled. Uncompiled file is easy to edit/change. Uncompiled file is easy to use additional resources file. = Pros of compiled script = Compiled file give you capability to run your script in another computer which AutoIt is not installed. Compiled file makes you do not need to care about script breaking after update to newer version of AutoIt. Compiled file beats un-compiled file entirely in executing script. Compiled file give you better sign about what you've done is right or wrong. When things go wrong, with the .exe you will get a MessageBox, with the .au3 and SciTe you will get an error message in output window of SciTe. But you run the .au3 by right click/double click, so no error messages. = Tie = You can both execute compiled .exe and un-compiled .au3 script with a simple double-click. But you need to enable this option when installing AutoIt. But in your case, I think it's no reason to "compile" to .exe file.
    1 point
  6. There is NO priority. They must match both.
    1 point
  7. _Excel_RangeRead already returns @error = 5 and _Excel_RangeWrite returns @error = 4 when Excel sets an error raised by the Transpose method.
    1 point
  8. Tools -> Trace add trace lines
    1 point
  9. You put a lot of time and effort into writing that post, so it's only fair that I do the same in a reply. But I can't think of anything else to say, except for padding the post out a bit. I could tell you the story about when my nana got a jelly fish stuck to her face, or the time I thought I was dreaming, but it turned out I really was in class without my pants on, but that would be more padding out of the post. Tell us your endgame, because your description could mean anything.
    1 point
  10. This will grab all the controls, and output them with enough data to help you find the control...there are also filters (I just added them recently) to get only a certain class of control...or only visible controls...or containing some text string: #include <Array.au3> #include <WinAPI.au3> ConsoleWrite("Make your window active!" & @CRLF) Sleep(5000) GetAllWindowsControls(WinGetHandle("[ACTIVE]")) Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible=Default, $sStringIncludes=Default, $sClass=Default) ; Get all list of controls If $bOnlyVisible = Default Then $bOnlyVisible = False If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 If StringLen($sClass)>0 Then For $i = UBound($aClassList)-1 To 0 Step - 1 If $aClassList[$i]<>$sClass Then _ArrayDelete($aClassList,$i) EndIf Next EndIf For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf If StringLen($sStringIncludes) > 0 Then If Not StringInStr($text, $sStringIncludes) Then $iTotalCounter += 1 ContinueLoop EndIf EndIf If IsArray($aPos) Then ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] IsVisible=[" & $bIsVisible & "] Text=[" & $text & "]." & @CRLF) Else ConsoleWrite("Func=[GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF) EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next EndFunc ;==>GetAllWindowsControls
    1 point
  11. AZJIO

    My Notepad

    My Notepad v0.4 (En, Ru) Black theme My_Notepad.7z (560kb sources + EXE) I wanted to make an example for the help file. But I could not stop, and made more complicated.
    1 point
  12. UEZ

    WMI help

    Try this short variant: Global $objItem, $UUID Global $usr = "" Global $pass = "" Global $srv = "localhost" Global $objWMILocator = ObjCreate("WbemScripting.SWbemLocator") Global $objWMIService = $objWMILocator.ConnectServer($srv, "\root\cimv2", $usr, $pass, "", "", "&H80") Global $colItems = $objWMIService.ExecQuery("SELECT UUID FROM Win32_ComputerSystemProduct", "WQL", 0x30) If IsObj($colItems) Then For $objItem In $colItems $UUID = $objItem.UUID Next MsgBox(0, "UUID", $UUID) EndIf Br, UEZ
    1 point
  13. this is what i use you can eliminate sendmessage to get checked state by using LVN_ITEMCHANGED NMLISTVIEW struct use GetItemState* or LVN_ITEMCHANGED to get state added martins replacement state image icons to example martin, i think the problem your having is the image index is set by SetItemStateImage, but not the state value (8192 or 4096) in _GUICtrlListView_SetItemStateImage i dont think you need SetItemStateImage once you change the imagelist, just use _GUICtrlListView_SetItemChecked *for on demand checkbox state: use _GUICtrlListView_GetItemState($hWndFrom, $iItem, $LVIS_STATEIMAGEMASK) instead of _GUICtrlListView_GetItemChecked to get checkbox state (less code - one sendmessage instead of struct and sendmessage) returns 8192 for checked or 4096 for unchecked #Include <GUIConstantsEx.au3> #Include <GUIListView.au3> #Include <WindowsConstants.au3> #include <GuiImageList.au3> Opt('MustDeclareVars', 1) Global $State, $Button, $ListView, $hListView GUICreate('MyGUI', 280, 391) $ListView = GUICtrlCreateListView('', 10, 10, 260, 344, BitOR($LVS_DEFAULT, $LVS_NOCOLUMNHEADER), $WS_EX_CLIENTEDGE) $hListView = GUICtrlGetHandle(-1) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_CHECKBOXES, $LVS_EX_DOUBLEBUFFER, $LVS_EX_INFOTIP)) _GUICtrlListView_InsertColumn($hListView, 0, '', 234) $Button = GUICtrlCreateButton('OK', 105, 361, 70, 23) Global $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110) _GUICtrlListView_SetImageList($hListView, $hImage, 2) For $i = 1 To 5 _GUICtrlListView_AddItem($hListView, 'Item' & $i) Next _GUICtrlListView_SetItemChecked($hListView, 1, 1) _GUICtrlListView_SetItemChecked($hListView, 2, 1) _GUICtrlListView_SetItemChecked($hListView, 4, 1) ConsoleWrite('+ ItemState 4 = ' & _GUICtrlListView_GetItemState($hListView, 4, $LVIS_STATEIMAGEMASK) & @crlf ) GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY') GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $IDFrom, $Code, $tNMLISTVIEW, $iItem $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $Code = DllStructGetData($tNMHDR, "Code") ;$IDFrom = DllStructGetData($tNMHDR, "IDFrom") Switch $hWndFrom Case $hListView Switch $Code Case $LVN_ITEMCHANGED $tNMLISTVIEW = DllStructCreate($tagNMLISTVIEW, $lParam) $iItem = DllStructGetData($tNMLISTVIEW, "Item") If BitAND(DllStructGetData($tNMLISTVIEW, "Changed"), $LVIF_STATE) = $LVIF_STATE Then Switch DllStructGetData($tNMLISTVIEW, "NewState") Case 8192 ;item checked ConsoleWrite('Item ' & $iItem & ' - ' & True & @CR) Case 4096 ;item unchecked ConsoleWrite('Item ' & $iItem & ' - ' & False & @CR) EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
    1 point
×
×
  • Create New...