Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/25/2016 in all areas

  1. jguinch

    Printers Management UDF

    Hello. I did create these few functions several months ago. I post here, if it can interest someone. These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code. Here is the list of the available functions : _PrintMgr_AddLocalPort _PrintMgr_AddLPRPort _PrintMgr_AddPrinter _PrintMgr_AddPrinterDriver _PrintMgr_AddTCPIPPrinterPort _PrintMgr_AddWindowsPrinterConnection _PrintMgr_CancelAllJobs _PrintMgr_CancelPrintJob _PrintMgr_EnumPorts _PrintMgr_EnumPrinter _PrintMgr_EnumPrinterConfiguration _PrintMgr_EnumPrinterDriver _PrintMgr_EnumPrinterProperties _PrintMgr_EnumPrintJobs _PrintMgr_EnumTCPIPPrinterPort _PrintMgr_Pause _PrintMgr_PortExists _PrintMgr_PrinterExists _PrintMgr_PrinterSetComment _PrintMgr_PrinterSetDriver _PrintMgr_PrinterSetPort _PrintMgr_PrinterShare _PrintMgr_PrintTestPage _PrintMgr_RemoveLocalPort _PrintMgr_RemoveLPRPort _PrintMgr_RemovePrinter _PrintMgr_RemovePrinterDriver _PrintMgr_RemoveTCPIPPrinterPort _PrintMgr_RenamePrinter _PrintMgr_Resume _PrintMgr_SetDefaultPrinter And some examples : #include <Array.au3> #include "PrintMgr.au3" _Example() Func _Example() ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @ScriptDir & "\Samsung5010", @ScriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers Local $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration Local $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers Local $aDriverList = _PrintMgr_EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _PrintMgr_AddLocalPort("c:\temp\output.pcl") ; Remove the local port _PrintMgr_RemoveLocalPort("c:\temp\output.pcl") ; Enum a print job Local $aJobList = _PrintMgr_EnumPrintJobs() _ArrayDisplay($aJobList) EndFunc ;==>_Example Download link : PrintMgr_Example.au3 PrintMgr.au3
    1 point
  2. In the forums you can find several questions about how to edit the text in a ListView cell with a standard control eg. an Edit control or a ComboBox. The zip below contains three examples with an Edit control, a ComboBox and a DateTimePicker. How? A description from MicroSoft of how to edit a ListView cell with a ComboBox can be found here. When you click a cell the position and size is calculated, and the ComboBox is created on top of the cell. The text is shown in the Edit box. You can edit the text or select a value in the Listbox. Press Enter to save the text in the ListView cell and close the ComboBox. The ComboBox exists only while the text is edited. Code issues Especially because the control to edit the ListView cell is created on top of the ListView and is not part of the ListView, there are some issues you should be aware of. To get everything to look as good as possible most actions should be carried out when a mouse button is pressed and not when it's released. You should also be aware that the new code you add, does not conflict with existing functionality for example multiple selections. The examples consists of small but fairly many pieces of code to respond to events and messages. Keyboard support To edit a text value you are more or less forced to use the keyboard to type in the text. It would be nice if you could also select the current cell in the ListView with the keyboard. Cell selection with the keyboard is not too hard to implement with custom draw code. The current cell is drawn with a specific background color. It looks like this. You can select the current cell with the arrow keys. Open the control There must be a way to initiate the creation of the control. This is typically done with a single or double click in the ListView. Or with Enter or Space key in the examples with keyboard support. Default in the examples is double click and Enter key. You can change this in global variables in top of the scripts. A WM_NOTIFY message handler created with GUIRegisterMsg is used to watch for single and double click in the ListView. This message handler is also used to handle custom draw messages for keyboard support. Because the control is created on top of the ListView cell, it's very important that the ListView is set as the parent window. This ensures that mouse clicks and key presses are captured by the control and not by the ListView. Events in the control In a ComboBox and a DateTimePicker an additional control (Listbox and MonthCal, respectively) is opened if you click the Dropdown arrow (or press <Alt+Down arrow> on the keyboard). Click the Dropdown arrow again to close the control (or press <Alt+Up arrow> on the keyboard). The interesting messages (DROPDOWN, SELECTION, CLOSEUP) from such an additional control are usually contained in WM_COMMAND or WM_NOTIFY messages which are sent to the parent window. The parent window is the ListView. To catch the messages the ListView must be subclassed. Messages from the Edit control, the Edit box of the ComboBox, or the client area of the DateTimePicker are catched by subclassing the controls (Edit control, Edit box and DateTimePicker) directly. The interesting information here is dialog codes to accept (Enter) or cancel (Esc) the value and close the control. Dialog codes are sent as $WM_GETDLGCODE messages. In all examples the value in the control can also be accepted and saved with a double click. Close the control A mouse click in the ListView outside the control should close the control and cancel editing of the current cell. Because the control is not part of the ListView in particular mouse clicks on the Scrollbars should close the control immediately. The control will not be repainted properly on scrolling. Mouse clicks in the ListView and on Scrollbars can be identified by WM_LBUTTONDOWN and WM_NCLBUTTONDOWN messages. The area which is filled by Scrollbars in a ListView is non-client area. Mouse clicks in non-client area generates WM_NCLBUTTONDOWN messages. To catch the messages you have to subclass the ListView. A mouse click in the GUI outside the ListView and in non-client GUI area (eg. the Titlebar) should also close the control. Mouse clicks in GUI are catched through GUI_EVENT_PRIMARYDOWN messages. Mouse clicks in non-client GUI area are catched through WM_NCLBUTTONDOWN messages by subclassing the GUI. Finish the code A great part of the code is running in message handlers created with GUIRegisterMsg or created by subclassing a window. Lengthy code to open or close the control should not be executed in these message handlers. Instead of a message is sent to the AutoIt main loop where the control is opened or closed. Some of the message handlers are only needed while the control is open. They are created and deleted as part of the control open and close code. In the context of the updates May 26 the $LVS_EX_HEADERDRAGDROP extended style (rearranging columns by dragging Header items with the mouse) is added to all ListViews. See post 20 and 21. A few lines of code are added to better support usage of the keyboard. See image above. The code provides for horizontal scrolling of the ListView to make sure that a subitem (or column) is fully visible when it's selected with left or right arrow. Among other things, the code takes into account rearranging and resizing of columns as well as resizing of the GUI and ListView. A new example EditControlKeyboardTenCols.au3 demonstrates the features. See post 22. A few lines of code is added to handle multiple selections. Multiple selections is enabled in all examples. Pressing the Tab key in the control closes the control. The image shows a DateTimePicker control. Zip file The zip contains three examples with an Edit control, a ComboBox and a DateTimePicker. For each control there are two scripts with and without keyboard support. In the script with keyboard support you can select the current cell in the ListView with the arrow keys and open the control with the Enter (default) or the Space key. You need AutoIt 3.3.10 or later. Tested on Windows 7 32/64 bit and Windows XP 32 bit. Comments are welcome. Let me know if there are any issues. (Set tab width = 2 in SciTE to line up comments by column.) ListViewEditingCells.7z
    1 point
  3. abdulrahmanok, Then I suggest you ask your college to give you the permissions that will allow you to test. Even if your intentions are purer than the driven snow, we are not going to help produce something which could be used by less honourable persons for nefarious purposes. Thread locked. M23
    1 point
  4. ...echo ...echo...echo...
    1 point
  5. I personally use Desktop Info: http://www.glenn.delahoy.com/software/ It's still on the desktop but I have it on the top right side, most users know how to minimize applications or click the desktop button. Main reason I use it is what info it can display, I have Machine Name, Logged in User, Last reboot time, IP Address, and Serial Number (On laptops also Battery %) It lets user get me an IP not just a machine name as often they are just connected via VPN or some other device and have not updated in the DNS server. Once I do connect, I can see all the info I need for warranty lookup, ask the user if they rebooted already and clearly see if they are telling the truth, etc. If the desktop is an issue, maybe instead of trying to bring your information to a new place, create an easier way for them to get to the desktop. Windows can use Win+D hotkey to give focus to desktop, press again to bring it back. If you want to use Autoit stuff try WinMinimizeAll() WinMinimizeAllUndo() put that into a script with a tiny always on top GUI button that flips between the two. Another would be an always on top disappear on mouse over GUI, this was ripped from somebody else's example code I just changed it from saying "Hover Me" to show the computer name. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPIGdi.au3> Global $hGUI = GUICreate("Ghost", 100, 50, @DesktopWidth - 100, 0, $WS_POPUP, $WS_EX_TOPMOST) GUISetBkColor(0x808080) Global $iLbl = GUICtrlCreateLabel(@ComputerName, 10, 10) GUICtrlSetColor(-1, 0xFFFFFF) GUISetState() AdlibRegister("HoverChk", 50) Do Until GUIGetMsg() = -3 AdlibUnRegister("HoverChk") GUIDelete() Func HoverChk() Local $iFadeIn = 8, $iFadeOut = 64 Local Static $iTransparency = 255 Local $aPos = WinGetPos($hGUI) If _WinAPI_PtInRectEx(MouseGetPos(0), MouseGetPos(1), $aPos[0], $aPos[1], $aPos[2] + $aPos[0] + 1, $aPos[3] + $aPos[1] + 1) Then If $iTransparency >= 0 Then $iTransparency -= $iFadeOut $iTransparency = $iTransparency < 0 ? 0 : $iTransparency WinSetTrans($hGUI, "", $iTransparency) EndIf Else If $iTransparency <= 255 Then $iTransparency += $iFadeIn $iTransparency = $iTransparency > 255 ? 255 : $iTransparency WinSetTrans($hGUI, "", $iTransparency) EndIf EndIf EndFunc
    1 point
  6. abdulrahmanok, Are you trying to get around your college's security policy? Before anyone offers any help, please explain in more detail why you need to do this. M23
    1 point
  7. You could compile this and pin it to the taskbar: MsgBox(0, "", @ComputerName)
    1 point
  8. when you generate the IP ranges, you should consider the subnet mask, you are instead supposing that exists only this mask 255.255.255.0. Your loop to spawn ping commands is a bit messy... (also, running many ping.exe is not multithreading) If you are interested, you could have a look here for a code that uses a similar way to spawn pings and that works correctly..
    1 point
  9. ... try this: #include <IE.au3> ; ---------------------------------------------------------------------- ; Main ; ---------------------------------------------------------------------- $oIE = _IECreate("http://www.york.ac.uk/teaching/cws/wws/webpage1.html") WinSetState("", "", @SW_MAXIMIZE) $oElement = _IETagNameGetCollection($oIE, 'H4', 0) MouseMove($oElement.getBoundingClientRect().left + $oIE.document.parentwindow.screenleft, $oElement.getBoundingClientRect().top + $oIE.document.parentwindow.screentop) MsgBox(0, "", "Let's scroll the webpage 200 pixels down", 2) $oIE.document.parentwindow.scroll(0, 200) MouseMove($oElement.getBoundingClientRect().left + $oIE.document.parentwindow.screenleft, $oElement.getBoundingClientRect().top + $oIE.document.parentwindow.screentop) MsgBox(0, "", "caught!", 2) $oElement.style.setAttribute('border', '5px solid red') ; draw a red border (just for fun)
    1 point
  10. Just remember, when you use _ArrayDisplay if you have more than 65525 files/folders it will only display up to that many rows of the array.
    1 point
  11. I've learned so much from the AutoIt community and figured it is about time I start giving something back. I am open sourcing all my software and Complete Internet Repair is the first program I am releasing. Complete Internet Repair will give you a free option to attempt to repair everything internet related. With any repair utility, you will need to remember only two golden rules. Firstly; don't try to repair something that is not broken, you might break it. Secondly; Comnplete Internet Repair cannot repair it all, we are not like the all-seeing and all-knowing Oracle, we cannot anticipate each and every situation, but this all said; it should be able to help with most internet issues. Complete Internet Repair could help if you are experiencing any of the following problems: Internet or network problem after removing adware, spyware, virus, worm, Trojan horse, etc. Loss network connection after installing/uninstalling adware, spyware, antispam, vpn, firewall or other networking programs. Unable to access any website or can only access some websites. Pop-up error window with network related problem description. No network connectivity due to registry errors. DNS lookup problem. Fail to renew the network adapter’s IP address or other DHCP errors. Network connectivity issue with limited or no connections message. Windows update does not work. You are having problems connecting to secured websites (ex. Banking). Internet Explorer stopped working or crashes all the time. A few other internet errors, but we will not discuss all here. Update 22 October 2016 Exes are now signed. New installation utility. Now built on the ReBar Framework. New Update Notification System. Resources moved to external Dll files. Added support for Windows 10. New Interface. New Logging System. New Reset Rroxy Server Configuration. New Registry based Method for configuring Services. Cleaner Optimized Code. You can download Complete Internet Repair 3 and Source Code at: http://www.rizonesoft.com/downloads/complete-internet-repair/ The source code can be viewed on GitHub here. Please while you're there, give it a Star! Please let me know what you think and if you have any suggestions, I would love to hear about it.
    1 point
  12. Iczer

    FreeImage Library

    You can use my port FreeImage UDF to both x64/x86 - its working with latest v3.17.0.0 DLLs. default names for dlls: "FreeImage_x64.dll" "FreeImage_x86.dll"
    1 point
  13. Here is a even short way: #include <GUITreeView.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Tree", 300, 300, 300, 300) Local $idTreeview = GUICtrlCreateTreeView(3, 3, 300, 300, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $hTreeView = GUICtrlGetHandle($idTreeview) Local $idAppItem = GUICtrlCreateTreeViewItem('button', $idTreeview) GUICtrlSetOnEvent($idAppItem,"treeViewPress") GUISetState(@SW_SHOW, $hGUI) Func manager() While 1 WEnd EndFunc manager() Func treeViewPress() ConsoleWrite(_GUICtrlTreeView_GetText($hTreeView, _GUICtrlTreeView_GetSelection($hTreeView)) & @CRLF) EndFunc
    1 point
  14. Hey guys, This might have been asked already but i'd like to have an updated answer on this subject! Compiling an exe of an "hello world" autoit script gives a result of a 300 KB file. Is there any way to make it lighter? Thanks in advance for your answers!
    1 point
×
×
  • Create New...