WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Output RELDIR with URL encoded forward slashes (Read 5362 times)
Viktor
YaBB Newbies
*
Offline



Posts: 3
Output RELDIR with URL encoded forward slashes
Oct 9th, 2013 at 12:12pm
 
Hello,
I'm trying to create a task that monitors for new subdirectories containing TIF files and then creates a copy of a HTML file with the name of the new subdirectory replacing a placeholder in the HTML file. I was initially trying to do this with the Create HTML plugin, but found that it does not support TIF files and even if it did it is simply too specifically designed to be used only for the HTML image gallery.

I then found a VBS script ( http://stackoverflow.com/questions/1115508/batch-find-and-edit-lines-in-txt-file ) that could handle the replace task, but I was unable to get the script to load the WD_RELDIR variable (or any WD variable) correctly, even when using the sample code from the template.

Then finally after browsing this forum I found this thread ( http://www.watchdirectory.net/cgi-bin/yabb2/YaBB.pl?num=1141920455/4#4 ) with a Change.exe file that replaces text and accepts the WD variables directly and with this I was able to get the task done.

Now the task works as long as the new subdirectory is on the first level, but if you add a subdirectory within another subdirectory the RELDIR variable is output with a backslash (\) between the directories and this breaks the HTML-code. The application that the HTML loads requires URL encoded forward slashes (%2F) between directories to work properly.

I have tried creating a second task that detects the modified HTML file and then replaces the \ with %2F but have been unable to do so both with the Change.exe and VBS script. They both seem to interpret the backslash as a command for the script rather than a text that should be replaced. I have also tried some batch-scripting for this, but it always seems to remove more than just the backslash from the HTML file breaking it in the process.

The ideal solution would be to get the first task to directly output the %2F in place of the backslash, but I don't think that is possible unless a new RELDIR_ENCODED variable is added to watchDirectory. So what I need is some way to get the Change.exe to replace the backslash or some new script that will do this without breaking anything else in the HTML file so I can run this as a followup-task.

I'm also wondering why the Start any Program plugin does not support the QUIET event. I want the task to edit the HTML file only when all TIF files (amount varying from 4 to 400) definitely have been added into the new subdirectory. This worked nicely with the Create HTML plugin and the Bat File and VBS script plugins also seem to support this. I don't see why it wouldn't be possible to delay the running of an EXE file in the same way.

I appreciate any help you can give on this matter!
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Output RELDIR with URL encoded forward slashes
Reply #1 - Oct 10th, 2013 at 7:24am
 
Hello Viktor,

This command seems to work for me inside a bat file:
Code:
change testi.txt testo.txt \ %%2f
 



Handling of % chars is always a bit weird in bat scripts.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Viktor
YaBB Newbies
*
Offline



Posts: 3
Re: Output RELDIR with URL encoded forward slashes
Reply #2 - Oct 10th, 2013 at 9:00am
 
So I was trying to fix the \ character when it was really the % that was causing the problems. Thank you for pointing this out, I got it to work now! And thank you for the excellent watchDirectory program, it is very useful.

Any comment why the Start any Program plugin is missing the QUIET event? Could this be added in a future version or should I just make another bat file that runs the Change.exe so I can use QUIET in the task?

Thanks again!
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2225
The Netherlands
Re: Output RELDIR with URL encoded forward slashes
Reply #3 - Oct 10th, 2013 at 9:07am
 
mmm, the missing QUIET event looks like an oversight, this will be fixed in the next beta.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Viktor
YaBB Newbies
*
Offline



Posts: 3
Re: Output RELDIR with URL encoded forward slashes
Reply #4 - Oct 10th, 2013 at 1:33pm
 
Great, thanks!

Another current limitation I noticed is that the Run Multiple Sub Tasks plugin does not support Run any Bat File (among others). Will the multiple sub task plugin support be increased in the future? It would really help keep the amount of main tasks within a reasonable amount.

Oh and the Run Multiple Sub Tasks plugin also seems to be missing the QUIET event.
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1