LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-18-2019, 04:33 AM   #1
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,673
Blog Entries: 3

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
dialog --form slackware in my apple


I own a nice Mac book pro and run Linux in virtual box. before you say why an Apple.
They make a dang good laptop takes a beating. I run Slackware Virtual box 99 percent of the time.
really hate mac interface.
Ok so I been working on a project with dialog, xdialog and kdialog.
on the mac in slackware Virtualbox copy paste fine into dialog xdialog and kdialog.
on native slackware or slackware running Virtual box unable to paste into the form box.
here is a snippet
Of what I am playing with.


Code:
#!/bin/bash
ACCT=$(whoami)
CWD=$(pwd)
dialog --backtitle "YTTS-setup" --title "Dialog - Form" \
--form "\nDialog Welcome YTTS setup $ACCT " 25 60 16 \
"1 git hub truck company name          1:" 1 1 "" 1 34 25 60 \
"2 git hub truck company URL           2:" 2 1 "" 2 34 25 60 \
"3 company abbreviation                 3:" 3 1 "" 3 34 25 60 \
"4 company address                      4:" 4 1 "" 4 25 25 60 \
"5 company phone Numbers               5:" 5 1 "" 5 34 25 60 \
2>$CWD/form.txt

repcomin=$(sed -n 1p form.txt)
gitname=$(sed -n 2p form.txt)
coabrev=$(sed -n 3p form.txt)
address=$(sed -n 4p form.txt)
phone=$(sed -n 5p form.txt)
rm $CWD/form.txt
so what am I missing. ???
 
Old 04-19-2019, 04:06 PM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2.1.2 on Lenovo Thinkpad W520
Posts: 8,831

Rep: Reputation: Disabled
Hello,

It is unclear to me what you want to copy and paste and how, so I don't know what I should try to reproduce.

Do you want to feed some of the input fields with the mouse using the middle button? Using shortcuts like Ctrl+C then Ctrl+V? Doing that in a console or in a terminal for X?
 
Old 04-19-2019, 11:21 PM   #3
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 181

Rep: Reputation: 95
Show, don't tell ;)

You need to look at the raw output of whatever dialog utility you use to see how to parse it correctly. I haven't used forms myself, but I've done a lot with selection lists using yad which is a fork of Zenity. It tends (by default) to put out results separated by vertical bars on one line.

So, if you show us an example of what your dialog emits for a couple of different inputs, we should be able to come up with a reasonable way to parse it as desired. Of course, you'll have to specify what that desired output is supposed to look like.
 
Old 04-20-2019, 11:50 AM   #4
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,673

Original Poster
Blog Entries: 3

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
Quote:
It is unclear to me what you want to copy and paste and how, so I don't know what I should try to reproduce.
Hi D thanks for the reply you know running slackware 14.2 in virtualbox. Since i been on the road i use an apple for a laptop.
Trying to figure out why able to copy paste in dialog in mac run Vbox and not in native linux or linux 14.2 runing in virtualbox in native linux.
Why does Mac OS buffer this and not slackware native or slackware running in Vbox on slackware.
Work weeks on stuff on the road come home. And not work native . That caused this Thread.
Quote:
You need to look at the raw output of whatever dialog utility you use to see how to parse it correctly. I haven't used forms myself, but I've done a lot with selection lists using yad which is a fork of Zenity. It tends (by default) to put out results separated by vertical bars on one linux
Thanks you Joe will look at how that is done. CTRL V will paste it invisible in linux.
white if blue in mac virtualbox. No need for zenity it isn't native to slackware. But will port it to zenity soon. for the gtk gnome users.

Last edited by Drakeo; 04-20-2019 at 11:55 AM.
 
Old 04-21-2019, 08:04 AM   #5
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 181

Rep: Reputation: 95
Cool Answer with overkill

Just reread your post. It sounds like you're saying your dialog works fine, but you can't paste data from your clipboard into the form it displays. If that's the case, then try using Ctrl+Shift+V. I don't think the Mac has an Insert key, but if it does, you can also try using Shift+Insert. These sometimes use different code paths and one will work when the others don't.

I just tried your script. It works strangely on my KDE/kubuntu 18.04 system. I can use the arrow keys to get to any field and Ctrl+Shift+V works (Ctrl+V does not), but as soon as I paste into any one field, the dialog exits. If I just type, I can get to all the fields as expected.

One other note: in your code sample, you don't quote your variables, so a user entering a response with embedded white space may produce unexpected results.

-----

Totally unnecessary, but I figured it out, so I might as well share it

You probably know this, but you can avoid having to deal with cleaning up a temporary file (which might remain behind if the script catches a signal such as the user pressing Ctrl+C while it's running.)

This is a little tricky since you need to extract several separate variables from the dialog output and dialog puts the results on stderr. (This is easier if you can use a GUI dialog manager because they put their results on stdout.)

Code:
#!/bin/bash
## Redirection technique from:
## http://sebthom.de/158-bash-capturing-stderr-variable/

ACCT=$(whoami)

## Still using sed

output=$(dialog --backtitle "YTTS-setup" --title "Dialog - Form" \
--form "\nDialog Welcome YTTS setup $ACCT " 25 60 16 \
"1 git hub truck company name          1:" 1 1 "" 1 34 25 60 \
"2 git hub truck company URL           2:" 2 1 "" 2 34 25 60 \
"3 company abbreviation                 3:" 3 1 "" 3 34 25 60 \
"4 company address                      4:" 4 1 "" 4 25 25 60 \
"5 company phone Numbers               5:" 5 1 "" 5 34 25 60 \
3>&1 1>&2 2>&3)

##echo "[$output]"
repcomin="$(sed -n 1p <<<$output)"
gitname="$(sed -n 2p <<<$output)"
coabrev="$(sed -n 3p <<<$output)"
address="$(sed -n 4p <<<$output)"
phone="$(sed -n 5p <<<$output)"
echo
echo "repcomin [$repcomin]"
echo "gitname [$gitname]"
echo "coabrev [$coabrev]"
echo "address [$address]"
echo "phone [$phone]"
sleep 2

## Just using a bash array

outarr=($(dialog --backtitle "YTTS-setup" --title "Dialog - Form" \
--form "\nDialog Welcome YTTS setup $ACCT " 25 60 16 \
"1 git hub truck company name          1:" 1 1 "" 1 34 25 60 \
"2 git hub truck company URL           2:" 2 1 "" 2 34 25 60 \
"3 company abbreviation                 3:" 3 1 "" 3 34 25 60 \
"4 company address                      4:" 4 1 "" 4 25 25 60 \
"5 company phone Numbers               5:" 5 1 "" 5 34 25 60 \
3>&1 1>&2 2>&3))
repcomin="${outarr[0]}"
gitname="${outarr[1]}"
coabrev="${outarr[2]}"
address="${outarr[3]}"
phone="${outarr[4]}"
echo
echo "repcomin [$repcomin]"
echo "gitname [$gitname]"
echo "coabrev [$coabrev]"
echo "address [$address]"
echo "phone [$phone]"
 
Old 04-21-2019, 12:50 PM   #6
Drakeo
Senior Member
 
Registered: Jan 2008
Location: Urbana IL
Distribution: Slackware, Slacko,
Posts: 3,673

Original Poster
Blog Entries: 3

Rep: Reputation: 478Reputation: 478Reputation: 478Reputation: 478Reputation: 478
Thank josephj I know it is a user thing for the the gui.
Fun little project for keeping my paper work straight for my trucking company.
ported it to kdialog and working on pyqt5 .
https://github.com/Drakeo/your-truck-trans-solutions
made things easier for me. so I finally put it on the github.
there is a kdialog-YTTS branch also.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Dialog -returning to a previous dialog ArneVanP Linux - Newbie 5 12-28-2017 03:10 AM
Reproducing Alt-F2 run dialog effect (focus dialog box, dim and disable rest of desktop) in LinuxMint Cinnamon in other applications. kevin77v Linux - Desktop 0 01-20-2016 12:44 PM
[SOLVED] Would a new apple PC running Slackware 13.37 be faster than running the apple OS? Robert.Thompson Linux - Hardware 2 09-22-2011 09:55 AM
bash dialog form multiple types metalenkist Programming 0 04-30-2009 10:03 AM
Some more Functionalities with the Designer made form dialog navderm Programming 2 01-05-2009 10:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration