Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/08/2015 in all areas

  1. anony10, Next time please post the solution you found rather deleting the OP - that way someone else might benefit when searching. M23
    3 points
  2. 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
  3. The little assembly code posted >here by Tekk to count how many @LF there are in a string is very fast. It can be easly modified to count any other char instead of only a @LF in this way: #include <Memory.au3> Local $sString, $char For $i = 1 To 100000 $sString &= "This line is line " & $i & @CRLF Next $char = "i" MsgBox(0, 'Count of "' & $char & '"', 'There are ' & StringCountChar($sString, $char) & ' occurrences of the char "' & $char & '"') Func StringCountChar(ByRef $g_sString, $sCHR) Local $pCountLF = _MemVirtualAlloc(Null, 25, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) $sCHR = StringLeft($sCHR, 1) DllStructSetData(DllStructCreate("BYTE[25]", $pCountLF), 1, "0x" _ & "8B4C2404" _ ;~ mov ecx, dword[esp+04h] & "31C0" _ ;~ xor eax, eax & "8A11" _ ;~ @@:mov dl, byte[ecx] & "80FA00" _ ;~ cmp dl, 00h & "7409" _ ;~ je @f & "41" _ ;~ inc ecx & "80FA" & Hex(Asc($sCHR), 2) _ ;~ cmp dl, NNh <-- modified here & "75F3" _ ;~ jne @b & "40" _ ;~ inc eax & "EBF0" _ ;~ jmp @b & "C20400" _ ;~ @@:ret 4 ) Local $nResult = DllCallAddress("INT", $pCountLF, "STR", $g_sString)[0] _MemVirtualFree($pCountLF, 0, $MEM_RELEASE) Return $nResult EndFunc ;==>StringCountChar That's all. edit: added ByRef to $g_sString in function
    1 point
  4. #include <ScreenCapture.au3> Example() Func Example() Local $hBmp ; Capture full screen $hBmp = _ScreenCapture_Capture("") ; Save bitmap to file _ScreenCapture_SaveImage(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hBmp) ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example The $hBmp = _ScreenCapture_Capture("") is the part you are missing? EDIT So maybe try: Case $msg = $Screen $hBmp = _ScreenCapture_Capture("") $Screen = _ScreenCapture_SaveImage(@DesktopDir & "new_screenshot.jpg", $hBmp)
    1 point
  5. Please look again at the help file entry for _ScreenCapture_SaveImage. The second parameter ($hBitmap) is required, and you would get this from _ScreenCapture_Capture(). That is why you're getting the error. As for the _ScreenCapture_Capture continuing until you close the GUI, can you explain your methodology? It looks as though you are calling it if the GuiGetMsg() equals $Screen, yet that variable is simply a GuiCtrlCreatePic. Your posted code is not runnable without a lot of modification, so can you please explain your intent? Are you expecting the user to click on the pic you create to do a screenshot, or did you intend them to click on a button?
    1 point
  6. Times HAVE changed. I grew up in a time where you actually had to ride your bicycle to the library to look up something in a book, which you in turn had to look up using some sort of enormous rolodex. Where you had to actively and secretly search for your father's porn stash (which your and your friends' fathers invariably hid behind that stack of 33 1⁄3 rpm LP records in that dusty hallway shelf ) Where it was normal to type in 20 pages of BASIC code from a magazine into your TRS-80 to play an ascii-based hangman. Where you needed to fold open a big paper map to fumble your way over an unknown road. Etc.. Right now, you just clicketyclick everything into one of your magical machines and blammo, you get everything you ask for on your billions-of-colors multimonitor setup and store it on your SSD that easily reads or writes TWO BILLION bits of data per damn second. While watching free full-hd youtube on the other monitor. And still there are many people who think even that's too much work. Until that point I agree with guiness and jchd. Laziness and expecting something-for-nothing indeed runs rampant. BUT... Many things still take a lot reading and effort to puzzle out before you're able to reach your own goal. The power of the technology grows and evolves, but so do the possibilities to use it and the goals to reach with it, and so does the veritable ocean of information you have to wade through before you get the actual information 1. applicable to your question and 2. written in just that way that hits your spot. Some people are much more capable of that wading than others, and some more people get turned off by that and give up altogether. Weakness/laziness? Perhaps, often even, but it's also often just a question of getting lost in that ocean just because it looks or feels intimidating. Different things come easily to different people. In this case, you'll notice that Kor never asked for anyone to code anything for him, and he posted the code that he tried. He has obviously already tried to use information available elsewhere. Those are the only two things that everyone clamors for on this forum when someone misforms a question. He asked for information on a very specific piece of functionality, which to me looks suspiciously much like someone who IS actually willing to learn something. So, to facilitate that, both me and Jake did our best to come up with an explanation(s) we thought could actually help. I don't understand what's so wrong with that. Sorry for the long story again. I should really go to bed. Have a nice day all
    1 point
  7. Threads like this why I love to read the forums even without specific questions or anything
    1 point
  8. I whould do same But i wont make the total code for them since they have to learn. The variable declaration is a basic.
    1 point
  9. if you mean to the script user's have to not set this up after each script run you have to store it differently. Somthing like in a INI file then here you have to use a differente way ... You can keep the modified exemple of the help file like this (AND ADD An INIWRITE in the exemple function : ) Func SelectFolder() ; Create a constant variable in Local scope of the message to display in FileSelectFolder. Local Const $sMessage = "Select a folder" ; Display an open dialog to select a file. Global $sFileSelectFolder = FileSelectFolder($sMessage, "") If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No folder was selected.") Else ; Display the selected folder. MsgBox($MB_SYSTEMMODAL, "", "You chose the following folder:" & @CRLF & $sFileSelectFolder) Global $WhereisFolder = IniWrite ($SettingsFile, 'Folder', 'Location', $sFileSelectFolder ) EndIf EndFunc Plz watch how to use IniFile in the Helpfile you dont got all info here. But check this line : Global $WhereisFolder = IniWrite ($SettingsFile, 'Folder', 'Location', $sFileSelectFolder ) Ps : I am just helping your logic. You have to add much more lines of code to make this work, but you got at least, a way to do what you want depending on witch way you gonna choose.
    1 point
  10. i build my scripts with onevent tuned on, my loop which keeps gui alive is very short, and its easy to add ton of controls and add functionality to them with ease. try and learn here: https://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm
    1 point
  11. jchd

    Shortened S-Box

    I doubt you'll get that answered here because AES as well as other cryptographic and hashing operations are more conveniently invoked at higher level thru the support provided by the OS, hiding gory details such as IV, S-boxes, a.s.o. I understand you have an assignment to implement AES by yourself. To partly answer the question asked you have alternative choices: use an AutoIt structure: Local $tSBox = DllStructCreate("byte[256]") and access individual bytes with DllStructGetData($tSBox, 1, 5) to get the 5th byte. use a binary variable: Local $bSBox = Binary("0x637C777BF26B6FC5300167 ... 0FB054BB16") and use BinaryMid to get to bytes. Since efficiency is ruled out by using a scripting language in the first place, you can select the data structure which offers the most convenient operations and from this point of vue the array of bytes posted is probably simpler to work with: accessed by $abSBox[5]. Also keep in mind what this gives: VarGetType($abSBox[5])
    1 point
  12. Hi argumentum, You can avoid "#include <Alert.au3>. And here is the link of HotKey_21b.ay3 by yashied
    1 point
  13. I thought Windows 9 moved to Windows 10? As it supports the tech preview called Windows 10. I doubt Microsoft are going to support a tech preview which I outdated.
    1 point
  14. It makes sense though that the Windows tools that indicate the version are modified by compatibility mode, right? To "fool" applications that base checks on the windows version... But indeed: https://msdn.microsoft.com/en-us/library/windows/desktop/ms724451%28v=vs.85%29.aspx: [GetVersionEx may be altered or unavailable for releases after Windows 8.1. Instead, use the Version Helper APIs] ... on to the version helper apis: https://msdn.microsoft.com/en-us/library/windows/desktop/dn424972(v=vs.85).aspx Nice suite of functions. Doesn't seem to support Windows 9 tech preview, but maybe you can use the "goalkeeper-function" IsWindowsVersionOrGreater: BOOL WINAPI IsWindowsVersionOrGreater( WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor );
    1 point
  15. Turtlix21, I suggest reading the Managing Multiple GUIs tutorial in the Wiki - that explains how to deal with this problem. M23
    1 point
  16. spudw2k

    Disabling a checked checkbox

    Here are another couple of ideas to chew on. Depending on what your requirements really are (which I'll bet you'll want to firm up) the following will do what you asked for. Here I created a simple function ("OKTicked") that each checkbox will fire when clicked. It simply checks the state of the checkbox that fired the func and if it is checked it disables the checkbox control. Rather than adding a GUICtrlSetOnEvent after the creating of each checkbox I opted to use another func for the Checkbox Ctrl creation.) And in this example I used an Array to hold the "labels' for each checkbox and then create them in a loop. I'd imagine these are a bit too simple for what you really want to accomplish, but at least it hopefully gives you some ideas/insight. I would think you want some sort of hierarchy when it comes to clicking the checkboxes...like they must be performed in order. In that case, it would be easy to check if the previous checkbox is checked or not. You will want to use an array for that to hold the CtrlIds of the checkboxes like Mikah showed. There are many ways to skin a cat. edit: Grammar
    1 point
  17. I'm not sure whether you want 24 hour format or not, For me doing this: #include <date.au3> MsgBox(0,"",_Now()) Returns this: 5/24/2008 12:17:15 AM If this were 24-hour format it would say 00:17:15 i believe
    1 point
×
×
  • Create New...