Forums

[Script] Watchtower Library

Auteur Réponses
wblake0000 Lundi 27 Janvier 2014 à 6:07
wblake0000Anonymous

Watchtower Library is a Bible study aid research tool
Nothing was special about this installation as it's a platinum rated app:
http://appdb.winehq.org/objectManager.php?sClass=application&iId=1485
I delete a .lnk file that is created on the users desktop after wine installs the program. Is this typical? (I'd hate to have a dead link on the desktop)

[code language=playonlinux]
#!/bin/bash
# Date : 2014-01-25 13-47
# Last revision : 2014-01-25 13-47
# Wine version used : 1.7.11
# Distribution used to test : MAC OSX 10.9.1
# Author : William Blake
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

# Variable
TITLE="Watchtower Library"
PUBLISHER="Watchtower Bible and Tract Society of PA"
PREFIX="Watchtower"
URL="http://www.jw.org"
AUTHOR="William Blake"

# Initialization
POL_SetupWindow_Init
POL_Debug_Init

# Presentation
POL_SetupWindow_presentation "$TITLE" "$PUBLISHER" "$URL" "$AUTHOR" "$PREFIX"

# Create Prefix
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate

# Select Installation Method
POL_SetupWindow_InstallMethod "CD,LOCAL"
if [ "$INSTALL_METHOD" = "CD" ]
then
   POL_SetupWindow_cdrom
   POL_SetupWindow_check_cdrom "Setup.exe"
   POL_Wine start /unix "$CDROM/Setup.exe"
elif [ "$INSTALL_METHOD" = "LOCAL" ]
then
   POL_SetupWindow_browse "$(eval_gettext 'Please select the $TITLE {Setup.exe} file')" "$TITLE"
   POL_Wine start /unix "$APP_ANSWER"
fi

# Wait for Installation to Exit
POL_Wine_WaitExit

POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed')" "Installation in progress"

# Create Shortcuts
POL_Shortcut "wtlibrary.exe" "$TITLE"

# Remove .lnk created on the desktop by wine installation application
rm ~/Desktop/Watchtower*.lnk

# Close and Exit
POL_SetupWindow_Close
exit
[/code]

Screenshots:
Icons:

Also a question for those more experienced.  On line 37 of my script I ask the user for a file, (it should be a Setup.exe file) but I never verified that they select a Setup.exe file.  Is there a standard way that I should verify the user has selected the correct installer file (at least the correct name)?

Edité par wblake0000

petch Mardi 28 Janvier 2014 à 23:14
petch

Hi,

I delete a .lnk file that is created on the users desktop after wine installs the program. Is this typical? (I'd hate to have a dead link on the desktop)

Quote from wblake0000

I would have thought PoL's disabling of winemenubuilder would have prevented that, strange...

[code language=playonlinux]
   POL_SetupWindow_check_cdrom "Setup.exe"
[/code]
There's probably a "setup.exe" on half of the install CDROMs, so it's not a very effective test to make sure the right media is in the tray...

[code language=playonlinux]
   POL_SetupWindow_browse "$(eval_gettext 'Please select the $TITLE {Setup.exe} file')" "$TITLE"
[/code]
Better stick to standard message "Please select the setup file to run." to avoid extra translation work (http://www.playonmac.com/en/dev-documentation-10.html).

To answer your last question, since PlayOnLinux/PlayOnMac 4.1.4, POL_SetupWindow_browse supports more parameters:

    # Usage: POL_SetupWindow_browse [message] [title] [default value] [Supported file types]

Since older versions will disregard the extra parameters and still work, no version check should be necessary. And yes, it's undocumented :(

Edité par petch

wblake0000 Mercredi 29 Janvier 2014 à 3:35
wblake0000Anonymous


There's probably a "setup.exe" on half of the install CDROMs, so it's
not a very effective test to make sure the right media is in the tray...

Citer


Thanks for the clarification I misunderstood the operation of that function.  I have corrected the script to use a more unique file as the check :)


Better stick to standard message "Please select the setup file to run." to avoid extra translation work (http://www.playonmac.com/en/dev-documentation-10.html).

Citer


I definitely would like to minimize any translation work, however I would like to specify that it is a Setup.exe that we are looking for, as there is a Start.exe, SetupMobile.exe, and autorun.exe all in the installation directory.  Could I use the phrase: "Please select the setup file to run {Setup.exe}" instead?


To answer your last question, since PlayOnLinux/PlayOnMac 4.1.4, POL_SetupWindow_browse supports more parameters:

    # Usage: POL_SetupWindow_browse [message] [title] [default value] [Supported file types]

Since
older versions will disregard the extra parameters and still work, no
version check should be necessary. And yes, it's undocumented

Citer


Thanks for that insight. I have added the additional filter to guarantee only exe files can be selected.  Could I also use the following code:

   DONE="FALSE"
   while [ "$DONE" = "FALSE" ]
   do
      POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run {Setup.exe}')" "$TITLE" "" "exe"
      # Verify a the Setup.exe was selected and not another .exe on the CD
      if [ ${APP_ANSWER:(-9)} = "Setup.exe" ]
      then
         DONE="TRUE"
      else
         POL_SetupWindow_message "$(eval_gettext 'Setup.exe was not selected, Please select the setup file to run {Setup.exe}')" "$(eval_gettext 'File Selection Error')"
      fi
   done
   POL_Wine start /unix "$APP_ANSWER"


This verifies that a Setup.exe was selected (not perfect as it could be the wrong Setup.exe) but closer.

If this is acceptable then here is my corrected script:
#!/bin/bash
# Date : 2014-01-25 13-47
# Last revision : 2014-01-25 13-47
# Wine version used : 1.7.11
# Distribution used to test : MAC OSX 10.9.1
# Author : William Blake
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

# Variable
TITLE="Watchtower Library"
PUBLISHER="Watchtower Bible and Tract Society of PA"
PREFIX="Watchtower"
URL="http://www.jw.org"
AUTHOR="William Blake"
DONE="FALSE"

# Initialization
POL_SetupWindow_Init
POL_Debug_Init

# Presentation
POL_SetupWindow_presentation "$TITLE" "$PUBLISHER" "$URL" "$AUTHOR" "$PREFIX"

# Create Prefix
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate

# Select Installation Method
POL_SetupWindow_InstallMethod "CD,LOCAL"
if [ "$INSTALL_METHOD" = "CD" ]
then
   POL_SetupWindow_cdrom
   POL_SetupWindow_check_cdrom "rs_data/PUBS"
   POL_Wine start /unix "$CDROM/Setup.exe"
elif [ "$INSTALL_METHOD" = "LOCAL" ]
then
   while [ "$DONE" = "FALSE" ]
   do
      POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run {Setup.exe}')" "$TITLE" "" "exe"
      # Verify a the Setup.exe was selected and not another .exe
      if [ ${APP_ANSWER:(-9)} = "Setup.exe" ]
      then
         DONE="TRUE"
      else
         POL_SetupWindow_message "$(eval_gettext 'Setup.exe was not selected, Please select the setup file to run {Setup.exe}')" "$(eval_gettext 'File Selection Error')"
      fi
   done
   POL_Wine start /unix "$APP_ANSWER"
fi

# Wait for Installation to Exit
POL_Wine_WaitExit

POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed')" "Installation in progress"

# Create Shortcuts
POL_Shortcut "wtlibrary.exe" "$TITLE"

# Remove .lnk created on the desktop by wine installation application
rm ~/Desktop/Watchtower*.lnk

# Close and Exit
POL_SetupWindow_Close
exit

Edité par wblake0000

petch Dimanche 2 Février 2014 à 15:16
petch

Personally I would have gone for just
POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Executables (*.exe)|*.exe;*.EXE"

I don't know how other maintainers feel about it, but choice is yours, you can submit your script for validation as-is if you want.
Click on "Supported software" on the left, then "New installer".
wblake0000 Dimanche 2 Février 2014 à 17:44
wblake0000Anonymous

Thanks petch, yeah especially since I have that extra check in there now, that makes a lot of sense.  And thanks for the more descriptive filter, I don't see "(Windows Executables (.exe)" on my mac but that would be better.  I have corrected that message so I'll plan on submitting the following script:

#!/bin/bash
# Date : 2014-01-25 13-47
# Last revision : 2014-01-25 13-47
# Wine version used : 1.7.11
# Distribution used to test : MAC OSX 10.9.1
# Author : William Blake
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

# Variable
TITLE="Watchtower Library"
PUBLISHER="Watchtower Bible and Tract Society of PA"
PREFIX="Watchtower"
URL="http://www.jw.org"
AUTHOR="William Blake"
DONE="FALSE"

# Initialization
POL_SetupWindow_Init
POL_Debug_Init

# Presentation
POL_SetupWindow_presentation "$TITLE" "$PUBLISHER" "$URL" "$AUTHOR" "$PREFIX"

# Create Prefix
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate

# Select Installation Method
POL_SetupWindow_InstallMethod "CD,LOCAL"
if [ "$INSTALL_METHOD" = "CD" ]
then
   POL_SetupWindow_cdrom
   POL_SetupWindow_check_cdrom "rs_data/PUBS"
   POL_Wine start /unix "$CDROM/Setup.exe"
elif [ "$INSTALL_METHOD" = "LOCAL" ]
then
   while [ "$DONE" = "FALSE" ]
   do
      POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Executables (*.exe)|*.exe;*.EXE"
      # Verify a the Setup.exe was selected and not another .exe
      if [ ${APP_ANSWER:(-9)} = "Setup.exe" ]
      then
         DONE="TRUE"
      else
         POL_SetupWindow_message "$(eval_gettext 'Setup.exe was not selected, Please select the setup file to run {Setup.exe}')" "$(eval_gettext 'File Selection Error')"
      fi
   done
   POL_Wine start /unix "$APP_ANSWER"
fi

# Wait for Installation to Exit
POL_Wine_WaitExit

POL_SetupWindow_wait "$(eval_gettext 'Please wait while $TITLE is installed')" "Installation in progress"

# Create Shortcuts
POL_Shortcut "wtlibrary.exe" "$TITLE"

# Remove .lnk created on the desktop by wine installation application
rm ~/Desktop/Watchtower*.lnk

# Close and Exit
POL_SetupWindow_Close
exit

wblake0000 Dimanche 2 Mars 2014 à 18:13
wblake0000Anonymous

Just curious if I could get some guidance. I submitted this script about a month ago, and I haven't heard anything back, I'm curious if I missed some correspondence. How long does it normally take to get a script approved? Thanks!
petch Dimanche 2 Mars 2014 à 18:39
petch

I found a "watchtower" entry in the repository, but it's empty and has not been submitted for validation... (?)
wblake0000 Dimanche 2 Mars 2014 à 18:44
wblake0000Anonymous

Well, shucks. I must have messed it up. I'll read through the instructions and try again.
wblake0000 Dimanche 2 Mars 2014 à 19:01
wblake0000Anonymous

Well I really goofed it up, I submitted "watchtower" for validation and it was blank (not sure how I did that). So I created a new installer "watchtower library" that should have the script in there. I didn't see any place to put the icons, are they just grabbed from the post here?
petch Dimanche 2 Mars 2014 à 19:28
petch

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmcayonlinux.com