Some weird button issues

hi, a friend of mine created a really cool "imageshack"-like button. you can upload an selected image to an ftp-server with just one click.

i tried to optimize the function a little bit, becaus in his button, you have to stay in the left lister as source.

for example, the original function of my mate:

@admin
@set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp}
@set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100}
@set file = {dlgstringS|Name|screen}
Image CONVERT={$format} QUALITY={$quality} AS tempimage HERE
Go FTPSITE=monopix OPENINRIGHT
Copy tempimage.{$format} MOVE AS {$file}.{$format}
Clipboard SET http://www.monotonique.de/pix/{$file}.{$format} 

you get some option fields for image format, quality and filename. then the function connects to the ftpserver and moves the image.

my optimized function:

@admin @set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp} @set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100} @set file = {dlgstringS|Name|screen} Go CURRENT OPENINLEFT NEWTAB Set FOCUS=Left Image CONVERT={$format} QUALITY={$quality} AS tempimage HERE Go FTPSITE=images.0workx.de OPENINRIGHT NEWTAB Copy tempimage.{$format} MOVE AS {$file}.{$format} Clipboard SET http://images.0workx.de/view/{$file}.{$format}

its working untill the image conversion, but it will not upload the image onto the ftp server. it opens up a new tab, but nothing else will happen.

the weird thing is, i used it in an other function, where i can upload images directly from the clipboard to an ftp server (like this):

@admin @set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp} @set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100} @set file = {dlgstringS|Name|screen} Set FOCUS=Left GO PATH G:\_converted-tmp OPENINLEFT NEWTAB Clipboard PASTE Select NONE Select Zwischenablagebild.bmp Image CONVERT={$format} QUALITY={$quality} AS Zwischenablagebild HERE Go FTPSITE=images.0workx.de OPENINRIGHT NEWTAB Copy Zwischenablagebild.{$format} MOVE AS {$file}.{$format} Clipboard SET http://images.0workx.de/view/{$file}.{$format} Delete Zwischenablagebild.bmp QUIET Go TABCLOSE

and this is working very well. thats the reason why i am a little bit confused.

would be nice if you can find out, why my upload function is not working.

tia

volker

It's nice to see the new variables and drop-down lists being used. :slight_smile:

It might be something else but I think it's probably going wrong because of timing issues. For example, when you tell Opus to open something in the destination pane Opus will not wait for that folder to finish loading before running the next line of the command, because the loading gets done in the background.

You can insert some delays between the commands by using ping (or some other command that causes a delay) to make the button more reliable. Have a look at the horrible hack that I posted to this thread for a (bad) example. Of course, this isn't ideal because if things are running slowly one day then it will go wrong.

You may also find you have to prefix the lines (except the variable settings stuff at the top) with "@sync: dopusrt" but give it a try without that first as it's hopefully not needed.

You can also avoid having to open the destination panel completely by specifying the FTP site as the destination for the Copy command. Unfortunately if you do this you have to put the site's password in the button (or request the password via the {Rs} dialog box every time the button is run). This is beacuse you can't give the copy command a site bookmark name; instead you have to give it an FTP URL like ftp://user:pass@site//dir/dir

all right then, thanks.

you mean, it is because the convert cmd is finished before the ftp tab is opened?

ok, how do i use the copy cmd with a absolute path kind of ftp://user:pass@foo.bar:port/in/this/dir/file.suf

?

//edit:

damn, i dont get it. in my clipboard button it is working so fine. but on that simple one it wont.

@admin
@set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp}
@set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100}
@set file = {dlgstringS|Name|screen}

// open whereever i am a new tab on the left side and set as source - ok
Go CURRENT OPENINLEFT NEWTAB 
Set FOCUS=Left
Set STATE=Source
// convert image in the left tab - ok
Image CONVERT={$format} QUALITY={$quality} AS tempimage HERE

