Register
It is currently Thu Jul 24, 2014 8:38 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???

Thanks


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

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

Code:
FILENAME=`zenity --file-selection`
FCEU $FILENAME


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

Code:
FILENAME="$(zenity --file-selection)"
FCEU "${FILENAME}"


This should hopefully stop any requirement for convoluted seds :)

I hope that helps :)


Top
 Profile  
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: Yahoo [Bot] and 5 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:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP