Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/17/2015 in all areas

  1. Most of the files in AutoIt are digitally signed (installer and components). In the last few releases concern was raised that as AutoIt3.exe was signed it could fool someone into running a #requireadmin script because the UAC prompt says "hey this file is signed". Obviously this only applies to uncompiled files that are distributed with the AutoIt3.exe file. A digital signature is in no way saying that a file is safe. It just verifies where it comes from. The VBscript/PowerShell exes in Windows are signed so maybe I should resign the AutoIt3.exe? Discuss. I'm doing a 3.3.14.2 release today or tomorrow to fix a couple of nasty bugs. So...
    2 points
  2. Some ADO (ODBC) drivers error out on .GetRows when the resultset is empty (your case). Bracket this part with test: ... $RecordSet = $Connection.Execute($Select) If Not $RecordSet.EOF Then $Data = $RecordSet.GetRows ... Else ; recordset is empty Dim $Data[0][0] ; or some other suitable code EndIf
    2 points
  3. BugFix version - 27 Dec 23 Fixed: No default value set for the MaxWidth parameter - took 12 years for someone to notice it! New UDF and new examples below and in zip. I just realised that although I have posted versions of this UDF many times in Help topics, I had never actually posted a "final" version here in Example scripts - better late than never, I suppose! StringSize takes a text string and calculates the size of label required to hold it as well as formatting the string to fit. Now AutoIt will, of course, size a label automatically to fit a text string, but it will not format the string in any way - what you use as the string is what you get in the label. If you do set any label sizes the text will be wrapped, but you can only determine the correct size of the label by trial and error. StringSize will, however, reformat the string to fit in a given width and tell you the required height so that you can read it all - whatever the font type or size - and you do not have to do the formatting beforehand. Here is a simple example to show what I mean (you need the UDF in the same folder for all the examples): And here is an example showing how StringSize can deal with different fonts and text sizes: You can see that the GUI is perfectly sized each time and that the button is always the right size and in the right place. StringSize returns an array which contains the formatted text to display and the size of the label needed to display it. All you need to do is to use the array elements when you create your label. Try changing the values in $aFont and $aSize if you want to try you own favourites - but beware, StringSize will return an error if you make the size so large that it cannot fit a word into the label width. NEW A more complex example showing how formatted and unformatted text can be sized correctly. The width of GUI holding the unformatted text varies randomly in width (the current value is displayed at top right): NEW And a final example showing how you can get your text in the largest possible font to fit in a given space: Finally here is the UDF itself: And all 5 files in zip format: StringSize.zip I hope you find this useful - I certainly do. M23
    1 point
  4. ProgAndy

    AutoItObject UDF

    The AutoItObject team is proud to announce that the first version of our AutoItObject UDF is complete and ready to use. The project page is located at [currently missing] Please, report bugs and any other issues at our [currently missing], and not here. An overview of all the functions can be found in the online documentation [currently missing] or in the offline .chm documentation file which is included with the [currently missing]. If Origo has problems providing the download, the current version will be mirrored here The UDF requires the current AutoIt version v3.3.4.0! AutoItObject 1.2.8.2.exe AutoItObject 1.2.8.2.zip Please, leave your comments and experiences here. Regards, - trancexx - ProgAndy - monoceres - Kip Our work is published under the Artistic License 2.0 A copy of the FAQ to answer your most urgent questions right away: (can also be found at the online documentation: Some helper-functions: When using the Wrapper, this are some simple methods to get a return value from the resulting array. ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOResult ; Description ...: Returns the return value of the Call to a WraperObject function ; Syntax.........: _AIOResult(Const $aResult [, $vError=0] ) ; Parameters ....: $aResult - the resulting array ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Returnvalue ($aResult[0]) ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOResult(Const $aResult, $vError=0) ; Author: Prog@ndy If IsArray($aResult) Then Return $aResult[0] Return SetError(1,0,$vError) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOParam ; Description ...: Returns the parameter value of the Call to a WraperObject function ; Syntax.........: _AIOParam(Const $aResult, $iParam, $vError=0) ; Parameters ....: $aResult - the resulting array ; $iParam - The parameterindex to return (0: result, 1: first parameter, 2: 2nd parameter, ...) ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Parameter value ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOParam(Const $aResult, $iParam, $vError=0) ; Author: Prog@ndy If UBound($aResult)-1 < $iParam Then Return SetError(1,0,$vError) Return SetExtended($aResult[0], $aResult[$iParam]) EndFunc
    1 point
  5. Here is a complete example of combining Autoit with PHP and MySQL was written by me. Include: Sign in, sign out.Create, read, update and delete data between client (AutoIt) and server (PHP/MySQL).Only allow user to log into a client at the same time. Video demo: https://www.youtube.com/watch?v=gQyfXLO0pls Screenshot (Main GUI) Usage If you want to test on your computer, you will need to create a localhost. I recommend to use WAMP or XAMPP. First, create a new database by importing from SETUP.sql file (see video for more info). Then, edit your path to SERVER in AutoIt-PHP-MySQL.au3: Global Const $SERVER = 'http://localhost/AutoIt/index.php?act='Make sure you have copied all files in the folder "PHP + MySQL" into a folder named AutoIt in your Localhost (www or htdocs directory). Yeah, now you can open the file "AutoIt-PHP-MySQL.au3" and try it yourself! Default username and password is: admin Download: Tutorial-AutoIt-PHP-MySQL-v1.0.rar[Tutorial] AutoIt - PHP - MySQL v2.0.zip (Thank @JohnOne for having suggested using zip format)Changelog ----- Hope you enjoyed it!
    1 point
  6. Adele, Glad to hear it. You may be interested in _WinAPI_GetIdleTime. See the Help file. kylomas
    1 point
  7. 1 point
  8. Run the audio as a second script. Wait for the second script to terminate and then continue with the calling script.
    1 point
  9. Adele, A static control cannot accept keyboard input. One possible workaraound... #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("") ;A control to test the issue, GUIRegisterMsg starts not working after it was added local $lbl010 = GUICtrlCreateLabel("Test", 10, 10, 200, 200, $ss_sunken) guictrlsetstate($lbl010,$GUI_DISABLE) GUISetState() GUIRegisterMsg($WM_KEYDOWN, "KeyPress") While True $iMsg = GUIGetMsg() Switch $iMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func KeyPress($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite($wParam & ' - ' & $lParam & @CRLF) ;MsgBox(0, "", "A key has been pressed.") EndFuncNote - Please heed J1's observation about message handlers. The doc is very specific about their use. kylomas EDIT: Please read the forum rules regarding keyloggers.
    1 point
  10. Hi viswat88 when you redirect the i/o streams of an application (ws3270.exe in our case), you have: the big advantage that you can completely manage that application from your script, "subjugating" it to your needsthe little disadvantage that you completely lose the view of what's happening on the application's own screen.Because of point 2, you have to check what's going on, not with your eyes, but using script functions to peeking data and comparing with string functions for example. anyway, I agree that can be of help to see the output "screenshots" of the program for an easier and quicker feedback, though perhaps it is better to do the analysis of what you want to automate on the original program and then program the needed commands using the I/O streams and hide the black and useless screen of the program when is in I/O stream mode. Here is a minimalist listing that should help you to test the vs3270.exe against your 3270 host server. I've also included a "simulated" 3270 screen to check "visually" if the connection to 3270 was successful. If so you should see the 3270 welcome response to your connection request on the simulated screen. (Important note: when I issue a "connect" request, usually I get response after about 20-30 secs. Wait a little bit before you lose hope) Let us know what happens. #include <Constants.au3> #include <EditConstants.au3> ; -- this window will simulates a regular 3270 screen with rows and columns numbers on top and left edges as a quick reference --- Global $hCRT = GUICreate("3270 Output preview", 850, 505) GUICtrlCreateLabel("0 1 2 3 4 5 6 7" & @CRLF & _ "01234567890123456789012345678901234567890123456789012345678901234567890123456789", 33, 5, 820) GUICtrlSetFont(-1, 12, 400, 0, "courier new") GUICtrlCreateLabel(" 0" & @CRLF & " 1" & @CRLF & " 2" & @CRLF & " 3" & @CRLF & " 4" & @CRLF & " 5" & @CRLF & " 6" & @CRLF & _ " 7" & @CRLF & " 8" & @CRLF & " 9" & @CRLF & "10" & @CRLF & "11" & @CRLF & "12" & @CRLF & "13" & @CRLF & "14" & @CRLF & _ "15" & @CRLF & "16" & @CRLF & "17" & @CRLF & "18" & @CRLF & "19" & @CRLF & "20" & @CRLF & "21" & @CRLF & "22" & @CRLF & _ "23" & @CRLF & "24", 3, 44, 50, 500) GUICtrlSetFont(-1, 12, 400, 0, "courier new") Global $hEdit = GUICtrlCreateEdit("", 30, 40, 820, 465, $ES_READONLY) GUICtrlSetFont(-1, 12, 400, 0, "courier new") GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00FF00) GUISetState(@SW_SHOW) ; -------------------------------------------------------------------------------------------------------------------------------- ; run the ws3270 with some optional config parameters in I/O streams mode and hidden. Global $ws3270 = Run('3270\wS3270.exe -model 3278-2 -port 23', @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) ; -model 3278-2 --> 80 COLUMNS - 24 ROWS (columns-> 0-79 rows-> 0-23) ; StdinWrite($ws3270, "connect(10.192.254.181)" & @LF) ; try to connect to mainframe ; $status = GetStatus() ; wait the response from the host and get response in $status ScreenShot3270() ; "copy" the output of the 3270 real screen to the simulated 3270 screen MsgBox(0, 0, "Pause") ; pause before end StdinWrite($ws3270, "Disconnect" & @LF) ; use a safe logout from 3270 host (change this as required from your 3270 host) StdinWrite($ws3270) ; close stream GUIDelete($hCRT) ; delete window ; ------- ; THE END ; ------- ; ; this will get the output from 3270 (from ws3270 stdout stream) Func GetStatus($Print = 0, $timeout = 60) ; if $Print = 1 -> Print Status on console (for debug purpose) ; $timeout = max secs to wait response from host before setting error Local $timer = TimerInit() Local $sOut = "" Do $sOut = StdoutRead($ws3270, False, False) ; get output from 3270 stdout stream Sleep(100) If TimerDiff($timer) / 1000 > $timeout Then $sOut = "error: timeout " & Int(TimerDiff($timer) / 1000) & " sec." Return SetError(1, 0, $sOut) ; Exit EndIf Until $sOut <> "" ; stay here till a response (or timeout) If $Print Then ConsoleWrite($sOut & @CRLF) Return SetError(0, 0, $sOut) EndFunc ;==>GetStatus Func ScreenShot3270() ; print output to the 3270 simulated screen ; see how to use the Ascii function here: http://x3270.bgp.nu/Windows/wc3270-script.html ; Ascii without parameters will take the entire screen StdinWrite($ws3270, "Ascii()" & @LF) ; take a snapshod of the entire 3270 screen Local $sSnapShot = GetStatus() ; wait and get answer from host ; since the ascii function adds data: to the beginning of each line, i will remove it $sSnapShot = StringReplace($sSnapShot, "data: ", "") GUICtrlSetData($hEdit, $sSnapShot) ; put the snapshot to the simulated 3270 screen EndFunc ;==>ScreenShot3270
    1 point
  11. May I suggest the same as JO but using For $removeloop = UBound($aList)-1 To 1 step -1
    1 point
  12. It's Melba who did all the hard work really. It's good you tried to figure it out yourself.
    1 point
  13. NoizeBit, Excellent. M23
    1 point
  14. NoizeBit, Are you all set now? This works for me: #include <Array.au3> #include <File.au3> #include "M:\Program\Au3 Scripts\UDFs\ArrayMultiColSort\ArrayMultiColSort.au3" Global $aArray SortCSVLines() _ArrayDisplay($aArray, "", Default, 8) Func SortCSVLines() ;Sorts lines first by Expiry Time and then by Order Time ; Simulate reading file Global $aArray[][] = [ _ ["Instrument", "Type", "Asset", "Order #", "Order Time", "Invested", "Target Price", "Expiry Price", "Expiry Time", "Return"], _ ["High / Low", "Low", "AUD/USD", "36007202", "02-09-15 17:51:06", "24.00", "0.70351", "0.70414", "02-09-15 18:30:00", "0.00"], _ ["High / Low", "Low", "AUD/USD", "36007200", "01-09-15 17:45:03", "24.00", "0.70350", "0.70411", "02-09-15 18:30:00", "0.00"], _ ["High / Low", "Low", "NZD/USD", "36004443", "02-09-15 16:53:52", "24.00", "0.63465", "0.63534", "02-09-15 17:30:00", "0.00"], _ ["High / Low", "Low", "AUD/USD", "36004413", "02-09-15 16:53:20", "24.00", "0.70238", "0.70347", "02-09-15 17:30:00", "0.00"]] ; Set sort order Local $aSortData[2][2] = [[8, 0], [4, 0]] ; Sort array _ArrayMultiColSort($aArray, $aSortData, 1) EndFunc ;==>SortCSVLinesM23
    1 point
  15. No worries. You will notice I overlooked a couple of things in my first post. I'm a bit hung over - that's my excuse. ^^ Grab the modified code above.
    1 point
  16. Thanks for the fast reply, czardas! I see now what was missing, thanks for the contribution
    1 point
  17. yes, sign everything please. The people who blindly click on dialog boxes (and those that mistake signature for security) are not the target audience for that effort, they will manufacture ways to get owned all by themselves.
    1 point
  18. Does this do what you want? #include <Array.au3> #include <File.au3> #include <ArrayMultiColSort.au3> Global $sSourceCSV = @ScriptDir & "\test.csv" Global $sCSVContentSorted SortCSVLines() MsgBox(0, "", $sCSVContentSorted) Func SortCSVLines() ;Sorts lines first by Expiry Time and then by Order Time Local $aArray _FileReadToArray($sSourceCSV, $aArray, $FRTA_NOCOUNT, ",") Local $aSortData[2][2] = [[4, 0], [8, 0]] _ArrayMultiColSort($aArray, $aSortData, 1) For $i = 0 To UBound($aArray) - 1 ; first loop For $j = 0 To UBound($aArray, 2) - 1 ; second loop $sCSVContentSorted &= $aArray[$i][$j] & "," Next $sCSVContentSorted = StringTrimRight($sCSVContentSorted, 1) $sCSVContentSorted &= @LF Next ; There is no need to return a global variable because it has been modified in the global scope ;Return $sCSVContentSorted EndFunc ;==>SortCSVLinesEdit - I forgot to change the csv file name back to the original: try it now. Edit2- Removed $aArray to local scope where it belongs and fixed a small problem with the code. You might want to replace @LF with @CRLF
    1 point
  19. MirtexFR, Welcome to the AutoIt forums. I have amended the script a little to make it rather more structured: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $cNumber, $cBouton3, $idInfoItem ; needed as you create them inside functions If Not FileExists(@ScriptDir & "\License.txt") Then $hLicence = InetGet("http://www.gnu.org/licenses/gpl-3.0.txt", @ScriptDir & "\License.txt") InetClose($hLicence) EndIf $hGUI = GUICreate("Interface", 500, 650, -1, -1) Menu() GUICtrlCreateTab(10, 110, 480, 400) GUISetFont(9, 300) Tab() $cBouton1 = GUICtrlCreateButton("Yes", 35, 599, 100, 25) $cBouton2 = GUICtrlCreateButton("Exit", 375, 599, 100, 25) GUISetState(@SW_SHOW) While 1 ; Just use the one loop to look for events Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cBouton2 Exit Case $cBouton1 MsgBox(64 + 8192, 'Message', 'Vous avez cliqué sur le bouton OK') Case $cBouton3 ; Read the value $iNumber = Number(GUICtrlRead($cNumber)) ; Check it If $iNumber > 1000000 Then MsgBox(64, 'Error', 'The number cannot be high 1 000 000') ; Focus the input for easy editing GUICtrlSetState($cNumber, $GUI_FOCUS) EndIf EndSwitch WEnd Func Menu() $menu1 = GUICtrlCreateMenu("Option", -1, -1) $menu2 = GUICtrlCreateMenu("License", -1, -1) $idInfoItem = GUICtrlCreateMenuItem("Info", $menu1) EndFunc ;==>Menu Func Tab() GUICtrlCreateTabItem(" Log ") GUICtrlCreateTabItem(" Start Counter ") GUICtrlCreateLabel("Number :", 20, 153, 100, 20) $cNumber = GUICtrlCreateInput("Max 1 000 000", 85, 150, 150, 20) $cBouton3 = GUICtrlCreateButton("Save", 240, 147, 50) GUICtrlCreateTabItem("") ; You MUST close the tab creation sequence EndFunc ;==>TabPlease ask if you do not understand what I have done or why I have done it. M23
    1 point
  20. sHarma, People are trying to help - responding like that is not going to help your case. Why not post the page link? What harm can it do? If you want help, offering as much information as possible is usually a good idea. M23
    1 point
  21. LarsJ

    plus

    Sorry, I couldn't help it. #include <GUIConstantsEx.au3> Opt( "MustDeclareVars", 1 ) Example(31) ; Number of check boxes, 2 - 31 Func Example( $iCbs ) ; $iCbs = number of check boxes, 2 - 31 GUICreate( "Calculate check boxes", 250, 10+30*Int(($iCbs-1)/3)+60 ) Local $idCbFirst = GUICtrlCreateCheckbox( "2^0", 10, 10, 70, 20 ) For $i = 1 To $iCbs - 1 GUICtrlCreateCheckbox( "2^" & $i, 10+80*Mod($i,3), 10+30*Int($i/3), 70, 20 ) Next GUICtrlCreateLabel( "", 10, 10+30*Int(($iCbs-1)/3)+30, 230, 20, 0x12 ) ; 0x12 = $SS_ETCHEDFRAME Local $idSum = GUICtrlCreateLabel( "0 (0x" & Hex(0,8) & ")", 12, 10+30*Int(($iCbs-1)/3)+32, 226, 16 ) GUISetState() Local $iMsg, $iSum While 1 $iMsg = GUIGetMsg() Switch $iMsg Case $idCbFirst To $idCbFirst + $iCbs - 1 $iSum = 0 For $i = 0 To $iCbs - 1 $iSum += 2 ^ $i * ( GUICtrlRead( $i + $idCbFirst ) = $GUI_CHECKED ) Next GUICtrlSetData( $idSum, $iSum & " (0x" & Hex(Int($iSum), 8) & ")" ) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc
    1 point
  22. zxtnt09, Use the line continuation operator: $label1 = GUICtrlCreateLabel( _ "Learning learning blab blab blab " & _ "learning learning blab blab blab ; i need to type many lines", _ 410, 55, 80, 25)But your label is far too small to hold the text - you might want to look at my StringSize UDF (the link is in my sig) to correctly size the label, or perhaps use a read-only edit control which you can scroll. M23
    1 point
  23. EmilyLove

    Episode Seeker

    Yea, sorry. I have no idea how to fix CTRL key getting stuck. I have tried sending down and up commands in previous scripts but it still glitches up. You can also just close the script from the tray in the taskbar (near the clock) if you have issues. It should also be noted that this script was designed to work with sites that host videos and follow a certain url pattern. It's pointless to use this script on this website.
    1 point
  24. Did you try it like this? $hnd = ControlGetHandle("Your window title here", "", "[CLASS:MacromediaFlashPlayerActiveX; INSTANCE:1]")
    1 point
  25. argumentum

    Episode Seeker

    I had to re-start the PC after running your code
    1 point
  26. ReFran

    Set Default Printer

    Just saw this and just worked with printers. Took the following code and change it to your need. HTH, Reinhard ;----------------------------------------------------------- ; Get specific information from all installed printers ; Refran based on a VBS from Christoph Basedau ;----------------------------------------------------------- $oWMI = ObjGet("winmgmts:") GetPrinter ("Win32_Printer") Func GetPrinter($sID) $colWBEMSet = $oWMI.InstancesOf($sID) msgbox(0,"",$colWBEMSet.count) If $colWBEMSet.count = 0 Then MsgBox(0,"", "No elements in Win32_Printer found") exit Else For $oElem in $colWBEMSet $xFind = "" $xtxt = $oElem.GetObjectText_ ;msgbox(0,"",$xTxt);= show all information $aTxt = Stringsplit($xTxt,";") for $x in $atxt; Filter specific information if stringInstr(stringleft($x,9),"Name = ") then $xfind = $xfind &$x &"; " if stringInstr($x,"DriverName = ") then $xfind = $xFind &$x &"; " if stringInstr($x,"PortName = ") then $xfind = $xFind &$x &"; " if stringInstr($xfind,"PortName") then exitLoop;=PortName = last to find next msgbox(0,"",$xFind) Next EndIf EndFunc
    1 point
×
×
  • Create New...