// open the ftp folder in a new tab - ok
Go FTPSITE=images.0workx.de OPENINRIGHT NEWTAB

// copy the image to the dest folder - failed
Copy tempimage.{$format} MOVE AS {$file}.{$format}

// copy url to clipboard - ok
Clipboard SET http://images.0workx.de/view/{$file}.{$format}

i really really dont get it :frowning:

Button #1: Convert Image to a TMP Folder and moves it onto a FTP-Server from your Sitelist

@admin
@set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp}
@set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100}
@set file = {dlgstringS|Name|screen}
@set url = INSERT-YOUR-URL-HERE-FOR-CLIPBOARD
@set ftp = INSERT-YOUR-FTP-SITE-FROM-LIST-HERE
@set tmp = INSERT-YOUR-TMP-FOLDER-HERE

@sync dopusrt.exe /cmd Image CONVERT={$format} QUALITY={$quality} AS tempimage TO {$tmp}
@sync dopusrt.exe /cmd Go {$tmp} OPENINLEFT NEWTAB=tofront
Set STATE=Source
@sync dopusrt.exe /cmd Go FTPSITE={$ftp} OPENINRIGHT NEWTAB=tofront
Set STATE=Dest
Set FOCUS=Left 
@confirm
@sync dopusrt.exe /cmd Copy {$tmp}/tempimage.{$format} MOVE AS {$file}.{$format}
Clipboard SET {$url}/{$file}.{$format}
@sync dopusrt.exe /cmd Go TABCLOSE

(tanks to uwe/dasitsch for helping me)

button #2: Copy Image from Clipboard onto a FTP-Site from your List

@admin
@set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp}
@set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100}
@set file = {dlgstringS|Name|screen}
@set url = INSERT-YOUR-URL-HERE-FOR-CLIPBOARD
@set ftp = INSERT-YOUR-FTP-SITE-FROM-LIST-HERE
@set tmp = INSERT-YOUR-TMP-FOLDER-HERE

Set FOCUS=Left
GO PATH {$tmp} OPENINLEFT NEWTAB
Clipboard PASTE
Select NONE
Select Zwischenablagebild.bmp
Image CONVERT={$format} QUALITY={$quality} AS Zwischenablagebild HERE
Go FTPSITE={$ftp} OPENINRIGHT NEWTAB
Copy Zwischenablagebild.{$format} MOVE AS {$file}.{$format}
Clipboard SET {$url}/{$file}.{$format}
Delete Zwischenablagebild.bmp QUIET
Go TABCLOSE

it works fine on vertical dual listers.

have fun. maybe an mod moves this to the button area.

Just having a quick look at this. I think most of your problems were caused by opening a new tab showing the current source? I'm not sure why you're doing this, but the problem is that when a new source window opens, Opus reevaluates the selected files, and since there are none the function has nothing to work on.

The following seems to work fine for me:

[code]@set format = {dlgchoose|Format|GIF=gif+JPG=jpg+PNG=png+BMP=bmp}
@set quality = {dlgchoose|Qualität|niedrig=30+mittel=60+hoch=80+original=100}
@set file = {dlgstringS|Name|screen}
@set url = INSERT-YOUR-URL-HERE-FOR-CLIPBOARD
@set ftp = INSERT-YOUR-FTP-SITE-FROM-LIST-HERE
@set tmp = INSERT-YOUR-TMP-FOLDER-HERE

Image CONVERT={$format} QUALITY={$quality} AS tempimage TO {$tmp}
Go FTPSITE={$ftp} OPENINRIGHT NEWTAB=tofront
Copy {$tmp}/tempimage.{$format} MOVE AS {$file}.{$format}
Clipboard SET {$url}/{$file}.{$format}
[/code]

thx mate, but in my last post the two functions working as the supposed to.

I know, just explaining why the original one didn't...

If the OPENINRIGHT is changed to OPENINDUAL then the button will work when you're using the right-hand file display, too.