Jump to content

beginner10

Active Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by beginner10

  1. @TheXman Thanks for the reply. The truth is, I haven't used Winhttp in the past. I understand what you're saying, so referres is a request header, using SetRequestHeader. But is there any way to see if that header was actually set correctly? I would have expected that after sending it with SetRequestHeader(), I could see it with GetAllResponseHeaders(). But I understand why it doesn't work that way. Thanks
  2. I'm trying to set a referrer, but it's not visible in the header, ideas? $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://example.com", False) $oHTTP.SetRequestHeader("Accept", "*/*") $oHTTP.SetRequestHeader("Referrer", 'http://www.123.com') $oHTTP.Send("") $oHTTP.WaitForResponse $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status $oHeader = $oHTTP.GetAllResponseHeaders() MsgBox(0,"",$oHeader) ; Referrer is not working Func MyErrFunc() MsgBox(0, "AutoItCOM Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) EndFunc ;==>MyErrFunc
  3. @Jos It is a general question, this problem is for any other site. and also the previous topic I reported. Sorry for the previous post, it was accidental. My intentions are good.
  4. Hello, Below I used _WinHttpAddRequestHeaders to send a cookie on that page, but when I display the header using Header = _WinHttpQueryHeaders($h_openRequest) ConsoleWrite(@CRLF & "HEADERS1:" & @CRLF & $Header & @CRLF & @CRLF) .... , the cookie I set does not appear there. I have been trying to solve this problem for a few weeks, but I am not successful at all, I have tried in various ways but without success. I'm still a beginner. If anyone can help me, I would be grateful. Thank you in advance. #include "Winhttp.au3" Global $hw_open = _WinHttpOpen("User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36") If @error Then MsgBox(48, "Error", "Error initializing the usage of WinHTTP functions.") Exit EndIf Global $hw_connect = _WinHttpConnect($hw_open, "www.site.com") If @error Then MsgBox(48, "Error", "Error specifying the initial target server of an HTTP request.") _WinHttpCloseHandle($hw_open) Exit EndIf $h_openRequest = _WinHttpOpenRequest($hw_connect, "POST") If @error Then MsgBox(48, "Error", "Error creating an HTTP request handle.") _WinHttpCloseHandle($hw_connect) _WinHttpCloseHandle($hw_open) Exit EndIf _WinHttpAddRequestHeaders($h_openRequest, "Cookie: test=testcookie") _WinHttpSendRequest($h_openRequest) _WinHttpReceiveResponse($h_openRequest) $Header = _WinHttpQueryHeaders($h_openRequest) ConsoleWrite(@CRLF & "HEADERS1:" & @CRLF & $Header & @CRLF & @CRLF) Exit
  5. I searched more closely and it seems that the $oHttp.SetRequestHeader("Cookie", 'test=testcookie') function is not working. Because $oHttp.GetAllResponseHeaders() does not include my cookie set.
  6. Hi, I need a little help, if anyone is willing to help me, I rarely post on the forum here, I usually try to learn on my own, but now, I have not found a solution to my problem, although I tried for a few weeks alone. I need to find in the source code of a page, the list of users, as it is in the picture attached below. This is the source code for my failed attempts, I wonder where I went wrong? #include <Array.au3> #include <String.au3> $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $url = "#########################" ; Replace this link with an online model $Get = BinaryToString(InetRead($url, 1), 4) ;ConsoleWrite(@CRLF & $Get) $Get2 = WinHttp_read($url) ConsoleWrite(@CRLF & $Get2) ClipPut($Get2) Exit Func WinHttp_read($url) $oHttp = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHttp.Open("GET", $url, False) $oHttp.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36") $oHttp.SetRequestHeader("Pragma", "no-cache") $oHttp.SetRequestHeader("Cache-Control", "no-cache") $oHttp.SetRequestHeader("Referer", "########################") $oHttp.SetRequestHeader("Cookie", 'agreeterms=1') $oHttp.Send() If @error Then Return SetError(5, "", "") $oHttp.WaitForResponse() $HTMLSource = $oHttp.Responsetext $cookiesg = $oHttp.GetAllResponseHeaders() $oHttp = 0 Return $HTMLSource $oHttp.Close EndFunc ;==>WinHttp_read After testing with the first default function, InetRead, I realized that the problem is that the page is not fully loaded, and I started using WinHttp. I had some hopes with WinHttp, I used User-Agent and WaitForResponse (), but still I don't get all the source code to find the list of users in it. If you can help me with some ideas at least, I would be grateful Thank you in advance.
  7. Hi, Does anyone know how I can set the correct proxy in this script? Thank you Func _MicrosoftXMLHTTP($url) $oHttp = ObjCreate("Microsoft.XMLHTTP") ;$oHttp.setProxy(2, "209.127.191.111:9279") ;$oHttp.setProxyCredentials("user", "pass") $oHttp.Open("GET", $url, 0) $oHttp.Send() If @error Then Return SetError(1, 0, 0) $sReceived = $oHttp.ResponseText Return $sReceived EndFunc ;==>_MicrosoftXMLHTTP
  8. I'm trying to add this script to a button. So that when I press that button, I open a photo album. After I added this script to the button, it doesn't work at all. I'm trying to figure out how to solve this. #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISysWin.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 275, 122, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") $Button1 = GUICtrlCreateButton("Album image 1", 16, 16, 115, 41) GUICtrlSetOnEvent($Button1, "_Start") ;$Button2 = GUICtrlCreateButton("Album image 2", 16, 64, 115, 41) GUISetState(@SW_SHOW) While True Sleep(10) WEnd Func _Start() Global $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\Windows 10 Pro\Desktop\Test\Images\2.jpg") Global $iImageWidth = _GDIPlus_ImageGetWidth($hImage), $iImageHeight = _GDIPlus_ImageGetHeight($hImage) Local $aPos[] = [$iImageWidth, $iImageHeight] If $iImageWidth > @DesktopWidth Or $iImageHeight > @DesktopHeight Then $aPos = _EvaluateSize(@DesktopWidth, @DesktopHeight, $iImageWidth, $iImageHeight) EndIf Global $hGUI = GUICreate("", $aPos[0], $aPos[1], -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME)) GUISetBkColor(0x000000) GUISetOnEvent($hGUI, "SpecialEvents2") Global $idPic = GUICtrlCreatePic("", 0, 0, $aPos[0], $aPos[1]) Global $hBitMap = _SetImagetoCtrl($idPic, $hImage, $aPos[0], $aPos[1]) GUIRegisterMsg($WM_SIZE, WM_SIZE) GUISetState() EndFunc ;==>_Start Func _EvaluateSize($iBaseWidth, $iBaseHeight, $iActualWidth, $iActualHeight) Local $iVal = $iBaseWidth / $iActualWidth * $iActualHeight If $iVal <= $iBaseHeight Then Return StringSplit($iBaseWidth & "|" & $iVal, "|", $STR_NOCOUNT) $iVal = $iBaseHeight / $iActualHeight * $iActualWidth Return StringSplit($iVal & "|" & $iBaseHeight, "|", $STR_NOCOUNT) EndFunc ;==>_EvaluateSize Func _SetImagetoCtrl($idPic, $hImage, $iWidth, $iHeight) Local $hResize = _GDIPlus_ImageResize($hImage, $iWidth, $iHeight) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hResize) _GDIPlus_ImageDispose($hResize) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) Return $hHBitmap EndFunc ;==>_SetImagetoCtrl Func WM_SIZE($hWnd, $nMsg, $wParam, $lParam) AdlibRegister(_ResizeImage, 5) Return 1 EndFunc ;==>WM_SIZE Func _ResizeImage() AdlibUnRegister(_ResizeImage) Local $tRECT = _WinAPI_GetClientRect($hGUI) Local $iWidth = $tRECT.right - $tRECT.left + 1 Local $iHeight = $tRECT.bottom - $tRECT.top + 1 If $iWidth > $iImageWidth And $iHeight > $iImageHeight Then Local $aPos[] = [$iImageWidth, $iImageHeight] Else Local $aPos = _EvaluateSize($iWidth, $iHeight, $iImageWidth, $iImageHeight) EndIf _WinAPI_MoveWindow(GUICtrlGetHandle($idPic), Int(($iWidth - $aPos[0]) / 2), Int(($iHeight - $aPos[1]) / 2), $aPos[0], $aPos[1]) $hBitMap = _SetImagetoCtrl($idPic, $hImage, $aPos[0], $aPos[1]) EndFunc ;==>_ResizeImage Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE EndSelect EndFunc ;==>SpecialEvents Func SpecialEvents2() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hBitMap) _GDIPlus_Shutdown() Exit Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE EndSelect EndFunc ;==>SpecialEvents2 I think this is the way, but just doesn't work, I'm omitting something. The latest script: #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISysWin.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Form1", 275, 122, 192, 124) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") $Button1 = GUICtrlCreateButton("Album image 1", 16, 16, 115, 41) GUICtrlSetOnEvent($Button1, "_Start") ;$Button2 = GUICtrlCreateButton("Album image 2", 16, 64, 115, 41) GUISetState(@SW_SHOW) Global $hGUI = GUICreate("", 800, 600, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME)) GUISetBkColor(0x000000) GUISetOnEvent($hGUI, "SpecialEvents2") Global $idPic = GUICtrlCreatePic("", 0, 0, 100, 100) GUISetState(@SW_HIDE, $hGUI) GUIRegisterMsg($WM_SIZE, WM_SIZE) While True Sleep(10) WEnd Func _Start() Global $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\Windows 10 Pro\Desktop\Test\Images\2.jpg") Global $iImageWidth = _GDIPlus_ImageGetWidth($hImage), $iImageHeight = _GDIPlus_ImageGetHeight($hImage) Local $aPos[] = [$iImageWidth, $iImageHeight] If $iImageWidth > @DesktopWidth Or $iImageHeight > @DesktopHeight Then $aPos = _EvaluateSize(@DesktopWidth, @DesktopHeight, $iImageWidth, $iImageHeight) EndIf Global $hBitMap = _SetImagetoCtrl($idPic, $hImage, $aPos[0], $aPos[1]) GUISetState(@SW_SHOW, $hGUI) EndFunc ;==>_Start Func _EvaluateSize($iBaseWidth, $iBaseHeight, $iActualWidth, $iActualHeight) Local $iVal = $iBaseWidth / $iActualWidth * $iActualHeight If $iVal <= $iBaseHeight Then Return StringSplit($iBaseWidth & "|" & $iVal, "|", $STR_NOCOUNT) $iVal = $iBaseHeight / $iActualHeight * $iActualWidth Return StringSplit($iVal & "|" & $iBaseHeight, "|", $STR_NOCOUNT) EndFunc ;==>_EvaluateSize Func _SetImagetoCtrl($idPic, $hImage, $iWidth, $iHeight) Local $hResize = _GDIPlus_ImageResize($hImage, $iWidth, $iHeight) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hResize) _GDIPlus_ImageDispose($hResize) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) Return $hHBitmap EndFunc ;==>_SetImagetoCtrl Func WM_SIZE($hWnd, $nMsg, $wParam, $lParam) AdlibRegister(_ResizeImage, 5) Return 1 EndFunc ;==>WM_SIZE Func _ResizeImage() AdlibUnRegister(_ResizeImage) Local $tRECT = _WinAPI_GetClientRect($hGUI) Local $iWidth = $tRECT.right - $tRECT.left + 1 Local $iHeight = $tRECT.bottom - $tRECT.top + 1 If $iWidth > $iImageWidth And $iHeight > $iImageHeight Then Local $aPos[] = [$iImageWidth, $iImageHeight] Else Local $aPos = _EvaluateSize($iWidth, $iHeight, $iImageWidth, $iImageHeight) EndIf _WinAPI_MoveWindow(GUICtrlGetHandle($idPic), Int(($iWidth - $aPos[0]) / 2), Int(($iHeight - $aPos[1]) / 2), $aPos[0], $aPos[1]) $hBitMap = _SetImagetoCtrl($idPic, $hImage, $aPos[0], $aPos[1]) EndFunc ;==>_ResizeImage Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE EndSelect EndFunc ;==>SpecialEvents Func SpecialEvents2() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE GUISetState(@SW_HIDE, $hGUI) GUISetState(@SW_SHOW, $Form1) Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE EndSelect EndFunc ;==>SpecialEvents2
  9. @Nine Now I understand how to center an object, easy math, but I didn't think about it. Int(($iWidth-$aPos[0])/2), Int(($iHeight-$aPos[1])/2 Thanks for the support, now everything is fine, if I need improvements I will come back here. Have a merry christmas!
  10. @Nine, Thanks for the help. Of course I don’t ask for direct help, I research the script and try to solve it on my own. I changed the _ResizeImage () function, I put some ifs that check the maximum length and width, and it stops there. Now it seems to be working properly, but there are still 2 problems. 1. The picture is not centered, I don't know how to do that. 2. When you press the maximize button, it does not work. It only works when I widen the Gui. My code: #include <GUIConstants.au3> #include <GDIPlus.au3> #include <WinAPISysWin.au3> _GDIPlus_Startup() Example() _GDIPlus_Shutdown() Func Example() Local Const $BASE_WIDTH = @DesktopWidth / 2, $BASE_HEIGHT = @DesktopHeight / 2 Global $hImage = _GDIPlus_ImageLoadFromFile("C:\Users\Windows 10 Pro\Desktop\Test\Images\2.jpg") Global $iImageWidth = _GDIPlus_ImageGetWidth($hImage) Global $iImageHeight = _GDIPlus_ImageGetHeight($hImage) Local $aPos = _EvaluateSize($BASE_WIDTH, $BASE_HEIGHT, $iImageWidth, $iImageHeight) Global $hGUI = GUICreate("", $aPos[0], $aPos[1], -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME)) GUISetBkColor(0x000000) Global $idPic = GUICtrlCreatePic("", 0, 0, $aPos[0], $aPos[1]) Local $hBitMap = _SetImagetoCtrl($idPic, $hImage, $aPos[0], $aPos[1]) GUIRegisterMsg($WM_SIZE, WM_SIZE) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_DeleteObject($hBitMap) EndFunc ;==>Example Func _EvaluateSize($iBaseWidth, $iBaseHeight, $iActualWidth, $iActualHeight) Local $iVal = $iBaseWidth / $iActualWidth * $iActualHeight If $iVal <= $iBaseHeight Then Return StringSplit($iBaseWidth & "|" & $iVal, "|", $STR_NOCOUNT) $iVal = $iBaseHeight / $iActualHeight * $iActualWidth Return StringSplit($iVal & "|" & $iBaseHeight, "|", $STR_NOCOUNT) EndFunc ;==>_EvaluateSize Func _SetImagetoCtrl($idPic, $hImage, $iWidth, $iHeight) Local $hResize = _GDIPlus_ImageResize($hImage, $iWidth, $iHeight) Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hResize) _GDIPlus_ImageDispose($hResize) _WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) Return $hHBitmap EndFunc ;==>_SetImagetoCtrl Func WM_SIZE($hWnd, $nMsg, $wParam, $lParam) AdlibRegister(_ResizeImage, 5) Return 1 EndFunc ;==>WM_SIZE Func _ResizeImage() AdlibUnRegister(_ResizeImage) Local $tRECT = _WinAPI_GetClientRect($hGUI) Local $iWidth = $tRECT.right - $tRECT.left + 1 Local $iHeight = $tRECT.bottom - $tRECT.top + 1 Local $aPos = _EvaluateSize($iWidth, $iHeight, $iImageWidth, $iImageHeight) If $aPos[0] > $iImageWidth Then ConsoleWrite(@CRLF & "MAXIM Width" & $aPos[0] & " \ " & $iImageWidth) Else If $aPos[1] > $iImageHeight Then ConsoleWrite(@CRLF & "MAXIM Height" & $aPos[1] & " \ " & $iImageHeight) Else _WinAPI_MoveWindow(GUICtrlGetHandle($idPic), 0, 0, $aPos[0], $aPos[1]) $hBitMap = _SetImagetoCtrl($idPic, $hImage, $aPos[0], $aPos[1]) ConsoleWrite(@CRLF & "LIMIT " & $aPos[0] & " \ " & $iImageWidth) EndIf EndIf EndFunc ;==>_ResizeImage
  11. Thank you for your effort. Unfortunately, the script doesn't help me for what I need, because the pictures lose their clarity when I maximize the GUI form. For example the picture below is 960x640, when I maximize Gui, the picture spreads across the screen, which is wrong, because my screen is much larger than the resolution of the picture. The picture must be centered in the middle of the GUI, and displayed at its original resolution, even if the gui form is maximized, across my entire screen. Basically, when I maximize GUI form, the picture must have the limit to increase to original resolution, no more. It would be correct for the picture to open as in screenshot number 2.
  12. Thanks for your help! The script is close to the truth, but it should be able to display the image at its maximum resolution, but no more than that. For example, if an image has 960x640, the image should be displayed at maximum this resolution, not higher than that. Basically, I would like it to behave like "windows photo viewer" I have attached a video below:
  13. I have a problem with my resize form with full image script... I have already searched the forum and I found some examples, but is not work correctly for me, so I tried to solve this problem myself. I have a resizable Gui form, $ WS_SIZEBOX. In this Gui, I want to display a larger image, and when I resize the GUI, the image should be proportional, without losing its clarity. This is my script, it works relatively well, but in many cases, the image is not fully displayed. Thanks in advance #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> _GDIPlus_Startup() $IMAGINE_PATH = "C:\Users\Windows 10 Pro\Desktop\image4.jpg" Global $IMAGINE_GDI, $LATIME, $INALTIME, $PICTURE Global $LATIME_IMG, $INALTIME_IMG _GetSize() $FORM_LATIME = 0 $FORM_INALTIME = 0 $Form2 = GUICreate("TEST", 1300, 750, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP)) AdlibRegister('_StructuraImagine', 10) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _GetSize() $IMAGINE_GDI = _GDIPlus_ImageLoadFromFile($IMAGINE_PATH) $LATIME = _GDIPlus_ImageGetWidth($IMAGINE_GDI) $INALTIME = _GDIPlus_ImageGetHeight($IMAGINE_GDI) _GDIPlus_ImageDispose($IMAGINE_GDI) _GDIPlus_Shutdown() EndFunc ;==>_GetSize Func _StructuraImagine() $Size = WinGetClientSize($Form2) If $Size[0] <> $FORM_LATIME Or $Size[1] <> $FORM_INALTIME Then $FORM_LATIME = $Size[0] $FORM_INALTIME = $Size[1] _Modifica_Imagine() EndIf EndFunc ;==>_StructuraImagine Func _Modifica_Imagine() GUICtrlDelete($PICTURE) If $LATIME > $FORM_LATIME Or $INALTIME > $FORM_INALTIME Then If $INALTIME > $LATIME Then $RATIE = $LATIME / $INALTIME $LATIME_IMG = $FORM_INALTIME $INALTIME_IMG = $FORM_INALTIME $LATIME_IMG = $INALTIME_IMG * $RATIE EndIf If $LATIME > $INALTIME Then $RATIE = $LATIME / $INALTIME $LATIME_IMG = $FORM_LATIME $INALTIME_IMG = $FORM_INALTIME $LATIME_IMG = $INALTIME_IMG * $RATIE EndIf EndIf $PICTURE = GUICtrlCreatePic($IMAGINE_PATH, 0, 0, $LATIME_IMG, $INALTIME_IMG) EndFunc ;==>_Modifica_Imagine
  14. Any idea ?
  15. Hello, I have been struggling for a few hours to find a simple solution to the next problem. I have the php file below and my autoit script. The problem is the following, if on my server, I create the "dirnewname" directory (the one specified in the autoit file), and then run the autoit script, in which case it works perfectly and the "file.txt" file is created in the specified "dirnewname" directory. Basically I can upload a .txt file to the server at any time if I know the location of the directory and if that directory exists. The problem is that I need to create a new directory when I need it, calling the May function _HTTP_Upload. Can I do that? Basically at the moment, I can upload with _HTTP_Upload, a text file or another type of file, but I can't create a new directory in which to upload the desired file. If anyone can help me, thank you in advance. My php file: <?php define('PASSWORD', '123'); // put pwd here $pwd = isset($_REQUEST['pwd']) ? $_REQUEST['pwd'] : null; if ($pwd!=PASSWORD) { header("HTTP/1.0 403 Forbidden"); echo "403 Forbidden"; exit; } $allowed_extensions = ['txt', 'jpg', 'docx']; // set it if ($_FILES['uploadinput']['tmp_name']) { $file_extension = strtolower(end($tmp = explode(".", $_POST['filename']))); // $tmp to avoid "should be passed as ref" notice if(in_array($file_extension, $allowed_extensions)) { move_uploaded_file($_FILES['uploadinput']['tmp_name'], 'uploads/'.$_POST['filename']); } } echo 'ok'; My autoit file: #include <HTTP.au3> $test = _HTTP_Upload("https://site.com/key/file.php", "New folder\myFile.txt", "uploadinput", "pwd=123&filename=" & URLEncode("dirnewname/file.txt") ) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $test = ' & $test & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
  16. hi, How can I use this without compiling? If I press F5 and start the program from the code, then the image does not appear, but if I compile codulin .exe and start it, it works fine. Thanks
  17. Thanks Aelc and Zedna for help, The both versions is works, but I chose to use RecourcesEx UDF because it is faster. _Resource_SetToCtrlID() is not working fine for me, maybe because i have .bmp file. but working fine with this function: $hHBITMAP = _Resource_GetAsBitmap('TEST_BMP_2', $RT_BITMAP) _Resource_SetBitmapToCtrlID($Pic3, $hHBITMAP) My code. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_File_Add=bmp_1.bmp, RT_BITMAP, TEST_BMP_1 #AutoIt3Wrapper_Res_File_Add=bmp_2.bmp, RT_BITMAP, TEST_BMP_2 #AutoIt3Wrapper_Res_File_Add=bmp_3.bmp, RT_BITMAP, TEST_BMP_3 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ResourcesEx.au3> AutoItSetOption("GuiOnEventMode", 1) $Img1_1 = @TempDir & "\Dashboard left.bmp" FileInstall("Dashboard left.bmp", $Img1_1, 1) $Img1_2 = @TempDir & "\Dashboard up.bmp" FileInstall("Dashboard up.bmp", $Img1_2, 1) $Form1 = GUICreate("Form1", 1325, 999, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Pic1 = GUICtrlCreatePic($Img1_1, 0, 0, 297, 899) ;GUICtrlSetState(-1, $GUI_DISABLE) $Pic2 = GUICtrlCreatePic($Img1_2, 295, 0, 1030, 353) ;GUICtrlSetState(-1, $GUI_DISABLE) $Pic3 = GUICtrlCreatePic("", 295, 352, 1030, 547) ;GUICtrlSetState(-1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("IMG1", 100, 920, 83, 25) GUICtrlSetOnEvent($Button1, "IMG1") $Button2 = GUICtrlCreateButton("IMG2", 200, 920, 83, 25) GUICtrlSetOnEvent($Button2, "IMG2") $Button3 = GUICtrlCreateButton("IMG3", 300, 920, 83, 25) GUICtrlSetOnEvent($Button3, "IMG3") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func IMG1() $hHBITMAP = _Resource_GetAsBitmap('TEST_BMP_1', $RT_BITMAP) _Resource_SetBitmapToCtrlID($Pic3, $hHBITMAP) EndFunc ;==>IMG1 Func IMG2() $hHBITMAP = _Resource_GetAsBitmap('TEST_BMP_2', $RT_BITMAP) _Resource_SetBitmapToCtrlID($Pic3, $hHBITMAP) EndFunc ;==>IMG2 Func IMG3() $hHBITMAP = _Resource_GetAsBitmap('TEST_BMP_3', $RT_BITMAP) _Resource_SetBitmapToCtrlID($Pic3, $hHBITMAP) EndFunc ;==>IMG3 Func _Exit() Exit EndFunc ;==>_Exit hi, How can I use this without compiling? If I press F5 and start the program from the code, then the image does not appear, but if I compile codulin .exe and start it, it works fine.
  18. Indeed the above code works very well, I tried to make a function easier to use than this, it is not the best function, but it works. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GdiPlus.au3> _GDIPlus_Startup() AutoItSetOption("GuiOnEventMode", 1) $Img1_1 = @TempDir & "\Dashboard left.bmp" FileInstall("Dashboard left.bmp", $Img1_1, 1) $Img1_2 = @TempDir & "\Dashboard up.bmp" FileInstall("Dashboard up.bmp", $Img1_2, 1) $interface_1 = @TempDir & "\1.bmp" FileInstall("1.bmp", $interface_1, 1) $interface_2 = @TempDir & "\2.bmp" FileInstall("2.bmp", $interface_2, 1) $interface_3 = @TempDir & "\3.bmp" FileInstall("3.bmp", $interface_3, 1) OnAutoItExitRegister("_exit") $Form1 = GUICreate("Form1", 1325, 999, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Pic1 = GUICtrlCreatePic($Img1_1, 0, 0, 297, 899) GUICtrlSetState(-1, $GUI_DISABLE) $Pic2 = GUICtrlCreatePic($Img1_2, 295, 0, 1030, 353) GUICtrlSetState(-1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("IMG1", 100, 920, 83, 25) GUICtrlSetOnEvent($Button1, "IMG1") $Button2 = GUICtrlCreateButton("IMG2", 200, 920, 83, 25) GUICtrlSetOnEvent($Button2, "IMG2") $Button3 = GUICtrlCreateButton("IMG3", 300, 920, 83, 25) GUICtrlSetOnEvent($Button3, "IMG3") GUICtrlCreatePic_GDI($Form1, 1030, 547) GUISetState(@SW_SHOW) GUICtrlSetImage_GDI($interface_1, 295, 352, 1030, 547) While 1 Sleep(10) WEnd Func IMG1() GUICtrlSetImage_GDI($interface_1, 295, 352, 1030, 547) EndFunc ;==>IMG1 Func IMG2() GUICtrlSetImage_GDI($interface_2, 295, 352, 1030, 547) EndFunc ;==>IMG2 Func IMG3() GUICtrlSetImage_GDI($interface_3, 295, 352, 1030, 547) EndFunc ;==>IMG3 Func _Exit() Exit EndFunc ;==>_Exit Func GUICtrlCreatePic_GDI($form_use, $widh_pos, $height_pos) Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($form_use) Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($widh_pos, $height_pos, $hGraphics) Global $buffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode(_GDIPlus_ImageGetGraphicsContext($hBitmap), 2) EndFunc ;==>GUICtrlCreatePic_GDI Func GUICtrlSetImage_GDI($img_location_pos, $left_pos, $top_pos, $widh_pos, $height_pos) _GDIPlus_GraphicsDrawImageRect($buffer, _GDIPlus_ImageLoadFromFile($img_location_pos), 0, 0, $widh_pos, $height_pos) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, $left_pos, $top_pos, $widh_pos, $height_pos) EndFunc ;==>GUICtrlSetImage_GDI But there is a problem for which I did not find a solution, when I press the minimize button, the interface goes to the bar, and when I restore the form, the picture disappeared. Why is this happening? Thank you Download images bellow imagesdld.zip
  19. Waw. it really works. Honestly, I didn't expect it to work. I appreciate your help. Thank you! I will attach my original code and the code solved with your functions, for who will need it in the future. (Download zip images) GUICtrlSetImage / flickers problem code #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> AutoItSetOption("GuiOnEventMode", 1) $Img1_1 = @TempDir & "\Dashboard left.bmp" FileInstall("Dashboard left.bmp", $Img1_1, 1) $Img1_2 = @TempDir & "\Dashboard up.bmp" FileInstall("Dashboard up.bmp", $Img1_2, 1) $interface_1 = @TempDir & "\1.bmp" FileInstall("1.bmp", $interface_1, 1) $interface_2 = @TempDir & "\2.bmp" FileInstall("2.bmp", $interface_2, 1) $interface_3 = @TempDir & "\3.bmp" FileInstall("3.bmp", $interface_3, 1) $Form1 = GUICreate("Form1", 1325, 999, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP, $WS_EX_LAYERED)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Pic1 = GUICtrlCreatePic($Img1_1, 0, 0, 297, 899) GUICtrlSetState(-1, $GUI_DISABLE) $Pic2 = GUICtrlCreatePic($Img1_2, 295, 0, 1030, 353) GUICtrlSetState(-1, $GUI_DISABLE) $Pic3 = GUICtrlCreatePic($interface_1, 295, 352, 1030, 547) GUICtrlSetState(-1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("IMG1", 100, 920, 83, 25) GUICtrlSetOnEvent($Button1, "IMG1") $Button2 = GUICtrlCreateButton("IMG2", 200, 920, 83, 25) GUICtrlSetOnEvent($Button2, "IMG2") $Button3 = GUICtrlCreateButton("IMG3", 300, 920, 83, 25) GUICtrlSetOnEvent($Button3, "IMG3") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func IMG1() GUICtrlSetImage($Pic3, $interface_1) EndFunc ;==>IMG1 Func IMG2() GUICtrlSetImage($Pic3, $interface_2) EndFunc ;==>IMG2 Func IMG3() GUICtrlSetImage($Pic3, $interface_3) EndFunc ;==>IMG3 Func _Exit() Exit EndFunc ;==>_Exit GDI+ / flickers problem fixed by Aelc #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GdiPlus.au3> AutoItSetOption("GuiOnEventMode", 1) $Img1_1 = @TempDir & "\Dashboard left.bmp" FileInstall("Dashboard left.bmp", $Img1_1, 1) $Img1_2 = @TempDir & "\Dashboard up.bmp" FileInstall("Dashboard up.bmp", $Img1_2, 1) $interface_1 = @TempDir & "\1.bmp" FileInstall("1.bmp", $interface_1, 1) $interface_2 = @TempDir & "\2.bmp" FileInstall("2.bmp", $interface_2, 1) $interface_3 = @TempDir & "\3.bmp" FileInstall("3.bmp", $interface_3, 1) OnAutoItExitRegister("_exit") $Form1 = GUICreate("Form1", 1325, 999, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP, $WS_EX_LAYERED)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Pic1 = GUICtrlCreatePic($Img1_1, 0, 0, 297, 899) GUICtrlSetState(-1, $GUI_DISABLE) $Pic2 = GUICtrlCreatePic($Img1_2, 295, 0, 1030, 353) GUICtrlSetState(-1, $GUI_DISABLE) $Button1 = GUICtrlCreateButton("IMG1", 100, 920, 83, 25) GUICtrlSetOnEvent($Button1, "IMG1") $Button2 = GUICtrlCreateButton("IMG2", 200, 920, 83, 25) GUICtrlSetOnEvent($Button2, "IMG2") $Button3 = GUICtrlCreateButton("IMG3", 300, 920, 83, 25) GUICtrlSetOnEvent($Button3, "IMG3") GUISetState(@SW_SHOW) _GDIPlus_Startup() $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form1) $hBitmap = _GDIPlus_BitmapCreateFromGraphics(1030, 547, $hGraphics) $buffer = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($buffer, 2) While 1 Sleep(10) WEnd Func IMG1() _GDIPlus_GraphicsDrawImageRect($buffer, _GDIPlus_ImageLoadFromFile($interface_1), 0, 0, 1030, 547) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 295, 352, 1030, 547) EndFunc ;==>IMG1 Func IMG2() _GDIPlus_GraphicsDrawImageRect($buffer, _GDIPlus_ImageLoadFromFile($interface_2), 0, 0, 1030, 547) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 295, 352, 1030, 547) EndFunc ;==>IMG2 Func IMG3() _GDIPlus_GraphicsDrawImageRect($buffer, _GDIPlus_ImageLoadFromFile($interface_3), 0, 0, 1030, 547) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 295, 352, 1030, 547) EndFunc ;==>IMG3 Func _Exit() Exit EndFunc ;==>_Exit imagesdld.zip
  20. I have already found a forum with this discussion, but it is an old thread and many links there no longer work It seems that this problem is major and there are not many solutions for it.
  21. I have 16 Gb RAM, not my equipment is the problem. The problem is the "GUICtrlSetImage" function When you use it, it's actually flickering and doesn't look professional. I tried all , I tried to use "GUICtrlSetState (-1, $ GUI_HIDE)" before GUICtrlSetImage, but it has no effect.
  22. Nothning...? Ok, Thanks
  23. Hello guys! I'm new to this forum, I have a problem where I tried to find a solution for 1 day, but I didn't find a solution. I have a script with many images, much more complicated than the attached example, the problem is that when I use the "GUICtrlSetImage" function, several times, it starts to flickers. If anyone knows how to solve this, I appreciate it! Thanks! #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 1051, 613, 192, 124) $Pic1 = GUICtrlCreatePic("1.bmp", 0, 0, 1030, 547) $Button1 = GUICtrlCreateButton("SWAP", 56, 576, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUICtrlSetImage($Pic1, Random(1, 3, 1) & ".bmp") EndSwitch WEnd test flipping.zip
×
×
  • Create New...