Jump to content

Search the Community

Showing results for tags 'Activate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 5 results

  1. Hi there! 😃 I've 2 simple scripts: Script 1 starts script 2 Script 1 gets executed with normal user rights (un-elevated) Script 2 contains an #RequireAdmin and therefor can only start elevated I want to read the output of script 2 with script 1 AND have the UAC of script 2 being activated as fullscreen Script 1 (Scripts location is the same as script 2 that I'm running with Run() Local $iPID, $sOutput $iPID = Run(@ComSpec & " /c " & "C:\Entwicklung\Autoit\Test\Temp.exe", @ScriptDir, @SW_HIDE, 0x2) ProcessWaitClose($iPID) $sOutput = StdoutRead($iPID) StdioClose($iPID) ConsoleWrite($sOutput) MsgBox(1, 1, 1) Script 2 (compiled as Temp.exe) #RequireAdmin ConsoleWrite("Return") MsgBox(1,1,"ADMIN") Now my problems are the following: Without the #RequireAdmin I can read the output with no problem, but not with the #RequireAdmin ($sOutput is empty) Using @SW_HIDE in the Run() command makes the UAC always start minimized (see attached picture) and the admin has to always manually click on the icon to enter his credentials since the UAC doesn't start in fullscreen. Here and on a few other sites they explain that the program launching the elevated program NEEDS to be activated in order to directly show the UAC fullscreen and not minimized. Using @SW_SHOW would get rid of the problem, BUT that leaves me with an ugly cmd.exe floating the whole time while the elevated script ist running. And my questions to that I'm seeking an answer for are: Problem 1: Is it just not possible to read from an elevated program with an un-elevated user/script? I also get the Access Denied if I press No on the UAC as an Output in $sOutput (Guess since its's still un-elevated) Problem 2: Is there a way to either make the floating black and blank cmd.exe being moved to the background and be non visible to the user OR to somehow bring the minimized UAC to the foreground/fullscreen? What I already tried and what didn't help me: $iPID = Run(@ComSpec & " /c " & "C:\Entwicklung\Autoit\Test\Temp.exe", @ScriptDir, @SW_HIDE, 0x2) While Not WinExists("Temp.exe erfordert Ihre Berechtigung") ConsoleWrite(1) WEnd WinActivate("Temp.exe erfordert Ihre Berechtigung") WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_SHOW) WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_MAXIMIZE) WinSetState("Temp.exe erfordert Ihre Berechtigung", WinGetText("Temp.exe erfordert Ihre Berechtigung"), @SW_ENABLE) The While-Loops helps a lot and also stops after a second or so (► Stops to write ones (1)). That means that the actual "window" of the UAC is found, but all the WinXXX functions don't do anything and the UAC stays minimized. I also tried to minimized/move the cmd.exe to the background with WinActivate() and WinSetState() with no success. $iPID = ShellExecute("C:\Entwicklung\Autoit\Test\Temp.exe", "", @ScriptDir, "open", @SW_HIDE) Using ShellExecute() instead of Run() completely solves the UAC to fullscreen problem BUT I haven't found a consistent way to read the output of ShellExecute(). Neither here on the forum nor somewhere else. If I'd be possible to read the output from ShellExecute() then all my problems would be solved at once! Also tried a few more things and playing with some parameters but everything with no success. I'd really love some help and support here from you. Thanks in advance!
  2. Hello, I'm trying to be able to switch back and forth between multiple excel spreadsheets and I can't seem to get the WinActivate function to work, and bring the desired window the be the active window. Could I please get some assistance, I've tried a few things and nothing seems to work quite right. Below is a test case where I'm just trying to make the first excel sheet that was opened become the active window, and testing it by grabbing a cell value off that workbook. The message box produces the correct answer if both files are closed before running but the 2nd test file will appear to be the active window. If the code is run again without closing the excel files, nothing works (file does not appear to be active and message box will not give an answer). #include <Excel.au3> Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase ;Open Test1 Excel Workbook local $oExcel = _Excel_open() Local $ofile = @ScriptDir & "\test1.xlsx" Local $oWorkbook = _Excel_BookOpen($oExcel,$ofile) ;Open Test2 Excel Workbook local $mExcel = _Excel_open() Local $mfile = @ScriptDir & "\test2.xlsx" Local $mWorkbook = _Excel_BookOpen($mExcel,$mfile) ; This workbook is completely blank WinActivate($oWorkbook); should make Test1 the active window local $read1 = _Excel_RangeRead($oWorkbook,Default,"B2"); Cell B1 in Test1 workbook contains the word Test MsgBox(0,0,$read1);Should returns the word test
  3. Hi, iam not able to "activate" (the blue border of the edit control should be displayed) the created input control when clicking on a listview item. All i want is, when the edit control is created, it's active (blue border displayed) and you can directly write in it (cursor at the end), but i can't get it work. Can someone help? #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> #include <Misc.au3> Global $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work Global $bChanged = False, $hDLL = DllOpen("user32.dll") Global $aClick_Info[2] Global $hListView, $hTmp_Edit Global $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) ; Add items _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button Local $iIndex, $iSubItem, $sTmp_Text, $aRect, $aPos $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $iIndex = DllStructGetData($tInfo, "Index") $iSubItem = DllStructGetData($tInfo, "SubItem") ; make sure user clicks on the listview & only the activate If $iIndex <> -1 And Not $bChanged Then $bChanged = True Local $iTimer = TimerInit() Local $iCounter = 1 Local $DOUBLE_CLICK_TIME_DELTA = 1200 While 1 If _IsPressed("01", $hDLL) Then $iCounter+=1 ConsoleWrite("_IsPressed - clicked." & @CRLF) ; Wait until key is released. While _IsPressed("01", $hDLL) WEnd ConsoleWrite("counter: " & $iCounter & " timer: " & TimerDiff($iTimer) & @CRLF) EndIf If $iCounter = 2 And TimerDiff($iTimer) < $DOUBLE_CLICK_TIME_DELTA Then ConsoleWrite("yes." & @CRLF) ExitLoop EndIf If TimerDiff($iTimer) > $DOUBLE_CLICK_TIME_DELTA Then ConsoleWrite("over." & @CRLF) $bChanged = False Return 1 EndIf WEnd GUICtrlDelete($hTmp_Edit) $aClick_Info[0] = $iIndex $aClick_Info[1] = $iSubItem ;~ GUISetAccelerators($aAccelKeys) $sTmp_Text = _GUICtrlListView_GetItemText($hWndListView, $iIndex, $iSubItem) ConsoleWrite("item: " & $iIndex & " subitem: " & $iSubItem & " text: " & $sTmp_Text & @CRLF) If $iSubItem = 0 Then $aRect = _GUICtrlListView_GetItemRect($hWndListView, $iIndex, 2) Else $aRect = _GUICtrlListView_GetSubItemRect($hWndListView, $iIndex, $iSubItem) EndIf $aPos = ControlGetPos("", "", $hWndListView) ConsoleWrite("Information :" & StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", $aRect[0]+ $aPos[0], $aRect[1]+ $aPos[1], $aRect[2], $aRect[3]) & @CRLF) $hTmp_Edit = GUICtrlCreateEdit($sTmp_Text, $aRect[0] + $aPos[0], $aRect[1] + $aPos[1], $aRect[2] - $aRect[0], $aRect[3] - $aRect[1], 0) GUICtrlSetState($hTmp_Edit, $GUI_FOCUS+$GUI_SHOW+$Gui_ontop) _GUICtrlEdit_SetSel(GUICtrlGetHandle($hTmp_Edit), 2, 15) EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY
  4. I wrote this power user tool a long while back and it originally had baked in commands and wasn't very extensible. I rewrote the tool and made use of the power and openeness of AutoIt. Some of you may find the concept and/or UI approach interesting (as well as useful) which is why I'm posting here. In all likely-hood, it could be rewritten entirely in AutoIt but that's not something I plan on doing. Good chance there are similar tools out there as well especially since I've sat on this for so long. In short, the tool provides a snazzy user interface (no two interfaces will look alike) which opens right over whatever your working on so you can quickly launch any number of chained AutoIt scripts. My all-time favorite being; normalize clipboard text. https://winclickpro.codeplex.com/ I haven't shared the tool or concept with anyone outside of publishing it so I'm curious to see what people think.
  5. I recently managed to make a ListView sort correctly by clicking on it's columns, it does sort items very well but there's a very annoying thing >_< : every time after the items are sorted out, an item gets focused ! After I click a column, one item gets blue'd, like when its selected, even if its not ! Note that this happens only becuase of this function : _GUICtrlListView_SimpleSort Instead, the _GUICtrlListView_SortItems function is not doing this , but because of my luck,I must use _GUICtrlListView_SimpleSort ( but it is faster ) Here's my script to test to see what I mean: #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> $Form1 = GUICreate("Form1", 383, 307, 192, 124) $ListView1 = GUICtrlCreateListView("C1|C2|C3", 56, 16, 257, 241) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50) $ListView1_0 = GUICtrlCreateListViewItem("1|5|6", $ListView1) $ListView1_1 = GUICtrlCreateListViewItem("2|7|8", $ListView1) $ListView1_2 = GUICtrlCreateListViewItem("3|9|10", $ListView1) $ListView1_3 = GUICtrlCreateListViewItem("4|11|12", $ListView1) GUISetState(@SW_SHOW) Global $toggle = 1 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ListView1 _GUICtrlListView_SimpleSort($ListView1, $toggle, GUICtrlGetState($ListView1)) EndSwitch WEnd How could I get rid of this item focus ?
×
×
  • Create New...