It is currently Mon May 21, 2018 4:51 am

Zenity file selection script for FCEU

All times are UTC - 6 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon Feb 16, 2009 10:45 pm   

Joined: Mon Jan 26, 2009 4:40 am
Posts: 3
Hi Guys

I dont really post that much here but i find it a great resource.

Basically what I want is to create a bash script that uses zenity to ask for a file and then pass it to FCEU (A NES emulator). Yes I know there is a nice GUI frontend, but members of my family are extremely computer illiterate and would like something simpler.

Its easy to launch from the command prompt (fceu <filename>), but when i use zenity --file-selection the output does not put \'s in front of the spaces or brackets (ie zenity will output /home/andy/Abadox (U).zip instead of /home/andy/Abadox\ \(U\).zip )

I fixed this up using the following sed scripts so that it will output the correct format:
FILENAME=`zenity --file-selection | sed -n 's/\ /\\\ /gp' | sed 's/(/\\\(/g' | sed 's/)/\\\)/g'` (I know...very messy)

But i still get the following error:
Starting FCE Ultra 0.98.12...
Loading \(U\).zip...

Error opening "\(U\).zip"!

Any ideas???


 PostPosted: Tue Feb 17, 2009 10:37 am   
User avatar

Joined: Thu Oct 11, 2007 7:12 am
Posts: 265
Location: London - UK
Hi, you don't include how FCEU is called but i assume it's something like so;

FILENAME=`zenity --file-selection`

If that's similar then extra quotes etc might help...

FILENAME="$(zenity --file-selection)"

This should hopefully stop any requirement for convoluted seds :)

I hope that helps :)

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group