Jump to content

Leaderboard

Popular Content

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

  1. Hi! Today I want to show you my current AutoIt project: The ISN AutoIt Studio. The ISN AutoIt Studio is a complete IDE made with AutoIt, for AutoIt! It includes a GUI designer, a code editor (with syntax highlighting, auto complete & intelisense), a file viewer, a backup system, trophies and a lot more features!! Here are some screenshots: Here some higlights: -> easy to create/manage/public your AutoIt-projects! ->integrated GUI-Editor (ISN Form Studio 2) ->integrated - file & projectmanager ->auto backupfunction for your Projects ->extendable with plugins! ->available in several languages ->trophies ->Syntax highlighting /Autocomplete / Intelisense ->Dynamic Script ->detailed overview of the project (total working hours, total size...) And much more!!! -> -> Click here to download ISN AutoIt Studio <- <- Here is the link to the german autoit forum where I posted ISN AutoIt Studio the first time: http://autoit.de/index.php?page=Thread&threadID=29742&pageNo=1 For more information visit my Homepage: https://www.isnetwork.at So….have fun with ISN AutoIt Studio! PS: Sorry for my bad English! ^^
    1 point
  2. Having the FindReplace function find in headers and footers and textboxes would really make the UDF complete Here is the code, I found from other users, just in case someone needs it. ; select the first header on the first page ONLY $oDoc.Sections(1).Headers(2).Range.Select() ; replace text in first page header _Word_DocFindReplace($oDoc, "find-me", "replaced-text", 2, -1) ; select all other headers BUT not the first page header $oDoc.Sections(1).Headers(1).Range.Select() ; replace text _Word_DocFindReplace($oDoc, "find-me", "replaced-text", 2, -1)
    1 point
  3. It's faster to open dll. If you don't open it, _IsPressed opens and closes every time this dll. Try this: $t=100 #include <Misc.au3> $ti = TimerInit() For $a = 1 to $t For $i = 0x01 to 0xDD _IsPressed(Hex($i,2)) Next Next $ms1=Round(TimerDiff($ti)) $ti = TimerInit() $dll = DllOpen("user32.dll") For $a = 1 to $t For $i = 0x01 to 0xDD _IsPressed(Hex($i,2), $dll) Next Next DllClose($dll) $ms2=Round(TimerDiff($ti)) ConsoleWrite("Without opening user32.dll: "&$ms1&"ms" & @CRLF) ConsoleWrite("With opening user32.dll: "&$ms2&"ms" & @CRLF) ConsoleWrite(@CRLF&"It's faster "&Round(100-$ms2/$ms1*100)&"% than without opening user32.dll." & @CRLF) Without opening user32.dll: 1646ms With opening user32.dll: 1303ms It's faster 21% than without opening user32.dll.
    1 point
  4. It's because of GUI... GUISetState(@SW_DISABLE) Disabling it makes ALT no more work like a switch, but then you can't use GUI :/ ALT is used on toolbars, for example you press ALT, and you can choose something from toolbar using arrows on your keyboard, some keys, and etc.. So ALT in your GUI goes to your toolbar(which doesn't exist) and pressing it again goes in normal state. Example: You press ALT button in some GUI with toolbar, and when you press it, there's underlined characters, and pressing it again removes underlines. So ALT switches control from GUI to toolbar and toolbar to GUI. You can try this code, and try pressing ALT button: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 273, 103, 305, 198) $MenuItem3 = GUICtrlCreateMenu("ABC") $MenuItem6 = GUICtrlCreateMenuItem("MenuItem6", $MenuItem3) $MenuItem5 = GUICtrlCreateMenu("MenuItem5", $MenuItem3) $MenuItem16 = GUICtrlCreateMenu("MenuItem16", $MenuItem5) $MenuItem18 = GUICtrlCreateMenu("MenuItem18", $MenuItem16) $MenuItem19 = GUICtrlCreateMenuItem("MenuItem19", $MenuItem18) $MenuItem17 = GUICtrlCreateMenuItem("MenuItem17", $MenuItem16) $MenuItem15 = GUICtrlCreateMenuItem("MenuItem15", $MenuItem5) $MenuItem14 = GUICtrlCreateMenuItem("MenuItem14", $MenuItem5) $MenuItem4 = GUICtrlCreateMenuItem("MenuItem4", $MenuItem3) $MenuItem2 = GUICtrlCreateMenu("ABCD") $MenuItem10 = GUICtrlCreateMenu("MenuItem10", $MenuItem2) $MenuItem13 = GUICtrlCreateMenuItem("MenuItem13", $MenuItem10) $MenuItem12 = GUICtrlCreateMenuItem("MenuItem12", $MenuItem10) $MenuItem11 = GUICtrlCreateMenuItem("MenuItem11", $MenuItem10) $MenuItem9 = GUICtrlCreateMenuItem("MenuItem9", $MenuItem2) $MenuItem8 = GUICtrlCreateMenuItem("MenuItem8", $MenuItem2) $MenuItem7 = GUICtrlCreateMenuItem("MenuItem7", $MenuItem2) $MenuItem1 = GUICtrlCreateMenu("EFDGE") $MenuItem20 = GUICtrlCreateMenu("MenuItem20", $MenuItem1) $MenuItem21 = GUICtrlCreateMenuItem("MenuItem21", $MenuItem20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I'm not sure how to bypass this thing... I hope somebody else will help you! Sorry for my bad english.
    1 point
  5. mLipok

    Telegram Bot UDF

    Perhaps .... , on the other hand, if in this way, we do not overlook or forget about a little used UDF? See what's on the Wiki Page, it was even a few years ago? Now this is actually a treasure trove. I think that the assessment of the UDF should be taken in the thread and not on the list of UDFs. Of course, if a UDF proves to be dangerous, they should be removed from the list.
    1 point
  6. There is a solution for finding and replacing text in textboxes in Word. _Word_DocFindReplace won't find it directly, but you can select the textboxes through the UDF and then the replace function works. To select a Word textbox do this: $WordObject=_Word_Create () $WordDocObject=_Word_DocOpen ($WordObject, "test.doc") $WordObject.ActiveDocument.Shapes($nYourTextBoxNumber).Select _Word_DocFindReplace($WordDocObject, "FindMe", "ReplaceMe")
    1 point
  7. I agree with junkew, I'm also happly using that sw to access mainframe via 3270. A note: there is no need to install that package, you can download the noinstall.zip version from the download session of the x3270 site (http://x3270.bgp.nu/index.html)it contains various versions of that sw, and I think that the most usefull to be used by AutoIt is the "ws3270.exe". This exe allows you to manage 3270 sessions via I/O streams (without a GUI). In this way you can automate all via script instead of try to interact with the gui. (at the beginning this way can seem more harder, but in the long term is the easier and powerfull way) So, just copy the content of the "wc3270-3.4ga7-noinstall.zip" file to a folder accessible from your script. Then use a way similar to the following script to interact with the mainframe: The following is a little "not working" example, just to show one of the possibles "modus operandi" and a way to begin to do some try. Have a look to the various doc pages on the "documentation" link of that site to see all the commands an options available. p.s. the ws3270 sw also allows you to make ssl connections. If that is requested from your host, you have to use few more free files and startup parameters in that case. #include <Constants.au3> ; run the ws3270 with some optional config parameters and in I/O streams mode. Global $ws3270 = Run('3270\wS3270.exe -model 3278-2 -port 23', @ScriptDir, @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD) ; following commands are just for an example ; ------------------------------------------ StdinWrite($ws3270, "connect(10.192.254.181)" & @LF) ; connect to mainframe $status = GetStatus() ; wait the output from the host (a sort of ready to go ahead) ; ------------------- StdinWrite($ws3270, "enter()" & @LF) ; send an "enter" to mainframe $status = GetStatus() ; ------------------- StdinWrite($ws3270, 'string("zVM\n")' & @LF) ; sends the string zVM and 'enter' (of course this is a fantasy command ; use the commands that you should type ; on the keyboard, via io stream instead. $status = GetStatus() ; ------------------- StdinWrite($ws3270, 'Clear' & @LF) ; send the "Clear" keystroke $status = GetStatus() ; ------------------- StdinWrite($ws3270, 'string("loginx\n")' & @LF) ; send command loginx to mainframe (fantasy command here, use true commands instead) $status = GetStatus() StdinWrite($ws3270, 'Ascii(22,7,10)' & @LF) ; ask to ws2370 to return screen output from row,col,length $status = GetStatus() If StringInStr($status, "USERID") Then MsgBox(0, 0, "got userid request") StdinWrite($ws3270, 'MoveCursor(18,21)' & @LF) ; position cursor to coordinates row,column 0 BASED! ; ------------------- StdinWrite($ws3270, 'String("MyUserID\n")' & @LF) ; send credentials $status = GetStatus() StdinWrite($ws3270, 'MoveCursor(19,21)' & @LF) StdinWrite($ws3270, 'String("MyPassword\n")' & @LF) $status = GetStatus() StdinWrite($ws3270, 'string("' & $MyAutoitVariable & '\n")' & @LF) ; example to send the content of a variable $status = GetStatus() StdinWrite($ws3270, 'Ascii(10,1,12,79)' & @LF) ; request for a square area from the output $status = GetStatus() ; clean and copy the returned square (rows,cols) to an array Local $avLines = StringSplit(StringStripWS(StringStripCR(StringReplace($status, @LF, Chr(30))), 7), Chr(30)) ; each row of the array contains each row of the returned square area _ArrayDisplay($avLines) StdinWrite($ws3270, 'PF(8)' & @LF) ; send PF8 $status = GetStatus() StdinWrite($ws3270, 'PF(3)' & @LF) ; send PF3 $status = GetStatus() ; ------------------- StdinWrite($ws3270, "Ascii" & @LF) ; the ascii command with no parameters will request the entire screen to stdout $status = GetStatus() MsgBox(0, "", $status & @CRLF) ; show the returned "screenshot" ; StdinWrite($ws3270) ; close input stream ; --- ; END ; --- ; ; this will get the output from 3270 (from ws3270 stdout stream) Func GetStatus($Print = 1, $timeout = 60) ; if $Print = 1 -> Print Status on console (for debug purpose) ; $timeout = max secs to wait output before setting error $timer = TimerInit() $out = "" Do $out = StdoutRead($ws3270, False, False) ; get output from 3270 stdout stream Sleep(100) If TimerDiff($timer) / 1000 > $timeout Then ; $out = "error: Timeout" ConsoleWrite("error: timeout " & Int(TimerDiff($timer) / 1000) & " sec." & @CRLF) Return SetError(1, 0, $out) ; Exit EndIf Until $out <> "" If $Print Then ConsoleWrite($out & @CRLF) Return $out EndFunc ;==>GetStatus
    1 point
  8. Decided to post my updated version since there seems to be some interest. Code below has no gui, also has some bonus functions. #include <INet.au3> Global Const $PI = 4 * ATan(1) Global Const $degToRad = $PI / 180 $lon1dd = -116 $lat1dd = 33 $lon2dd = -116.05 $lat2dd = 33.05 MsgBox(0, "Test", DisplayAll(CalcAll($lat1dd, $lon1dd, $lat2dd, $lon2dd))) ; Calculate geodesic distance (in m) between two points specified by latitude/longitude (in DD) ; using Vincenty inverse formula for ellipsoids Func CalcAll($latAdd, $lonAdd, $latBdd, $lonBdd) ;Get 3 sides of triangle1, output in meters $sideA = distVincenty($latAdd, $lonAdd, $latBdd, $lonAdd) $sideB = distVincenty($latAdd, $lonAdd, $latAdd, $lonBdd) $sideC = distVincenty($latAdd, $lonAdd, $latBdd, $lonBdd) ;Get Heights, output in meters $heightA = USGS_DDtoElevation($latAdd, $lonAdd) $heightB = USGS_DDtoElevation($latBdd, $lonBdd) ;Get Triangles $triangle1 = SideAngleSide($sideA, 90, $sideB) ; = [$angleA, $sideC, $angleB] $triangle2 = SideAngleSide($sideC, 90, $heightA - $heightB) ; = [$angleC, $sideD, $angleA], SideD is height adjusted distance ;Output Info Dim $TempArray[15] = [$latAdd, $lonAdd, $latBdd, $lonBdd, $sideA, $sideB, $sideC, $heightA, $heightB, $triangle1[0], $triangle1[1], $triangle1[2], $triangle2[0], $triangle2[1], $triangle2[2]] Return $TempArray EndFunc ;==>CalcAll Func DisplayAll($Inarray) $Out = "Starting Cords:" & @CRLF & _ "Latitude: " & DDtoDMS($Inarray[0]) & " Or " & $Inarray[0] & @CRLF & _ "Longitude: " & DDtoDMS($Inarray[1]) & " Or " & $Inarray[1] & @CRLF & _ "Elevation: " & $Inarray[7] & " Meters Or " & MetersToFeet($Inarray[7]) & " Feet" & @CRLF & _ @CRLF & _ "Ending Cords:" & @CRLF & _ "Latitude: " & DDtoDMS($Inarray[2]) & " Or " & $Inarray[2] & @CRLF & _ "Longitude: " & DDtoDMS($Inarray[3]) & " Or " & $Inarray[3] & @CRLF & _ "Elevation: " & $Inarray[8] & " Meters Or " & MetersToFeet($Inarray[8]) & " Feet" & @CRLF & _ @CRLF & _ "Distance North South: " & $Inarray[4] & " Meters" & @CRLF & _ "Distance East West: " & $Inarray[5] & " Meters" & @CRLF & _ "Distance: " & $Inarray[6] & " Meters" & @CRLF & _ "Less Accurate Distance (Vincenty Triangle): " & $Inarray[10] & " Meters" & @CRLF & _ "Less Accurate Distance (Haversine): " & distHaversine($Inarray[0], $Inarray[1], $Inarray[2], $Inarray[3]) & " Meters" & @CRLF & _ "Height Adjusted Distance: " & $Inarray[13] & " Meters" & @CRLF & _ "Elevation Difference: " & $Inarray[7] - $Inarray[8] & " Meters" & @CRLF & _ @CRLF & _ "Local Angle: " & $Inarray[9] & @CRLF & _ "Height Angle From End to Start Cords: " & $Inarray[14] & @CRLF & _ @CRLF & _ "Values Not Used:" & @CRLF & _ "Angle B Triangle 1 (Azimuth Calc): " & $Inarray[11] & @CRLF & _ "Angle C Triangle 2 (Height Calc): " & $Inarray[12] Return $Out EndFunc ;==>DisplayAll Func distVincenty($lat1, $lon1, $lat2, $lon2) ; WGS-84 ellipsiod $a = 6378137 $b_new = 6356752.3142 $f = 1 / 298.257223563 $L = ($lon2 - $lon1) * $degToRad $U1 = ATan((1 - $f) * Tan($lat1 * $degToRad)) $U2 = ATan((1 - $f) * Tan($lat2 * $degToRad)) $sinU1 = Sin($U1) $cosU1 = Cos($U1) $sinU2 = Sin($U2) $cosU2 = Cos($U2) $lambda = $L $lambdaP = 2 * $PI $iterLimit = 256 While (Abs($lambda - $lambdaP) > 10 ^ - 12) And ($iterLimit > 0) $iterLimit -= 1 $sinLambda = Sin($lambda) $cosLambda = Cos($lambda) $sinSigma = Sqrt(($cosU2 * $sinLambda) * ($cosU2 * $sinLambda) + ($cosU1 * $sinU2 - $sinU1 * $cosU2 * $cosLambda) * ($cosU1 * $sinU2 - $sinU1 * $cosU2 * $cosLambda)) If $sinSigma == 0 Then Return 0 ; co-incident points $cosSigma = $sinU1 * $sinU2 + $cosU1 * $cosU2 * $cosLambda $sigma = ATan($sinSigma / $cosSigma) $sinAlpha = $cosU1 * $cosU2 * $sinLambda / $sinSigma $cosSqAlpha = 1 - $sinAlpha * $sinAlpha $cos2SigmaM = $cosSigma - 2 * $sinU1 * $sinU2 / $cosSqAlpha ;If (IsNumber($cos2SigmaM)) Then $cos2SigmaM = 0 ; equatorial line: cosSqAlpha=0 (§6) $C = $f / 16 * $cosSqAlpha * (4 + $f * (4 - 3 * $cosSqAlpha)) $lambdaP = $lambda; $lambda = $L + (1 - $C) * $f * $sinAlpha * ($sigma + $C * $sinSigma * ($cos2SigmaM + $C * $cosSigma * (-1 + 2 * $cos2SigmaM * $cos2SigmaM))) WEnd If ($iterLimit == 0) Then Return "NaN" ; formula failed to converge $uSq = $cosSqAlpha * ($a * $a - $b_new * $b_new) / ($b_new * $b_new) $a = 1 + $uSq / 16384 * (4096 + $uSq * (-768 + $uSq * (320 - 175 * $uSq))) $B = $uSq / 1024 * (256 + $uSq * (-128 + $uSq * (74 - 47 * $uSq))) $innerb = -1 + 2 * $cos2SigmaM * $cos2SigmaM $innerc = -3 + 4 * $sinSigma * $sinSigma $innerd = -3 + 4 * $cos2SigmaM * $cos2SigmaM $innere = $B / 6 * $cos2SigmaM $innera = ($cosSigma * ($innerb) - $innere * ($innerc) * ($innerd)) $innerz = $cos2SigmaM + $B / 4 $innery = $B * $sinSigma $deltaSigma = $innery * ($innerz * $innera) $s = $b_new * $a * ($sigma - $deltaSigma) Return $s EndFunc ;==>distVincenty Func distHaversine($lat1, $lon1, $lat2, $lon2) $R = 6371000 $dLat = ($lat2 - $lat1) * $degToRad $dLon = ($lon2 - $lon1) * $degToRad $lat1 = ($lat1) * $degToRad $lat2 = ($lat2) * $degToRad $a = Sin($dLat / 2) * Sin($dLat / 2) + Cos($lat1) * Cos($lat2) * Sin($dLon / 2) * Sin($dLon / 2) $C = 2 * ATan(Sqrt($a) / Sqrt(1 - $a)); $d = $R * $C; Return $d; EndFunc ;==>distHaversine Func USGS_DDtoElevation($lat, $long) $url = "http://gisdata.usgs.gov/XMLWebServices/TNM_Elevation_Service.asmx/getElevation?X_Value=" & $long & "&Y_Value=" & $lat & "&Elevation_Units=FEET&Source_Layer=NED.CONUS_NED_13W&Elevation_Only=1" $url = _INetGetSource($url) $url = StringSplit($url, "Elevation", 1) If $url[0] > 1 Then $url = StringTrimRight(StringTrimLeft($url[5], 4), 5) Else Return 0 EndIf Return FeetToMeters($url) EndFunc ;==>USGS_DDtoElevation ;converts meters to feet Func MetersToFeet($meters) Return $meters * 3.2808399 EndFunc ;==>MetersToFeet ;converts feet to meters Func FeetToMeters($feet) Return $feet * (1 / 3.2808399) EndFunc ;==>FeetToMeters ; convert DMS to DD // convert from DMS to DD, decimal degrees = whole number of degrees, plus minutes divided by 60, plus seconds divided by 3600. Func DMStoDD($DMS) $neg = False If StringInStr($DMS, "S") Or StringInStr($DMS, "E") Or StringInStr($DMS, "-") Then $neg = True EndIf $DMS = StringSplit(StringStripWS(StringRegExpReplace($DMS, "[^\d\s]", " "), 7), " ") Switch $DMS[0] Case 1 $DD = $DMS[1] Case 2 $DD = $DMS[1] + $DMS[2] / 60 Case 3 $DD = $DMS[1] + $DMS[2] / 60 + $DMS[3] / 3600 Case 4 $temp = "." & $DMS[4] $DMS[3] += $temp $DD = $DMS[1] + $DMS[2] / 60 + $DMS[3] / 3600 EndSwitch If $neg Then Return -$DD Else Return $DD EndIf EndFunc ;==>DMStoDD ; convert DD to DMS // convert from DD to DMS, decimal degrees = whole number of degrees, plus minutes divided by 60, plus seconds divided by 3600. Func DDtoDMS($DD) $d = Abs($DD); // (unsigned result ready for appending compass dir'n) $deg = Floor($d) $min = Floor(($d - $deg) * 60) $sec = Round(($d - $deg - $min / 60) * 3600, 4) ;// add leading zeros if required If ($deg < 100) Then $deg = '0' & $deg ; if (deg<10) deg = '0' + deg; EndIf If ($min < 10) Then $min = '0' & $min; EndIf If ($sec < 10) Then $sec = '0' & $sec; EndIf Return $deg & "° " & $min & "' " & $sec & '"' EndFunc ;==>DDtoDMS ;gives the other 2 sides and angle of the triangle Func AngleSideAngle($angleA, $sideA, $angleB) $angleC = 180 - ($angleA + $angleB) $sideB = $sideA * Sin($angleB * $degToRad) / Sin($angleA * $degToRad) $sideC = $sideA * Sin($angleC * $degToRad) / Sin($angleA * $degToRad) ;ConsoleWrite("$angleA=" & $angleA & " $angleB=" & $angleB & " $angleC=" & $angleC & " $sideA=" & $sideA & " $sideB=" & $sideB & " $sideC=" & $sideC & @CRLF) Dim $TempArray[3] = [$sideB, $angleC, $sideC] Return $TempArray EndFunc ;==>AngleSideAngle Func SideAngleSide($sideA, $angleB, $sideC) $sideB = Sqrt($sideA ^ 2 + $sideC ^ 2 - 2 * $sideA * $sideC * Cos($angleB * $degToRad)) $angleA = ACos(($sideA ^ 2 - $sideC ^ 2 - $sideB ^ 2) / - (2 * $sideC * $sideB)) / $degToRad If $angleA == 180 Then $angleB = 0 $sideB = Sqrt($sideA ^ 2 + $sideC ^ 2 - 2 * $sideA * $sideC * Cos($angleB * $degToRad)) EndIf $angleC = 180 - ($angleB + $angleA) ;ConsoleWrite("$angleA=" & $angleA & " $angleB=" & $angleB & " $angleC=" & $angleC & " $sideA=" & $sideA & " $sideB=" & $sideB & " $sideC=" & $sideC & @CRLF) Dim $TempArray[3] = [$angleA, $sideB, $angleC] Return $TempArray EndFunc ;==>SideAngleSide Func BearingToAzimuth($B) $temp = StringSplit($B, " ") If $temp[0] == 4 Then $temp[2] = DMStoDD($temp[2] & " " & $temp[3]) $temp[3] = $temp[4] EndIf If StringInStr($temp[1], "N") > 0 Then If StringInStr($temp[3], "E") > 0 Then $a = $temp[2] Else $a = 360 - $temp[2] EndIf Else If StringInStr($temp[3], "E") > 0 Then $a = 180 - $temp[2] Else $a = 180 + $temp[2] EndIf EndIf Return $a EndFunc ;==>BearingToAzimuth
    1 point
×
×
  • Create New...