Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/24/2017 in all areas

  1. I want to present BETA Version of my ADO.au3 UDF. This is modifed version of _sql.au3 UDF. For that I want to thanks : ; Chris Lambert, eltorro, Elias Assad Neto, CarlH This is first public release , and still is as BETA DOWNLOAD LINK (in download section): Have fun, mLipok EDIT: 2016-06-03 Below some interesting topics about databases: EDIT 2016/07/04: For more info about ADO look here: https://www.autoitscript.com/wiki/ADO FOR EXAMPLE DATABASE use AdventureWorksDW2016_EXT.bak from: https://github.com/microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorksDW2016_EXT.bak I will relay on this database in my examples. Here is link to post which shows how "ODBC Data Source Administrator" looks like.
    1 point
  2. WHAT : is .NET Common Language Runtime (CLR) Framework The Common Language Runtime (CLR) is a an Execution Environment . Common Language Runtime (CLR)'s main tasks are to convert the .NET Managed Code to native code, manage running code like a Virtual Machine, and also controls the interaction with the Operating System. As part of Microsoft's .NET Framework, the Common Language Runtime (CLR) is managing the execution of programs written in any of several supported languages. Allowing them to share common object-oriented classes written in any of the languages. HOW : To access the CLR environment you need to create an Appdomain Object - _CLR_GetDefaultDomain() An AppDomain provides an isolated region in which code runs inside of an existing process. Application domains provide an isolation boundary for security, reliability, and versioning, and for unloading assemblies. Application domains are typically created by runtime hosts, which are responsible for bootstrapping the common language runtime before an application is run. WHEN : Would you use CLR Runtime Hosts 1. To access .NET Class Libraries : System System.Collections System.Data System.Drawing System.IO System.Text System.Threading System.Timers System.Web System.Web.Services System.Windows.Forms System.Xml 2. Accessing custom build .Net Assemblies : Some Examples (but there are a ton out there) AutoItX3 - The .NET Assembly for using AutoItX JSonToXML libr. XMLRPC Libr. .NETPDF libr. .NETOCR Libr WInSCP Libr. ... 3. To Compile .Net Code into an Assembly 4. To Run C# or VB.net Code 5. To Mix AU3 and .Net functionality in your Application WHERE : To find documentation about CLR First of all you can find a lot on MSDN and here : Post 4 & Post 6 EXAMPLES : Multiple examples included in Zip !! Example : “System.Text.UTF8Encoding” Example : “System.IO.FileInfo” Example : “System.Windows.Forms” Example : AutoItX3 Custom .NET Assembly AutoItX Example : Compile Code C# and Code VB Example : Compile Code C# at Runtime WHO : Created the CLR.au3 UDF All credits go to : Danyfirex / Larsj / Trancexx / Junkew TO DO : The library is still Work in Process … (Some of the GUI Controls are not yet working as expected...) Anyone is free to participate in contributing to get the bugs resolved and to expand the CLR.au3 functionality ... Enjoy !! DOWNLOADS : (Last updated) - 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 Visible - added .Net Conventional COM Objects Examples - ptrex - 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/ - added more Examples using PowerShell GUI Assembly Access - ptrex • GUI Ribbon .NET Assembly using  CLR Library • GUI Report Designer .NET Assembly using  CLR Library • GUI SSRS Reporting .NET Assembly using  CLR Library CLRv3a.zip .NET CLR Framework for AutoIT.pdf
    1 point
  3. The colon at the end of the first line is ":" rather than ":" which when viewed in Asci comes out as ":". If you paste this comment in Windows 7 WordPad (Windows 10 appears to ignore it) you'll get the same behavior.
    1 point
  4. Ah i think i get it now ^^' In case window names gives you too much trouble, i suggest enumerating the windows and getting windows belonging to the PID. I suggest doing this: #include <WinAPIProc.au3> #include <Array.au3> $a = _WinAPI_EnumProcessWindows(@AutoItPID, False) _ArrayDisplay($a); see all windows from PID MsgBox(0, "AutoIt v3 window array position", _ArraySearch($a, "AutoIt v3")) Exit Hope this helps you
    1 point
  5. The BOF test is only sensible if you use anything but forward-only cursor (cursor = 0). It may look smart to "benefit" from seemingly-free up-down cursors so to be able to step forward or backward within the resultset, but one must fully understand what that means in practice. I must admit that over time I've changed my opinion about cursortype != 0 All in all, to be a portable and efficient (behind the scene) ADO wrapper, I now personally advocate for cursortype = 0 exclusively, removing the need for BOF test at the same time.
    1 point
  6. Subz

    Run(Wait) failures

    Not sure why you have an carriage return in your string and also not sure about your quotes, have you tried: RunWait(@ComSpec & ' /c stripcat.exe scandataF.dta', "<Path to stripcat.exe>") Or RunWait(@ComSpec & ' /c "<Path to Stripcat.exe>" "<Path to ScanDataF.dta"') Or ShellExecute("Stripcat.exe", "scandataF.dta")
    1 point
  7. Subz

    GUICtrlRead() fails

    Couple of ways, you could use a Radio or ComboBox as a control, which makes the user select Long or Short. Also after the $collectLS = GuiCtrlRead($SampleLS) you can use something like: $collectLS = GUICtrlRead($SampleLS) Switch $collectLS Case "Long" Case "Short" Case Else MsgBox(0, "Selection", "Please Select Long/Short") ContinueLoop EndSwitch
    1 point
  8. LerN

    GUICtrlRead() fails

    $collectLS = GUICtrlRead($SampleLS)
    1 point
  9. Subz

    GUICtrlRead() fails

    Your reading the label not the input.
    1 point
  10. Now I see why, in the following link : https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/bof-eof-properties-ado I found this: This description was misleading (at least for me), as this is clearly stated here:
    1 point
  11. As suggested by Jos in the previous link from genius257 it works using a workaround #include <SciteConstants.au3> WinActivate("[CLASS:SciTEWindow]", "") $Sci = ControlGetHandle("[CLASS:SciTEWindow]", "", "[CLASS:Scintilla; INSTANCE:1]") $str = "ContinueLoop" ;"CLASS" $len = StringLen($str) $txt = ControlGetText("[CLASS:SciTEWindow]", "", "[CLASS:Scintilla; INSTANCE:1]") $start = StringInStr($txt, $str)-1 SendMessage($Sci, $SCI_SETSEL, $start, $start+StringLen($str)) Sleep(50) $line = SendMessage($Sci, $SCI_LINEFROMPOSITION, $start, 0)+1 Msgbox(0,"", $line) Func SendMessage($hwnd, $msg, $wp, $lp) Local $ret $ret = DllCall("user32.dll", "long", "SendMessageA", "hwnd", $hwnd, "int", $msg, "int", $wp, "int", $lp) If @error Then Return SetError(1) Return $ret[0] EndFunc ;==>SendMessage
    1 point
  12. @Skysnake change this line: ElseIf $oRecordset.bof = -1 And $oRecordset.eof = True Then ; no current record to this: ElseIf $oRecordset.bof And $oRecordset.eof Then ; no current record And try again your testing script.
    1 point
  13. I do like the idea of being able to open a second editor jumping to the function I need. Sounds convenient. Perhaps a future implementation in the SciTE editor.
    1 point
  14. You could just make the button link to the _Connect function? #include <GUICONSTANTS.AU3> #include <WINDOWSCONSTANTS.AU3> #include <STATICCONSTANTS.AU3> #include <EDITCONSTANTS.AU3> #include <MISC.AU3> #include <GuiEdit.au3> #include <WinAPI.au3> #include <DATE.au3> ; =============================================================================================================================== ; Global constants ; ========================================================================================================================== Opt('GUIoneventmode', 1) $GUIStyle = BitOR($WS_DLGFRAME, $WS_POPUP, $WS_VISIBLE) $GUIStyleEx = BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE) $EditStyle = BitOR($ES_MULTILINE, $WS_VSCROLL) $EditStyleEx = BitOR($EditStyle, $ES_READONLY) $W = 0xFFFFFF $B = 0x0 $Titleb = 0x7F7F7F TCPStartup() $0 = 0 $00 = 0 $000 = 0 Global $sIpAddress = "Default" Global $iPort = 1000 Global $Socket = -1 ;Makes the servers IP address... default is your @IPADDRESS1. ;Makes the port # can be anything between 1 and 60000. ;(the maximum is a guess i don't know how many ports there are butits close). ;and ONLY if the port is not already being used. ;MUST BE SERVER OPENED PORT NOT ONE ON YOUR COMPUTER!!! Global $GUI = GUICreate("FarC0nn3c7", 500, 400, -1, -1, $WS_SIZEBOX) Global $idHelpMenu = GUICtrlCreateMenu("Knowing you are better than what people say about you is a key to success--JIBRIL STURNA-----") Global $lblServer = GUICtrlCreateLabel("Server:", 2, 14, 52, 20, $SS_RIGHT) Global $inpIp = GUICtrlCreateInput($sIpAddress, 56, 10, 200, 20, $SS_LEFT) Global $lblPort = GUICtrlCreateLabel("Port:", 270, 14, 52, 20, $SS_Left) Global $inpPort = GUICtrlCreateInput($iPort, 296, 10, 194, 20, $SS_LEFT) Global $btnReconnect = GUICtrlCreateButton("Connect", 230, 32, 60, 20) Global $edtConsole = GUICtrlCreateEdit('', 0, 70, 350, 200, $EditStyleEx) Global $edtMsg = GUICtrlCreateEdit('Hello server', 0, 280, 350, 70, $EditStyle) GUICtrlSetLimit($edtMsg, 250) GUICtrlSetState($btnReconnect, $GUI_DISABLE) GUICtrlSetOnEvent($btnReconnect, _Connect) GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit', $GUI) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) GUISetState() HotKeySet('{ENTER}', '_Send') GUISetBkColor(0x99CC00) While 1 _Recv_From_Server() Sleep(100) WEnd Func _Connect() For $0 = 0 To 10 $Socket = TCPConnect($sIpAddress, $iPort) ;Connects to an open socket on the server... If $Socket <> -1 Then ExitLoop TCPCloseSocket($Socket) Sleep(300) Next If $Socket = -1 Then _Exit() TCPSend($Socket, @UserName & '^EXAMPLE DATA') GUICtrlSetData($btnReconnect, "Reconnect") EndFunc ;==>_Connect Func _Send() $0 = GUICtrlRead($edtMsg) If $0 = '' Then Return TCPSend($Socket, $0) GUICtrlSetData($edtMsg, '') EndFunc ;==>_Send Func _Recv_From_Server() $Recv = TCPRecv($Socket, 1000000) If $Recv = '' Then Return _GUICtrlEdit_AppendText($edtConsole, _NowTime() & ' -- ' & $Recv & @CRLF) EndFunc ;==>_Recv_From_Server Func _Minn() WinSetState($GUI, '', @SW_MINIMIZE) EndFunc ;==>_Minn Func _Exit() TCPCloseSocket($Socket) TCPShutdown() Exit EndFunc ;==>_Exit ; #FUNCTION# ==================================================================================================================== ; Name...........: _ValidIP ; Description ...: Verifies that an IP address is a valid IPv4 address or not ; Syntax.........: _ValidIP($sIP) ; Parameters ....: $sIP - IP address to validate ; ; Return values .: Success - True ; Failure - False, sets @error ; |1 - IP address starts with an invalid number = 0, 127 , 169 or is > 239 ; |2 - one of the octets of the IP address is out of the range 0-255 or contains invalid characters ; |3 - IP Address is not a valid dotted IP address (ex. valid address 190.40.100.20) ; Author ........: BrewManNH ; Modified.......: InunoTaishou: Return False instead of -1 on error and return True if valid IP address ; Remarks .......: Class A networks can't start with 0.xx.xx.xx. 127.xx.xx.xx isn't a valid IP address range. 169.xx.xx.xx is reserved and is invalid ; and any address that starts above 239, ex. 240.xx.xx.xx is reserved and should never be used or seen out in "the wild". ; The address range 224-239 1s reserved as well for Multicast groups but can be a valid IP address range if you're ; using it as such. ; This will validate an IP address that is 4 octets long, and contains only numbers and falls within valid IP address values. ; Anything else sent to it should fail the test and return -1. ; Related .......: ; Link ..........: _GetIP ; Example .......: No ; Topic .........: https://www.autoitscript.com/forum/topic/133593-ipv4-validator-function/ ; =============================================================================================================================== Func _ValidIP($sIP) $Array = StringSplit($sIP, ".", 2) If Not IsArray($Array) Or UBound($Array) <> 4 Then Return SetError(3, 0, False) $String = "0x" If $Array[0] <= 0 Or $Array[0] > 239 Or $Array[0] = 127 Or $Array[0] = 169 Then Return SetError(1, 0, False) EndIf For $I = 0 To 3 If $Array[$I] < 0 Or $Array[$I] > 255 Or Not StringIsDigit($Array[$I]) Then Return SetError(2, 0, False) EndIf Next Return True EndFunc ;==>_ValidIP Func _ValidPortNumber(Const $iPort) Return ($iPort >= 0 and $iPort <= 65535) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local Static $iTimer = Null Local $sReadValue = Null Local $iCtrlId = _WinAPI_LoWord($wParam) Switch (_WinAPI_HiWord($wParam)) Case $EN_CHANGE ; Sent when the user has taken an action that may have altered text in an edit/input control $sReadValue = GUICtrlRead($iCtrlId) Switch ($iCtrlId) Case $inpIp If (_ValidIP($sReadValue)) Then $sIpAddress = $sReadValue GUICtrlSetState($btnReconnect, $GUI_ENABLE) Else GUICtrlSetState($btnReconnect, $GUI_DISABLE) EndIf Case $inpPort If (_ValidPortNumber($sReadValue)) Then $iPort = Number($sReadValue) GUICtrlSetState($btnReconnect, $GUI_ENABLE) Else GUICtrlSetState($btnReconnect, $GUI_DISABLE) EndIf EndSwitch ; Could also auto connect right here if both the IP Address and Port are valid EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
    1 point
  15. Couple of days ago I had to copy several hundred GB to a new Server and used the following, without a problem. _FileCopy($sSource, $sTarget, 784) ;=============================================================================== ; ; Function Name: _FileCopy() ; Description: Copies Files and/or Folders with optional animated Windows dialog box ; Parameter(s): $pFrom - Source files/folders to copy from ; $pTo - Destination folder to copy to ; $fFlags - [optional] Defines the flag for CopyHere action ; ; Option Flags: $FOF_DEFAULT = 0 Default. No options specified. ; $FOF_SILENT = 4 Do not display a progress dialog box. ; $FOF_RENAMEONCOLLISION = 8 Rename the target file if a file exists at the target location with the same name. ; $FOF_NOCONFIRMATION = 16 Click "Yes to All" in any dialog box displayed. ; $FOF_ALLOWUNDO = 64 Preserve undo information, if possible. ; $FOF_FILESONLY = 128 Perform the operation only if a wildcard file name (*.*) is specified. ; $FOF_SIMPLEPROGRESS = 256 Display a progress dialog box but do not show the file names. ; $FOF_NOCONFIRMMKDIR = 512 Do not confirm the creation of a new directory if the operation requires one to be created. ; $FOF_NOERRORUI = 1024 Do not display a user interface if an error occurs. ; $FOF_NORECURSION = 4096 Disable recursion. ; $FOF_SELECTFILES = 9182 Do not copy connected files as a group. Only copy the specified files. ; ; Requirement(s): None. ; Return Value(s): No return values per MSDN article. ; Author(s): Jos, commented & modified by ssubirias3 to create $pTo if not present ; Note(s): Must declare $fFlag variables or use their numeric equivalents without declaration. Use BitOR() to combine ; Flags. See http://support.microsoft.com/kb/151799 & ; http://msdn2.microsoft.com/en-us/library/ms723207.aspx for more details ; ;=============================================================================== Func _FileCopy($pFrom, $pTo, $fFlags = 0) If Not FileExists($pTo) Then DirCreate($pTo) $winShell = ObjCreate("shell.application") $winShell.namespace($pTo).CopyHere($pFrom, $fFlags) ;; or BitOR(16,512)) without declaration EndFunc
    1 point
  16. KaFu

    neutralize keystrokes?

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms644985(v=vs.85).aspx "If the hook procedure processed the message, it may return a nonzero value to prevent the system from passing the message to the rest of the hook chain or the target window procedure." If $wParam = $WM_KEYDOWN Then If DllStructGetData($tKEYHOOKS, "vkCode") = 65 Then ; "a" ConsoleWrite("+ ""a"" was pressed and not passed to the program" & @CRLF) Return 1 endif Else
    1 point
  17. exodius

    Clear input field on click

    How about using a variable to keep track of whether you've cleared it once, then clearing it everytime it gets focused, like this: #include <GUIConstants.au3> $Clear = 0 $Form1 = GUICreate("Form1", 242, 99) $Input1 = GUICtrlCreateInput("Enter ID", 40, 24, 121, 21) $btn1 = GUICtrlCreateButton ("Catches initial focus", 40, 70) GUICtrlSetState ($btn1, $GUI_Focus) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If _IsFocused ($Form1, $Input1) And $Clear = 0 Then GUICtrlSetData ($Input1, "") $Clear = 1 ElseIf $Clear = 1 And Not _IsFocused ($Form1, $Input1) Then $Clear = 0 EndIf WEnd Func _IsFocused($hWnd, $nCID) Return ControlGetHandle($hWnd, '', $nCID) = ControlGetHandle($hWnd, '', ControlGetFocus($hWnd)) EndFunc ;==>_IsFocused
    1 point
×
×
  • Create New...