Jump to content
corz

drag and drop images from web browser to GUI

Recommended Posts

corz

We've been able to drag images out of web browsers since forever. Can I drag one into my GUI?

Or rather, can I drag an image from my web browser onto my GUI and have my app *do* something with that image?

My fingers bleed from searching. Any ideas much appreciated!

;o) Cor


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
corz

The title says it all, really. Is it possible to drag an image from a web browser (say, Chrome) and have it *do* something in my app, aside from a the "Don't Bother" cursor?

I could have sworn I had a GUI that accepted drags from browsers but I can't pin it down. My web searching is just as fruitless.

Anyone have any clues?

;o) Cor


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
JLogan3o13

Why are you posting this again? Threads merged, please stick to one topic.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
corz

lol! I forgot I'd already asked! Cheers for noticing. Feel free to delete either post, of course.

I guess no answers means no one knows. Och well.

;o) Cor


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
JLogan3o13
14 hours ago, corz said:

I guess no answers means no one knows. Och well.

Or you're being impatient or haven't provided a detailed explanation as to what you're trying to accomplish...


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
corz

No, it's definitely what I said.

And no more explanation is possible.

;o) Cor


nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
Chimp

In short you should first register the WM_DROPFILES message in your gui with something like this: GUIRegisterMsg($WM_DROPFILES, "WM_DROPFILES") and then manage the dropped images within your WM_DROPFILES() function.
For an example have a look to this script by @UEZhttps://www.autoitscript.com/forum/topic/190642-ascii-art-kaleidoscope/?do=findComment&comment=1368827
Following the example by UEZ I've also used it in this other my script: https://www.autoitscript.com/forum/topic/190921-tsp-art-generator

In both above example scripts you can drag an images from a browser and drop it on the GUI where it is catched and used as needed.

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
corz

Chimp, thanks!

Trouble is, I already use WM_DROPFILES messages. I was accessing the DLL directly rather than using the WinAPI UDF (I hadn't noticed those functions) so I tried switching over to the UDF versions (much leaner code, thanks!) but it made no difference.

I then tried fiddling with the GUICreate style attributes (looking at your example GUIs), but again with no effect.

I ran the Kaleidoscope program (nice!) but on my system, dragging images from a web browser into it window won't work. Just like with my own app I get the "NO ENTRY" icon and nothing happens.

Is this all supposed to work?

Could there be something up with my system, perhaps? A security setting or something?

;o) Cor

Edited by corz

nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites
Chimp

I just tried, and: if I drag from firefox to the GUI everything works fine, but if I drag from IE I get a "no entry" icon. Since I normally use firefox I did not notice this "nice" feature of IE. If you drag an image from a folder from your hard drive it should work too (can you confirm?)
(I am not surprised by these oddities generated by IE ... often rather than simplify things with IE are further complicated ....)

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
corz

I'm using Chrome. I don't even have Firefox installed right now. Hadn't tried IE.

Most peeps use Chrome nowadays so I'd like it to work there.

;o) Cor

ps. I just tried it in Edge. It works! Uses the path to the cached image, though, rather than the URL.

Edited by corz

nothing is foolproof to the sufficiently talented fool..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • odaylton
      By odaylton
      Hello everyone ,
      Text translated from Portuguese by google - please apologize for any errors

      Once again I need a light from the gurus of this wonderful website
      I am fanatic by combobox for its usability but I am not able to uncertain images within lists ...
      I know uncertain icons, and cursors but I am not able to insert gif or jpg images.
      1) How to solve this ...
      2) will the path is to convert gif into bmp and then uncertain ... how to do that?
      #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ;dados de mouse #include <WinAPIRes.au3> ;COMBO #include <GuiComboBoxEx.au3> ;Fonts #include <FontConstants.au3> ;obter imagem de arquivo #include <GDIPlus.au3> #include <WinAPIGdi.au3> Example() Func Example() Local $hGUI, $hImage, $hCombo, $hFont Local $idListview, $hImage Local $sWow64 = "" Local $Pasta = "C:\WINDOWS\Cursors\3dgarro.cur" Local $PastaROMs = @MyDocumentsDir & "\Stella\ROMs\" ;com barra no final $hGUI = GUICreate("ImageList", 500, 310) GUISetFont(14, 400, 0, "Arial") ;<<<<<<<<<<this does not work for _GUICtrlComboBoxEx_Create $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 494, 200) ;GUICtrlSetFont($hCombo, 14, 400, 0, "Arial");<<<<<<<<<<It does not work ; ;Create a handle to a font object $hFont = _WinAPI_CreateFont(30, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') ;Pass the handle to _WinAPI_SetFont _WinAPI_SetFont($hCombo, $hFont) $idListview = GUICtrlCreateListView("", 2, 50, 494, 250, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Initialize GDI+ library _GDIPlus_Startup() ; Load images $hImage = _GUIImageList_Create(120, 70, 6, 2) ;32,32,5,5) ; $DadosCombo = "Escolha|" & _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0x0000FF, 120, 70)) ;Local $aCursors[] = [32650, 32512, 32515, 32649, 32651, 32513, 32648, 32646, 32643, 32645, 32642, 32644, 32516, 32514] For $i = 1 To 10 $sFile = FileOpenDialog("Please select an image", $PastaROMs, "Image (*.jpg;*.png;*.bmp;*.gif;*.tif)", BitOR($FD_PATHMUSTEXIST, $FD_FILEMUSTEXIST)) If @error Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "No image file has been selected", 30) $a = _GDIPlus_BitmapCreateFromFile ($sFile);<<<<< ok If @error Or Not $hImage Then MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "This file isn't supported by GDIPlus!") Else $b=_GUIImageList_Add($hImage, $a);<<<<<< Return -1 $DadosCombo &= "|" & $i & "_img_princ.gif""|" & $b EndIf Next _GUICtrlListView_SetImageList($idListview, $hImage, 1) _GUICtrlComboBoxEx_SetImageList($hCombo, $hImage) ; Add columns _GUICtrlListView_AddColumn($idListview, "Icons - Mouses", 350) ; Add items $a = StringSplit($DadosCombo, "|") For $i = 1 To $a[0] Step 2 _GUICtrlListView_AddItem($idListview, $a[$i], $a[$i + 1]) _GUICtrlComboBoxEx_AddString($hCombo, $a[$i], $a[$i + 1], $a[$i + 1]) Next ;AutoIt_Debugger_Command:Disable_Debug ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() ;AutoIt_Debugger_Command:Enable_Debug EndFunc ;==>Example tks
    • Reziskonh
      By Reziskonh
      Hi, everybody
      I look for GUI whose behavior similar to the message of an email client or antivirus
      In other words:
          Any PC screen able to calculate the size
          To consider the Task bar size
          To find the lower corner on the right/below and to nestle on it

      Notes:
      In GUI the GUICtrlCreateEdit field (as option) - that can be received and displayed through variable information
      Thanks a lot
      PS
      I use the translator, excuse if something is not clear
       

    • VollachR
      By VollachR
      Hi,
      I'd like to show a progress bar for an operation performed by an external program my script is running silently, I want to show it in a GUI I created using the GUICtrlCreateProgress but I have no idea how to do it.
      The important thing to point out is that there's no way of knowing how long the external program will run, as it is a file splitter and it depends on the size of file it splits and the split parts size.
      Can someone point me in the right direction or give me an example how to do so?
      This is my RunWait command:
      RunWait($MYFILES1 & '\fsplit.exe -split ' & $Size & ' mb ' & $File & " -f " & $File & "." & $extension) It uses multiple variables declared and set earlier in the script, how will I got about having the progress of that command shown using GUICtrlCreateProgress ? Is it possible?
      Thank you.
    • nacerbaaziz
      By nacerbaaziz
      Hello my friends
      I have an inquiry and I hope to find the answer here
      I want to create a graphical user interface
      but I want to hide the system menu
      I mean the window menu
      Is this possible?
      If is possible please give me how to do that
      Thanks in advance
    • helmar
      By helmar
      I was playing around with simple GUI creation.  I tend to like parameter driven coding (in prior life (years ago) as Clipper/FoxPro/dBase coder).  Just wanted to see what I could do with a GUI.
      #Region options, includes Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) ; Change to OnEvent mode #include <GUIConstantsEx.au3> #EndRegion options, includes Global Const $nCols = 2, $nRows = 6, $nSpacer = 10, $nBtnWidth = 150, $nBtnHeight = 30 Global $xName = 0, $xID = 0 Global $nGUIWidth = ($nCols * $nBtnWidth) + (($nCols + 1) * $nSpacer) Global $nGUIHeight = ($nRows * $nBtnHeight) + (($nRows + 1) * $nSpacer) Global $hMainGUI = GUICreate("Calculated GUI", $nGUIWidth, $nGUIHeight, -1, -1) For $xRows = 1 to $nRows ;in this arrangement, tabbing is left to right, then next row For $xCols = 1 to $nCols ;reverse the order of this line with the prior line for top to bottom tabbing, then next col $xName += 1 $xID += 1 Global $Dummy = GUICtrlCreateButton("Button" & $xName, _ ($nBtnWidth * ($xCols - 1)) + (($xCols - 1) * $nSpacer) + $nSpacer, _ ($nBtnHeight* ($xRows - 1)) + (($xRows - 1) * $nSpacer) + $nSpacer, _ $nBtnWidth, _ $nBtnHeight) GUICtrlSetOnEvent($xID+2, "Handler") Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "CloseApp") GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd Func CloseApp() Exit EndFunc Func Handler() MsgBox(0,0,"Button " & @GUI_CtrlId - 2) EndFunc  
×