English Amiga Board


Go Back   English Amiga Board > Coders > Coders. System > Coders. Scripting

 
 
Thread Tools
Old 13 August 2020, 10:37   #1
Starfox
Registered User

 
Join Date: Aug 2020
Location: Germany
Posts: 16
AmigaDos 1.3 Ask with User Input into Variable

Hi,


i would like to code a Question asking about what Drive to use as source and the same as destination (df0: df1: etc..)



I use a normal Workbench 1.3 Shell Script executed over IconX.


My Problem is this Script won´t accept set or unset and requestchoice and my Workbench 1.3 Shell also.


It´s a script for Disksalv to make it easy to use and more comfortable.


In Picture i have the part of the code i coded to ask for Formatted Disk in Destination drive or not.



But how to save the user input into a variable and Ask a Question without only y and n ?
Attached Thumbnails
Click image for larger version

Name:	workbench1-real-2008131033-01.png
Views:	37
Size:	9.4 KB
ID:	68470  
Starfox is offline  
Old 13 August 2020, 16:48   #2
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,541
Code:
Echo "Which drive?"
Set >nil: drive ?
Echo $drive
Should do what you want.

Edit: Or not as I missed the "1.3" requirement.
StingRay is offline  
Old 13 August 2020, 21:17   #3
Matt_H
Registered User
Matt_H's Avatar
 
Join Date: Jul 2008
Location: Boston, MA
Posts: 262
This isn’t a direct answer to your question, but I think DiskSalv can be controlled pretty well through project icons and tooltypes, so that might be another way to achieve what you’re trying to do.
Matt_H is offline  
Old 14 August 2020, 00:50   #4
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 2,907
@starfox : Adapt, shorten, optimize, etc... it to you needs

malko is offline  
Old 14 August 2020, 09:21   #5
Starfox
Registered User

 
Join Date: Aug 2020
Location: Germany
Posts: 16
Thanks to all this helps me very much
Starfox is offline  
Old 15 August 2020, 16:50   #6
Starfox
Registered User

 
Join Date: Aug 2020
Location: Germany
Posts: 16
Additional Question:

Is there any way to Display 2 Variables in 1 Line or put 2 variables together ?

My destination is to Display "diksalv var1 var2"
Starfox is offline  
Old 16 August 2020, 14:25   #7
Starfox
Registered User

 
Join Date: Aug 2020
Location: Germany
Posts: 16
I have created a solution for my Script.


Feel free to Optimize it.


Code:
.key ""
.bra {
.ket }
echo "***** Disksalv 1.42 Disketten Rettungs Tool ******"
echo ""
echo "** Disksalv rettet Daten von einer beschädigten **"
echo "** Quell-Diskette und kopiert diese auf eine    **"
echo "** frisch formatierte Ziel-Diskette.            **"

IF NOT EXISTS Disksalv
echo "Fehler Programm Disksalv nicht gefunden !"
echo "Programm wird beendet."
wait 1
ENDCLI
ENDIF

LAB Question
echo ""
echo "Bitte wählen Sie das Quell-Laufwerk und Ziel-Laufwerk"
echo "1 = QUELLE df0: ZIEL df1:"
echo "2 = QUELLE df1: ZIEL df0:"
echo "3 = QUELLE df1: ZIEL df2:"
echo "4 = QUELLE df2: ZIEL df1:"
echo "5 = QUELLE df0: ZIEL df2:"
echo "6 = QUELLE df2: ZIEL df0:"

SETENV >NIL: choice ?


IF $choice NOT VAL GT 0
echo "Falsche Eingabe bei der Auswahl des Quell und Ziel Laufwerks."
wait 1
SKIP BACK Question
ENDIF

IF $choice GE 7
echo "Falsche Eingabe bei der Auswahl des Quell und Ziel Laufwerks."
wait 1
SKIP BACK Question
ENDIF


IF $choice VAL EQ 1
ask "*N Die Ziel-Diskette vorher formatieren ? (y/n)"
IF WARN
disksalv df0: df1: FORMAT
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ELSE
disksalv df0: df1:
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ENDIF
ENDIF

IF $choice VAL EQ 2
ask "*N Die Ziel-Diskette vorher formatieren ? (y/n)"
IF WARN
disksalv df1: df0: FORMAT
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ELSE
disksalv df1: df0:
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ENDIF
ENDIF


IF $choice VAL EQ 3
ask "*N Die Ziel-Diskette vorher formatieren ? (y/n)"
IF WARN
disksalv df1: df2: FORMAT
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ELSE
disksalv df1: df2:
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ENDIF
ENDIF

IF $choice VAL EQ 4
ask "*N Die Ziel-Diskette vorher formatieren ? (y/n)"
IF WARN
disksalv df2: df1: FORMAT
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ELSE
disksalv df2: df1:
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ENDIF
ENDIF

IF $choice VAL EQ 5
ask "*N Die Ziel-Diskette vorher formatieren ? (y/n)"
IF WARN
disksalv df0: df2: FORMAT
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ELSE
disksalv df0: df2:
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ENDIF
ENDIF

IF $choice VAL EQ 6
ask "*N Die Ziel-Diskette vorher formatieren ? (y/n)"
IF WARN
disksalv df2: df0: FORMAT
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ELSE
disksalv df2: df0:
echo "Rettung der Diskette abgeschlossen."
echo "Programm wird geschlossen."
wait 5
ENDCLI
ENDIF
ENDIF
Starfox is offline  
Old 17 August 2020, 00:46   #8
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 2,907
Quote:
Originally Posted by StingRay View Post
Code:
Echo "Which drive?"
Set >nil: drive ?
Echo $drive
Should do what you want.

Edit: Or not as I missed the "1.3" requirement.
Redirecting the command to nil: to prevent the diplay of the "help" raised by the question mark while the variable name is provided is interesting. also working under 1.3 with SetEnv. thanks for the tip

Last edited by malko; 17 August 2020 at 01:08. Reason: typo
malko is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable injection? solarmon support.WinUAE 12 20 January 2019 12:05
AmigaDOS wait for user input Sinphaltimus Coders. Scripting 11 25 February 2018 02:47
WHDload 17.1 problem with user input Fieldday project.WHDLoad 10 27 February 2013 08:54
getting a user to press a key via AmigaDOS DeafDaz Coders. System 3 10 January 2012 17:37
Variable Master Clock wiltshireguyuk request.UAE Wishlist 0 13 December 2004 16:40

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 On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.07990 seconds with 16 queries