Leaderboard
Popular Content
Showing content with the highest reputation on 11/17/2016 in Posts
-
Quick example (from here): #include "WinHttp.au3" Global $hOpen = _WinHttpOpen() Global $hConnect = _WinHttpConnect($hOpen, 'daveismyname.com') Global $hRequest = _WinHttpOpenRequest($hConnect, 'POST', '/demos/formpdf/', Default, 'https://daveismyname.com/demos/formpdf/') _WinHttpSendRequest($hRequest, 'Content-Type: application/x-www-form-urlencoded', 'name=Dent&email=dent%40wayfarer.com&submit=Submit') _WinHttpReceiveResponse($hRequest) If _WinHttpQueryDataAvailable($hRequest) Then Global $sHeaders = _WinHttpQueryHeaders($hRequest) Global $sFile = @ScriptDir & '\' & StringRegExpReplace($sHeaders, '(?si).*filename="(\S+)".*', '$1') Global $dChunk, $dData While 1 $dChunk = _WinHttpReadData($hRequest, 2) If @error Then ExitLoop $dData = _WinHttpSimpleBinaryConcat($dData, $dChunk) WEnd Global $hFile = FileOpen($sFile, 26) FileWrite($hFile, $dData) FileClose($hFile) If Not FileExists($sFile) Then MsgBox(48, "Error occurred", "No file created." & @CRLF) ShellExecute($sFile) Else MsgBox(48, "Error occurred", "No data available." & @CRLF) EndIf _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen)2 points
-
What are you expecting to be the result of these lines and what is actually the result? Jos1 point
-
Quick Questions....hope these aren't obtuse
kingtermite reacted to JLogan3o13 for a topic
There are usually some ways around different control, depending on how they're presented. Please don't hesitate to give it a try, and post here if you run into any hurdles.1 point -
Quick Questions....hope these aren't obtuse
czardas reacted to kingtermite for a topic
Thanks for your help. You've given me the info I need to move forward. I appreciate that. It sounds like AutoIT is more suited to my needs than AutoHotKey (as I kind of guessed by reading descriptions of the two). Unfortunately, I've found some new info about our products that might make it not work after all. I'll have to investigate that. Our product has some knobs/buttons on it (as well as a touch screen) and apparently all those controls do not come in as window events, so I might not be able to automate those which will kind of invalidate what I'm trying to do. Appreciate the help and explanations.1 point -
faustf, Just add each value to a running total - then at the end you have the answer: $iTotal = 0 For $i=0 To UBound($aLSommatoria) -1 $iTotal += $aLSommatoria[$i] Next ConsoleWrite($iTotal & @CRLF) M231 point
-
shorten code for multi checkboxes?
royalmarine reacted to water for a topic
Something like this? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> Global $iDispensers = 8, $aCheckbox[$iDispensers], $iCountChecked = 0 $Form1_1 = GUICreate("Contax Dispenser control", 615, 438, 192, 124) $Button1 = GUICtrlCreateButton("Init", 8, 8, 123, 41) $Button2 = GUICtrlCreateButton("Piston in Load Position", 8, 56, 123, 41) $Button3 = GUICtrlCreateButton("Piston in Dispens", 8, 104, 123, 41) $Button4 = GUICtrlCreateButton("Start toggle Piston", 8, 152, 123, 41) $Button5 = GUICtrlCreateButton("Close", 8, 200, 123, 41) $Button6 = GUICtrlCreateButton("Exit", 8, 248, 123, 41) For $i = 0 To $iDispensers - 1 $aCheckbox[$i] = GUICtrlCreateCheckbox("Dispenser " & $i + 1, 240, ($i * 32) + 16, 97, 17) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 For $i = 0 To UBound($aCheckbox, 1) - 1 If _IsChecked($aCheckbox[$i]) Then $iCountChecked += 1 Sleep(2000) ControlClick("test" & $i + 1 & ".map", "", "[NAME:buttonInit]") EndIf Next If $iCountChecked = 0 Then MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONWARNING), "Warning", "You must select at least one dispenser.", 10) Case $Button2 Case $Button3 Case $Button4 Case $Button5 Case $Button6 EndSwitch WEnd Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked1 point -
Hashing a string from @ScriptDir gives strange results
Laurynelis reacted to jchd for a topic
The help file fails to mention that the functions returns a binary variant. Implicit variant conversions explain the issue, as already mentionned.1 point -
Hashing a string from @ScriptDir gives strange results
Laurynelis reacted to iamtheky for a topic
this fixes it as well: ConsoleWrite("" & $hash) *Its because it is evaluating the input as a number, and that number is huge. All those solutions change it to string. ConsoleWrite(string($hash))1 point -
AutoIt is quite possibly perfect for your requirements, but there are some snags. Firstly, there used to be a tool called AU3Record which was designed to generate a script by recording user actions. The tool was removed from the package - I believe this is because it would also qualify as a keylogger, although this was never the intention. Secondly, AutoIt is closed source. It used to be open source, but that changed after AutoHotKey appeared. I don't know the full inside story. I have never used AutoHotKey and see no advantage in doing so. This might leave you with a bit of a dilemma. I believe the AutoHotKey community have less regard for playing by the rules and are more likely to help you create scripts which might easily be classified as malware. Here we are much more cautious and will avoid posting code that could be used for illegal purposes regardless of the actual intent. Since there are many legitimate uses for such scripts, such as in your case, all the functionality that you require exists. The only drawback being that you have to write the program yourself. We are happy to assist you with technical details about AutoIt and give hints, but if you ask 'How do I log every key pressed on the keyboard?', then you will not receive any help. Check the forum rules. I can't answer your question fully, but I hope this gives you better insight and that you stick around and start writing code. Nothing wrong with your questions BTW!1 point
-
Hashing a string from @ScriptDir gives strange results
Laurynelis reacted to kylomas for a topic
Laurynelis, Add a @CRLF to your consolewrite in the first example and you'll get the correct results. kylomas edit: Must be something in the way console is interpreting the non terminated line. This also produces correct results... #include <Crypt.au3> $hash = _Crypt_HashFile(@ScriptDir & '\file1.txt', $CALG_SHA1) ConsoleWrite($hash & ' ')1 point -
youtuber, It has nothing to do with consolewrite. I suspect you are asking for a translation of the ternary expression, like this? #include <Array.au3> local $a1[5], $b2[5] $a1[0] = "autoit0" $a1[1] = "autoit0123asdf" $a1[2] = "autoit0" $a1[3] = "autoit0" $a1[4] = "autoit0" $b2[0] = "autoit0" $b2[1] = "autoit0" $b2[2] = "autoit0" $b2[3] = "autoit0" $b2[4] = "autoit0" For $x = 0 To UBound($a1) - 1 if $a1[$x] = $b2[$x] then ConsoleWrite('equal' & @CRLF) Else ConsoleWrite('not equal' & @CRLF) endif Next kylomas What do you mean by this? If $a1 AND $b2 == Then1 point
-
Adding Images to Tab
aa2zz6 reacted to InunoTaishou for a topic
#include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiTab.au3> #include <WinAPI.au3> #include <GDIPlus.au3> Example() Func Example() _GDIPlus_Startup() Local $hGUI = GUICreate("Tab Control Set Item Image", 400, 300) Local $idTab = GUICtrlCreateTab(2, 2, 396, 296) Local $hImageList = _GUIImageList_Create(50, 20) Local $aImages[4] For $i = 0 To 3 ; Load the GDI+ bitmap Local $hBitmapTmp = _GDIPlus_BitmapCreateFromFile("Tab" & $i & ".jpg") ; Conver the GDI+ bitmap to a HBitmap $aImages[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmapTmp) ; Get rid of the GDI+ bitmap _GDIPlus_BitmapDispose($hBitmapTmp) ; Add the HBitmap to the image list _GUIImageList_Add($hImageList, $aImages[$i]) Next _GUICtrlTab_SetImageList($idTab, $hImageList) For $i = 0 To 3 _GUICtrlTab_InsertItem($idTab, $i, "") _GUICtrlTab_SetItemImage($idTab, $i, $i) Next GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() ; Dispose of the HBitmap objects properly For $i = 0 To 3 _WinAPI_DeleteObject($aImages[$i]) Next EndFunc ;==>Example1 point -
Another option, for whatever it's worth, would be to use WinHttp. Forum thread here.1 point
-
well, you'll also need the include for $WS_POPUP or write the 0x.... thingy. But that's all. (Yeah, I replaced the space key with the rolling-key )1 point