Leaderboard
Popular Content
Showing content with the highest reputation on 06/06/2017 in all areas
-
Hi all, This is how far I am now before releasing a new version : - added CLR Constants.au3 - Danyfirex - Global Constants added (Magic numbers) - added .NET CLR CreateObject vs ObjCreate Example.au3 - Junkew - 2 approaches give the same result (only valid for COM Visible Assembly) - Includes a function that shows you which Assembly Classes are COM Vissible or not. - added .NET CLR CreateComInstanceFrom Example - Danyfirex - You can use it for Regfree COM Assembly Access - System.Activator has 4 methods : • CreateComInstanceFrom : Used to create instances of COM objects. • CreateInstanceFrom : Used to create a reference to an object from a particular assembly and type name. • GetObject : Used when marshaling objects. • CreateInstance : Used to create local or remote instances of an object. - added .NET Access SafeArrays Using AccVarsUtilities Example - LarsJ - added SafeArray Utilities functions in Includes - LarsJ - added .NET Access Native MSCorLib Classes - System - ptrex Multiple System Class Examples : - System.Random - System.DateTime - System.Diagnostics.PerformanceCounter - System.IO.FileInfo - System.Int32 - System.Double - System.Speech - System.Web - added Third Party Assembly Access - ptrex - WinSCP : https://winscp.net/eng/download.php - IonicZip : http://dotnetzip.codeplex.com/2 points
-
@steveeye Just to point you in the right direction: https://www.sitepoint.com/12-amazing-jquery-tables/2 points
-
_Service_UDF v4 : Build your own service with autoit code
cramaboule reacted to arcker for a topic
I can't be responsible for any impact of your script or services you would run in production. | _Services_UDF v4 | | By Arcker | Run your script as a service | Req. AutoIt 3.3.8.1 min, last beta recommended ( tested in 3.3.9.21 ) |_______________________________________ ++ Preparing v5 !! Checked on 27/04/2015 <> Updated on 10/23/2013 <> Updated 07/29/2013 <> Best practices Updated 24/02/2012 -- Removed GUI code, and old codes. == Warning : 26/02/2012 <> New Version (v3 ) : 29/07/2013 | Thx to ShminkyBoy, wraithdu, Udgeen and HolmesShelock for their great contributions. Special thx to bitboy, Downloads see end of this post : ServiceExample_v4, Services.au3, ServicesConstants.au3 Presentation Here is my _Service _ UDF With this UDF, you can compile your autoit script and run it as service. Any comments are welcome. Hope you'll like it, 1 - changelog Update V4 : 23/10/2013,27/04/2015 Update : V3 on 29/07/2013 Compile the service example to see how to do then you can use the main function for your proper scriptChoose an appropriate location and copy the script here.open a command prompt, and execute the compiled script with option –I ( must be admin right since vista )start / execute "services.msc" . You will see a service called "Autoit_service". you can execute "sc query" in a command prompt too.Launch it : it will run the previous compile script. The main function will be executed after the service_init.stop and relaunch the service as you wish. Examples / Session Change / uses v1 (lock, logon, etc) By HolmesShelock. Awesome work. Edit : this example doesn't use v2 or v3 method SessionChange Service.zip Example output to give you an idea Examples demos Synoptic And for End Users, I've tried to explain the service control manager and the way it works with programs. see below Best Practice, by arcker : /! please read this if you encounter stability issues I've had to rework on services.au3 to reflect threadsafe. Threadsafe means each dll call must be on "dllopened" instead of calling dll directly for example, if you need a function in kernel32.dll, you have to open it and call it after. That's contraignant since a lot of integrated functions in autoit are not programmed this way. If you take my services.au3, at the end, you'll see reworked function to handle this change. I've not tried services for a while, since i don't need it for now, but i can help you only if your provide whole script, to see how you call every functions. I can tell that fix stability issues in callback, but i don't think it's need for your script, as far as you don't use callback. Best Practice, by udgeen : Good news! Probably i've found the working method of integrating service.au3 with other projects I realised it after ASock.au3 project by Zatorg (please, sorry if im wrong) - ASock is asynck socket - tcp on event (uses ws2_32.dll). Asock & sqlite didnt work together. The only reason for that was..._ArrayDisplay() func with gui!!! Ok. I made special sqlite.au3 without dependences. It works, but my udf seemed too be much heavy to use at another project. Few weeks ago I returned to service.au3 and found TCP UDF, Event driven project based on ASock.au3. It seemed to work as example, but didn't work at all as service. In my variant of service_example.au3 i posted msdn words about service_main procedure, that it must contain all global vars of project I'll try to post that project as an another service_example.au3 in some weeks here. If it will works. Some advice: use SysInternals Process Explorer (free gui based), or kill.exe from support tools to stop suspended service process. U can start-stop service even net start/net stop commands. Use file logging while debuging. No need to install-uninstall service after every recompilation: only stop, recompile, start. See, if it was suspended (while stopping) - kill process. The only reason not to stop service correctly i've found for today is unclean exit: opened sockets, maybe some dlls. Edit : Arcker note: too bad, that would be too easy. unclean exit is not due to opened dll, but by some more internal exit checks or something. FAQ. 1 - Hey, I've got error 1063 or error 0, what does that mean ? It simply means that you intend to run your script in scite or directly by executing it. Your script has to be installed as service and run from it. Several ways to do it : You have to combine all Globals in one place: for example at the the begining. You have to make it with other udfs too... silly workThen sort Global Const and other Global statements. If u see something like global $x = 1 do that way: global $x leeve at top. $x =1 insert into module's (udf or project) Init func.U have to do it even with standart udf... or use only necessary functions from it in your own include. Or... maybe u have another plan?Try to build your project with modified udfs - does it works now? Hmm... But it have to Maybe later after everything will work fine i'll say "msdn is wrong, microsoft lies"... But maybe i'll say that microsoft - is not so bad, because autoit works in itnet start "yourservicename"Services.mscUse API provided _Service_start, Service_stop. 2 - I want to make a GUI ! It's not possible in a service. Create another process and communicate with your service by using IPC. 3 - I've to let the main function that way ? That's contraignant. Hey, a script intended to run as service is special no ? Autoit is not C++. The only way to have a "Main" in autoit is to have a function. If you find another way, please share it ServiceExample_ThreadSafe.au3 Services.au3 ServiceExample_v4.au3 ServicesConstants.au31 point -
_Service_UDF v4 : Build your own service with autoit code
cramaboule reacted to dexto for a topic
In v4 there is a bug in services.au3: Case $SERVICE_CONTROL_STOP,$SERVICE_ACCEPT_SHUTDOWN ; new in v4, stop when system shutdown ( better mmm ? ) https://msdn.microsoft.com/en-us/library/windows/desktop/ms683241(v=vs.85).aspx should be: Case $SERVICE_CONTROL_STOP,$SERVICE_CONTROL_SHUTDOWN ; new in v4, stop when system shutdown ( better mmm ? )1 point -
Try ... GUISetState(@SW_SHOW) Sleep(3000) GUICtrlSendMsg($iPic, 0x0172, 0, 0) ;should delete previous image _Image_to_pic(_Playpng(), $iPic) ...1 point
-
Restarting a While Loop based on Buttons Pressed in the MSGBOX
SkysLastChance reacted to Subz for a topic
Here is another way you could also try: #include <Array.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $g_hCombo Global $g_aCombo[3][2] = [["Server1", "\\Server1\Share"], ["Server2", "\\Server2\Share"], ["Server3", "\\Server3\Share"]] Example() Func Example() Local $hGUI = GUICreate("(UDF) ComboBox Create", 400, 296) $g_hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296) GUICtrlSetData($g_hCombo, _ArrayToString($g_aCombo, "|", -1, -1, "|", 0, 0)) GUISetState() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $hWndFrom, $iIDFrom, $iCode, $iMsgBox $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $iIDFrom Case $g_hCombo Switch $iCode Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box $iMsgBox = MsgBox(6,'Server Selected', "Selected Location: " & GUICtrlRead($g_hCombo) & @CRLF & "Share Name: " & $g_aCombo[_GUICtrlComboBox_GetCurSel($g_hCombo)][1]) If $iMsgBox = 11 Then ;~ Continue was selected ;~ Code to be executed goes here EndIf ;~ Either Cancel or Try Again was selected EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND1 point -
1 point
-
How about the _ChooseColor function in the Misc.au3 UDF that comes with AutoIt?1 point
-
Generate all numbers between x and y
thenight944 reacted to water for a topic
Looks good as soon as you add a "Next" statement to close the loop.1 point -
Can't get InputBox with custom Height horizontally centered
Christian Blackburn reacted to anthonyjr2 for a topic
;Needed to get usable screen area #include <WinAPI.au3> ;$Usable_Screen_Area[3] = screen height minus the taskbar on the current screen which may or may not have a taskbar Local $Usable_Screen_Area = _GetDesktopArea() ;The M2 means a 1-2 character value is required, $Usable_Screen_Area[3] is the screen's height minus the taskbar if there's a taskbar on the current screen $Response = InputBox("Simulator", "Please enter the index you'd like to simulate?" & @CR & $Options, "", " M2", -1, $Usable_Screen_Area[3],Default, 0) Have you tried this? I can't really test it because I don't have the desktop area part of your code. EDIT: I tested it, seems to work.1 point -
Process Suspend/Process Resume UDF
GeneNight reacted to The Kandie Man for a topic
Well, I was looking on the internet for ways to suspend processes and spent a great deal of time trying to find API commands to do this. I found many thread suspend functions and other things, but not really any process suspend functions. I finally found a process suspend NTAPI function NtSuspendProcess(). To my great distaste I could find absolutely nothing documenting the NTAPI functions, nothing at all. Hours of Googling and i finally found a page that has the NTAPI functions listed. No thanks to Microsoft. :S You would think they would document functions that they took the time to write so that people could actually use them. To save others time, here is a page with the NTAPI functions listed: http://www.metasploit.com/users/opcode/syscalls.html Here is a UDF to call the system API to suspend or resume a process. No more systeminternals 104kb PsSuspend.exe. Func _ProcessSuspend($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid) $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) If IsArray($i_sucess) Then Return 1 Else SetError(1) Return 0 Endif Else SetError(2) Return 0 Endif EndFunc Func _ProcessResume($process) $processid = ProcessExists($process) If $processid Then $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid) $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0]) DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle) If IsArray($i_sucess) Then Return 1 Else SetError(1) Return 0 Endif Else SetError(2) Return 0 Endif EndFunc @The Development Team I think it would be a good idea to add these to the process.au3 include file. You can call the function with the process name or PID _ProcessSuspend("notepad.exe") or _ProcessSuspend(467) The returns are as follows: 0 = Failure 1 = Sucess @error = 1 means that it failed because something errored when calling the dll @error = 2 means that it failed because the process was not found or is not running Sorry i didn't do a standard UDF writeup, didn't have time. If the development team is interested in adding this function i will happily write the standard UDF documentation for it. Important: This function will only run on Windows XP, Windows 2003 and Windows Vista.1 point