Leaderboard
Popular Content
Showing content with the highest reputation on 12/08/2015 in all areas
-
I started to work on this UDF and I'd like to discuss, test and improve it with other interested users. The idea is to create a UDF similar to FTPEx, but to support SFTP protocol. Given that this protocol is not natively supported by Windows, I found some candidates to manage it: cURL: http://curl.haxx.se/ PSFTP: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html FZSFTP: http://filezilla-project.org/ I'm trying to use the second one (realied by PuTTY team) and the result is the following code. It is not complete and needs to be widely tested, but main functions work and could be considered as a draft to start the discussion. A possible alternative could be to use FZSFTP (a modified version of PSFTP realized for FileZilla), that includes some interesting improvements to be used by external programs, but does not offer a related documentation. Code version: 1.0 beta 9 (not complete) Previous downloads: 132 SFTPEx.au31 point
-
Generate Random Numbers without repeating UDF
tazlikesrobots reacted to billthecreator for a topic
I believe this had been done, I just added errors and made the script clear. the example is in the script, on top, just unblock the comment... you'll see it. GenerateRandomNoRepeat.au31 point -
Closing 32770 window with no buttons
JohnFisher reacted to LarsJ for a topic
To use UI Automation code (if WinClose/WinKill doesn't work) to click the Close button, you need to identify the Close button. The Spy tool information in first post is not the Close button. It could be a pane control probably just below the Close button. For some reason the Spy tool is providing information for the pane control and not the Close button. This is a known issue. You can use Inspect.exe from Windows SDK to identify the Close button. Just run Inspect.exe and hover the mouse cursor over the Close button. When you have identified the Close button it should be possible to automate a click.1 point -
This modified mikell's example allows for a 2D array with varying number of columns in rows. #include <Array.au3> Local $sString = '[[0,10,50,50],["L", "o", "n", "g", "e", "s", "t"],["The least","number of columns","in a row"],[500,560,50,50,5]] ' Local $aArray = _Make2ArrayEx($sString) _ArrayDisplay($aArray) Func _Make2ArrayEx($s) $s = StringRegExpReplace($s, '[\[\]]{2}', "") Local $s1 = StringSplit($s, "],[", 1), $s2 StringReplace($s1[1], ",", ",") Local $iUB_Cols = @extended + 1 Local $res[$s1[0]][$iUB_Cols] For $i = 1 To $s1[0] $s2 = StringSplit($s1[$i], ",") If $s2[0] > $iUB_Cols Then $iUB_Cols = $s2[0] ReDim $res[$s1[0]][$iUB_Cols] EndIf For $j = 1 To $s2[0] $res[$i - 1][$j - 1] = $s2[$j] Next Next Return $res EndFunc ;==>_Make2ArrayEx1 point
-
My 2 cents, for the concept and w/o error checking #include <Array.au3> Local $sString = "[[0,10,50,50],[500,560,50,50]]" Local $aArray = _Make2Array($sString) _ArrayDisplay($aArray) Func _Make2Array($s) $s = StringRegExpReplace($s, '[\[\]]{2}', "") Local $s1 = StringSplit($s, "],[", 1), $s2 StringReplace($s1[1], ",", ",") Local $res[$s1[0]][@extended+1] For $i = 1 to $s1[0] $s2 = StringSplit($s1[$i], ",") For $j = 1 to $s2[0] $res[$i-1][$j-1] = $s2[$j] Next Next Return $res EndFunc Edit Hehe, JO was right about StringSplit, but I don't know a one-liner regex able to return a 2D array1 point
-
Third example 3) Standard Find text dialog.au3 showing errors:1 point
-
What confuses me is why would you even consider using third party dll to access SMS API interface. It's obviously only a thin wrapper around something as simple as this: #include "Crypt.au3" #include "WinHttp.au3" $sFrom = "Info" ; what goes here? $sTo = "555555" ; some phone number? $sMessage = "Test Message Text. Works?" $sRet = SMS_Send($sFrom, $sTo, $sMessage) ConsoleWrite("Error = " & @error & ", Response code = " & @extended & @CRLF) ConsoleWrite("> Returned = " & $sRet & @CRLF) Func SMS_Send($sFrom, $sTo, $sMessage, $fBackup = False) Local Const $sAddress = $fBackup ? "https://api2.smsapi.com/sms.do" : "https://api.smsapi.com/sms.do" Local Const $sUserName = "you@whatever.com" ; account mail here Local Const $sPassword = "password" ; your password ; Construct the form (API's post method) Local Const $sForm = _ '<form action="' & $sAddress & '" method="post" enctype="multipart/form-data">' & _ ' <input name="username"/>' & _ ; ' <input name="password"/>' & _ ' <input name="from"/>' & _ ' <input name="to"/>' & _ ' <input name="message"/>' & _ '</form>' ; Initialize and get session handle Local $hOpen = _WinHttpOpen() ; Get connection handle Local $hConnect = $sForm ; Fill the form Local $sRead = _WinHttpSimpleFormFill($hConnect, $hOpen, _ Default, _ ; location of the form "name:username", $sUserName, _ "name:password", Hex(_Crypt_HashData($sPassword, $CALG_MD5)), _ "name:from", $sFrom, _ "name:to", $sTo, _ "name:message", $sMessage) ; Collect error number and HTTP status code Local $iErr = @error, $iStatus = @extended If $iStatus <> $HTTP_STATUS_OK And Not $fBackup Then $sRead = SMS_Send($sFrom, $sTo, $sMessage, True) $iErr = @error $iStatus = @extended EndIf ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) Return SetError($iErr, $iStatus, $sRead) EndFuncBy using dll you just make your life harder.1 point
-
SkySnake & LarsJ, Thanks - I will amend the example as well. M23 Edit: And done.1 point
-
encrypted ftp
coffeeturtle reacted to tbodine88 for a topic
Ok so its not ftp but it works and is simple, my way shows the transfer, but you can probably figure out a way to do it differently. First I installed console2 http://sourceforge.net/projects/console/ next I installed pscp http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe I assume that you have connected to the server before and that the server hasn't changed its keys. If these assumptions are invalid, more code must be added to handle these eventualities. Then my autoit script looks like this Func securelyGetFile( ByRef $userId, ByRef $password, ByRef $sourceFile, ByRef $targetDrive, ByRef $targetDirectory, ByRef $destinationFile ) if ( $password = "" ) Then $password = InputBox("password",":","","*",200,100,10,10) if @error then Return EndIf EndIf ShellExecute("C:\Program Files (x86)\Console2\Console.exe","-d $Sitehome",$Sitehome) _WinWaitActivate("Console2","") ; From the Au3recorder send($targetDrive & "{ENTER}") sleep(500) send("cd " & $targetDirectory & "{ENTER}") sleep(500) send("pscp " & $userId & "@" & $server & ":" & $sourceFile & " " & $destinationFile & "{ENTER}") sleep(1000) send($password & "{ENTER}") sleep(6000) send("exit{enter}") endFunc1 point -
A very good SQL tutorial can be found here. It isn't specifically SQLite-dedicated but it gives you solid SQL grounds. SQLite covers most of SQL92 standard so you shouldn't be lost. Don't spend useless time on premature optimization. Favor use of _SQLite_GetTable[2d] or _SQLite_QuerySingleRow. Completely forget *_Query, *_FetchData and *_Finalize.1 point
-
Open File : ComboBox
DiveHigh reacted to GoronSlayer99 for a topic
Hey, Well... I want to have this ComboBox, with a button below it. I want it so that the button is the "excecute" button. Depending on what is selected in the ComboBox, a file will open... I looked around and found how to do it with buttons, but while attempting to apply it with a ComboBox, I failed. (I did look at the topic below, but it didn't appear to have my answer) #include <GUIConstants.au3> $Form1 = GUICreate("Select File", 240, 150, 0, 0) $Button1 = GUICtrlCreateButton("Run File", 75, 80, 75, 25) $Combo1 = GUICtrlCreateCombo("", 32, 24, 145, 21) GUICtrlSetData(-1, "Doc1|Doc2|Doc3|Doc4|Doc5|Doc6","Doc1") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ; EndSelect WEnd Exit So pretty much, I want each selection in the ComboBox to have it's own designated file path, and when the excecute button is clicked, the file will open. ---Thanks1 point -
maybe like this #include <GUIConstants.au3> $Form1 = GUICreate("Select File", 240, 150, 0, 0) $Button1 = GUICtrlCreateButton("Run File", 75, 80, 75, 25) $Combo1 = GUICtrlCreateCombo("", 32, 24, 145, 21) GUICtrlSetData(-1, "Doc1|Doc2|Doc3|Doc4|Doc5|Doc6","Doc1") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 $doc = GUICtrlRead($Combo1) if $doc = "Doc1" then Run("notepad.exe") ; if.... bla... bla ; EndSelect WEnd Exit 8)1 point