![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
sh_ivtool: a simple UI application for use in scripts
I've written a simple little program for popping up dialogs within script files on PocketBook E-Ink devices. You can show messages, get text or numeric input, ask a yes/no question, pop up the directory selector, and even do (clunky) file selection (based on the OpenContents dialog). I've uploaded the binaries and source code to my website: http://komary.net/sh_ivtool/. An example shell script that uses it can be seen at: http://komary.net/edit-epub/. This should make it easier to use non-trivial scripts in the Applications tab.
Last edited by rkomar; 02-11-2018 at 03:19 PM. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,832
Karma: 5843878
Join Date: Oct 2010
Location: UK
Device: Pocketbook Pro 903, (beloved Pocketbook 360 RIP), Kobo Mini, Kobo Aura
|
great, thanks!
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
Crap! I just realized that my source code and documentation for the file selection option were out of step. The unused <message> option was removed from the documentation but not the code. The source code has been updated, and the edit-epub.app, as well.
|
![]() |
![]() |
![]() |
#4 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21
Karma: 12650
Join Date: Apr 2011
Device: PB903
|
Thank you
|
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 224
Karma: 3184
Join Date: Feb 2011
Device: ONYX BOOX Note Air3 C
|
Can we choose more than one extension with -f <dir> [ext] ?
.epub;.cbz for example ? |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
No, but it sounds like a good idea and should be pretty straightforward to do. I'll post back later with the results. It will probably be a comma separated list, though, as semi-colons can affect the parsing in Unix shells.
|
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
Okay, I've uploaded a new version of sh_ivtool to the website linked in the first post. You can add multiple extensions now. By default, the names are separated by commas and/or spaces, but you can specify your own separators using the SHIVFS environmental variable. See the README.txt file for an example of that.
Last edited by rkomar; 01-04-2012 at 09:23 PM. |
![]() |
![]() |
![]() |
#8 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21
Karma: 12650
Join Date: Apr 2011
Device: PB903
|
It will be very handy if in -f <dir> [ext]:
- the directory (optionally) can be selected interactively with OpenDirectorySelector; - introduce an additional option - traversing subdirectories or not; - introduce an option for filtering the filenames; Thanks for the nice toolset |
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
Quote:
![]() The other two points would be useful and can't be worked around as above, so I agree that they should go in. I think the whole "-f" option argument structure will have to be reworked for that. Thanks for the helpful input. ![]() |
|
![]() |
![]() |
![]() |
#10 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 224
Karma: 3184
Join Date: Feb 2011
Device: ONYX BOOX Note Air3 C
|
Had to go to the source code to see the -d option, so it's missing from the readme.
I've run into a problem: Code:
#!/bin/sh SH_IVTOOL=/mnt/ext1/system/bin/sh_ivtool.app EXT=".txt .ini .php" FILE=`$SH_IVTOOL -f "/mnt/ext2/Folder" "$EXT"` if [ $? -eq 0 ]; then echo $FILE > /mnt/ext1/applications/MPlayer/test.txt fi Tried it first with sh_ivtool popping a message containing $FILE but the result is empty. Edit: Also I believe it would be more consistent and proper if -q returned its answer rather than relying on stderr , especially since right now the answer would be considered 'no' even if the user aborted. Edit2: Same thing if i build sh_ivtool for the emulator, the selected file shows on the terminal screen (with some errors) but if you try and redirect or capture the result (stdout or stderr) either by redirection or into a variable it evaporates. Edit3: Examples of those errors: -d Code:
./sh_ivtool -d "Choose one" ** Message: Command 501 selected ./system/mnt/ext1 hw_close (<unknown>:17654): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (<unknown>:17654): Gtk-WARNING **: A floating object was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with g_object_ref_sink(). Code:
./sh_ivtool -d "Choose one" > test.txt ** Message: Command 501 selected hw_close (<unknown>:17655): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (<unknown>:17655): Gtk-WARNING **: A floating object was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with g_object_ref_sink(). -f Code:
./sh_ivtool -f "/home/main/" ".m3u" ** Message: Command 501 selected /home/main/0.m3u hw_close (<unknown>:17660): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (<unknown>:17660): Gtk-WARNING **: A floating object was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with g_object_ref_sink(). Code:
./sh_ivtool -f "/home/main/" ".m3u" > test.txt ** Message: Command 501 selected hw_close (<unknown>:17673): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed (<unknown>:17673): Gtk-WARNING **: A floating object was finalized. This means that someone called g_object_unref() on an object that had only a floating reference; the initial floating reference is not owned by anyone and must be removed with g_object_ref_sink(). Last edited by J.C.; 01-05-2012 at 12:30 PM. |
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,832
Karma: 5843878
Join Date: Oct 2010
Location: UK
Device: Pocketbook Pro 903, (beloved Pocketbook 360 RIP), Kobo Mini, Kobo Aura
|
Quote:
Any suggestions on what I might be doing wrong? I did download sh_ivtool and edit-epub after your first correction (though not last night versions). On the pro I have the 2.1.2 firmware, on the 360 I think it is 15.3 (more than a year old). Thanks! |
|
![]() |
![]() |
![]() |
#12 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 224
Karma: 3184
Join Date: Feb 2011
Device: ONYX BOOX Note Air3 C
|
Quote:
Last edited by J.C.; 01-05-2012 at 12:00 PM. Reason: typo |
|
![]() |
![]() |
![]() |
#13 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
|
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,007
Karma: 18401861
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
|
@J.C.
It never occurred to me try this under the emulator (I have to build on a separate machine for that), so this is the first I've seen of these problems. Something very strange is going on in the emulated program. Using strace, I can see the output being written to stdout if it isn't redirected. If it is redirected (with '>' or e.g. 'FILE=``'), then strace shows that the write never takes place to any file descriptor. The emulator code just swallows it. It looks like I can get around it by dup'ing stdout and writing to that descriptor instead. Sigh! Such a short program, and it's already kludgy! ![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Trio of Picture Books - Simple Animals, Simple Shapes, and You're My Baby! | Manley Peterson | Self-Promotions by Authors and Publishers | 5 | 01-06-2012 08:55 PM |
Application update: application not installed error | Merischino | Kindle Fire | 4 | 12-01-2011 10:30 PM |
erm, simple question , hope for simple answer! | al zymers | Amazon Kindle | 5 | 09-25-2010 01:01 PM |
Simple question for a simple mind :) | PKFFW | OpenInkpot | 6 | 08-27-2009 09:00 PM |
Television scripts for your handheld | Bob Russell | Lounge | 2 | 01-07-2006 06:22 PM |