[Gambas-user] Drag & drop files
Phạm Quang Dương
soleilpqd at ...626...
Wed Nov 30 16:15:23 CET 2011
Hi,
For 1 of your questions, try (require gvfs library):
Library "libgvfscommon:0"
Private Extern g_object_unref(gObject As Pointer)
Private Extern g_file_new_for_uri(fUri As Pointer) As Pointer
Private Extern g_file_get_path(gFile As Pointer) As String
Public Function pathFromURI(uri As String) As String
Dim pGFile As Pointer
Dim s As String
s = uri
pGFile = g_file_new_for_uri(VarPtr(s))
s = g_file_get_path(pGFile)
g_object_unref(pGFile)
Return s
End
No matter file exists or not.
2011/11/28 Maria <geaplanet at ...397...>
> Hi!
>
> I was trying drag&drop posibilities in Gambas and I was wondering if you
> could help me with a problem I found.
>
> I create a button with the DROP property TRUE. Then I write this:
>
> PUBLIC SUB button_Drop()
>
> DIM a AS String
>
> a = Drag.Paste()
> a = RTrim(a)
> EXEC ["gedit", a]
> END
>
>
> This works. Drag.Paste get the file I droped, but in an horrible html
> format, with %20 in spaces and other
> characters like ñ áéíóú, etc... AND starting with "file://"
> Gedit works because untherstand this format, butmust commands do not
> understand this format. AND it finishes with a strange character that I
> have to cut with RTrim otherwise I would not work.
>
> Now the questions:
>
> How to get a lot of files droped into the button?
> How to get real and good path for all applications can untherstand it?
>
> I would like to get a simple application for massive treatment of files,
> for example, to use with "convert" for converting png into jpg, resizing
> images, rotating, etc... or for using with "lame" for mp3 converting,
> etc...
>
> I normally use in a terminal bash with $@ for getting all files like
> parameters, and I do something like this:
>
> for i in "$@"; do
>
> convert -rotate -90 "$i" "$i"
>
> ;done
>
>
>
> How to do this in Gambas?
>
> Thanks.
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list