Surprisingly fruity scripts...
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Since VPDF does not currently have a "save" button (which would be useful when viewing pdfs passed from OWB) here's a script that a) shows a pdf clicked in OWB using VPDF and b) gives you the option to save the file locally.

    EDIT - updated script to match default vpdf path. Removed downloadable version - PITA to update. Changed name of script.

    It's not as good as viewing the PDF in the browser, or having a 'save' button in VPDF, but it's a decent workaround for now:

    OWB>Settings>Preferences>MIMETypes

    Add entry:
    Mime Type = Text / pdf /// Extension = pdf /// Action = external viewer, s:vpdfopen, %f

    Save the following as an executable script in s:owb/vpdfopen

    --------------------------------------------------

    .key local
    .bra {
    .ket }

    ; START set your local configuration
    set userpath "Rich:downloads"
    set vpdfpath "sys:applications/vpdf/vpdf"
    ; userpath is the path to which the save-file requester defaults
    ; vpdfpath is the path to the vpdf executable
    ; END set your local configuration


    run >NIL: $vpdfpath {local}
    wait 5
    requestfile >Env:temppath FILE Download.pdf TITLE "Do you want to save a copy?" INITIALVOLUMES $userpath
    search env:temppath "*""
    If NOT WARN
    Copy {local} $temppath QUIET
    endif
    Delete >NIL: env:temppath

    --------------------------------------------------


    All done!

    When you click on a pdf in OWB it will open in VPDF and provide a requester asking if you want to save a copy of the file.

    --------------------------------------------------


    NB Requestfile (when redirected to file) returns the value enclosed in double quotes (eg '"foo:bar"') in all cases unless 'cancel' is selected in which case it returns null (ie '').
    This makes it difficult to compare the string in a normal If statement for all cases (null, '"foo:bar"' and '"foo:beyond all/recognition"') since one would normally use $variable or "$variable".
    The 'search... if not warn...' gets around this - NULL is inferred from the lack of any double-quote ('"') characters in the string.
    Wait 5 is just a(nother) kludge to prevent the file requester opening prior to (and therefore behind) the VPDF window.

    [ Edited by boot_wb 09.04.2014 - 18:00 ]
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »14.08.12 - 12:48
    Profile Visit Website
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    runequester
    Posts: 106 from 2010/1/11
    Thanks! Will test this tonight :)
    Amiga 1200 and G4 MDD MOS as my main computers.
  • »14.08.12 - 12:57
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Here's another script that saves you the bother of remembering if you have torrents running or not. :-)

    EDIT - Added 'Downloads' directory listing to scan, which can also contain current files. Removed downloable version - PITA to update.

    It executes from wbstartup, and scans mldonkey/torrents/incoming (and mldonkey/torrents/downloads) for any torrent files. If none are found, mldonkey doesn't bother starting. If there are some, it does.

    (NB the first line may need tweaking to point to your mldonkey directory.)
    (NB#2 If you've configured mldonkey to use different directories than the default for storing incoming .torrent files it will need updating to match).

    Save the following as a script with a project icon in wbstartup (set default tool to c:iconx):

    Quote:

    ; mldonkey directory (not the path to the executable, just the directory containing the executable)
    set mlddir "sys:applications/mldonkey"

    ; The line below references the mldonkey directory where incoming .torrent files are stored.
    ; this will only need changing where you've customised the default paths within mldonkey interface or config files.
    if exists "$mlddir/torrents/incoming/"
    dir "$mlddir/torrents/incoming/" >env:mldinc
    endif
    if exists "$mlddir/torrents/downloads/"
    dir "$mlddir/torrents/downloads/" >>env:mldinc
    endif
    if NOT "$mldinc" eq ""
    WaitForPort NETSTACK
    cd "$mlddir"
    run execute MLdonkey
    endif
    delete >NIL: env:mldinc


    [ Edited by boot_wb 09.04.2014 - 18:00 ]
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »14.08.12 - 14:15
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    And another one which slightly adapts Geit's well-known setclockntp script such that it updates the clock on startup, then every 12 hours during uptime:

    EDIT: Removed downloadable version

    Save the following as a script with a project icon in wbstartup (set default tool to c:iconx):

    ------------------------------------

    ; resets the clock to a timeserver at startup, and every 12 hours subsequently.
    ; to shut down the script, delete env:setclockloop

    setenv setclockloop ""
    WaitForPort NETSTACK

    lab ntploop

    if NOT exists env:setclockloop
    skip end
    endif

    run >NIL: c:setclockNTP save
    wait 720 mins

    skip ntploop BACK

    lab end

    [ Edited by boot_wb 09.04.2014 - 17:50 ]
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »14.08.12 - 14:21
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    And one final one which I've posted a link to before, but may as well dump here again with the other scripts (also a slightly cleaner version).

    EDIT: updated to include warning if battery level at 0% :) and up to 15%. Removed downloadable version.

    This one monitors the battery level and warns you when battery is less than 10% (useful if you knock the power lead out without noticing).

    Written purely because I've not been able to get magicbeacon to warn me when the battery is low using the built-in 'batterylow' notifications, but will also work on systems without magicbeacon installed (defaults to CON: if magicbeacon is not found).

    No configuration necessary.

    Save the following as a script with a project icon in wbstartup (set default tool to c:iconx):


    ---------------------------------


    ; kludge script to send alerts when battery is low
    ; will use magicbeacon if installed, output to con: window if not
    ; to shut down the script, delete env:battbuttloop and wait for next iteration


    ; START initial setup
    ; runs once on script startup
    ;
    ; sets loop iteration times - can be easily adjusted here
    set loopA "3 mins" ; period between checks when battery >10%
    set loopB "2 mins" ; period between checks when battery <10%, but AC connected
    set loopC "90" ; period (seconds) between checks when battery <10% and AC not connected.
    ;
    ; checks if magicbeacon is installed and sets notify system
    if exists SYS:MorphOS/Data/MagicBeacon/MagicBeacon
    set Notify "sendbeacon"
    else
    set Notify "echo >CON:200/200/480/300/BattButt/AUTO/WAIT/CLOSE"
    endif
    ; sanity check to prevent multiple instances. If loop times are changed, this may fail. No biggie though.
    ; also ensures user has not foolishly copied battbuttloop variable to envarc: at some point
    if exists env:battbuttloop
    if exists envarc:battbuttloop
    delete >NIL: envarc:battbuttloop NOREQ
    $Notify "battbuttloop variable found in envarc: and deleted."
    endif
    $Notify "battbuttloop may already be running.. restarting in $loopA. No intervention required."
    delete >NIL: env:battbuttloop NOREQ
    wait $loopA
    endif
    ; sets 'running' variable
    setenv battbuttloop ""
    ;
    ; END initial setup


    ;main loop
    lab BattLoop
    if NOT exists env:battbuttloop
    skip endlab
    endif
    run >NIL: c:battery >env:battbutt0
    search >NIL: env:battbutt0 PATTERN " (0|1|2|3|4|5|6|7|8|9|10|12|13|14|15) '%"
    if WARN
    wait $loopA
    skip BattLoop BACK
    else
    search >NIL: env:battbutt0 PATTERN "charging"
    if WARN
    $Notify "Battery Low! Currently running on battery power. Connect to AC and save work."
    wait $loopC
    skip BattLoop BACK
    endif
    $Notify "Battery Low! Charging: Do not disconnect from AC."
    wait $loopB
    skip BattLoop BACK
    endif

    ; cleanup and notify on exit
    lab endlab
    $Notify "BattButt exiting - warnings switched off."
    if exists env:battbutt0
    delete >NIL: env:battbutt0
    endif

    --------------------------------------------------


    [ Edited by boot_wb 09.04.2014 - 18:08 ]
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »14.08.12 - 14:50
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    amigadave
    Posts: 2795 from 2006/3/21
    From: Northern Calif...
    Thanks for all these scripts boot_wb.

    Specially the "BattButt.lha", as I have done just what you suggested and had my charger connection slip out just enough to be disconnected, but not noticed, as it was still partially connected to the laptop.

    I will download and install that script immediately when I use my G4 PowerBook again this afternoon. :-)
    MorphOS - The best Next Gen Amiga choice.
  • »14.08.12 - 20:17
    Profile
  • Fab
  • MorphOS Developer
    Fab
    Posts: 1331 from 2003/6/16
    Just for fun, it's also possible to view PDF through some online PDF viewers in OWB. I don't advise it because VPDF is faster and more integrated, but if you wish to do it for fun, here's the way:

    Create some file SYS:applications/OWB/pdfview.rexx with the following contents :
    /* pdf online viewer */
    parse arg port' 'url
    address VALUE port
    'open name="https://viewer.zoho.com/api/urlview.do?url='url'"'

    In OWB Mimetype settings, create or select "application/pdf" with pdf extension, choose external viewer, and as viewer, set: "rx SYS:applications/OWB/pdfview.rexx" and "%p %l" in the argument string next to it.
  • »14.08.12 - 21:41
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Andreas_Wolf
    Posts: 12150 from 2003/5/22
    From: Germany
    > it's also possible to view PDF through some online PDF viewers in OWB.
    > [...]
    > 'open name="https://viewer.zoho.com/api/urlview.do?url='url'"'

    I recommend the Google Docs Viewer over the Zoho one as the Google one has better compatibility to newer PDF standards (transparency etc.).
  • »14.08.12 - 22:54
    Profile
  • MorphOS Developer
    CISC
    Posts: 619 from 2005/8/27
    From: the land with ...
    @boot_wb:
    You might want to consider using WaitX (in MOSSYS:C) instead of all these tedious wait/execute loops in your scripts... ;)


    - CISC
  • »15.08.12 - 05:11
    Profile
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    WaitX... will have a look at that one, thankyou. The above scripts were cobbled together from my limited Amigados knowledge, any improvements or alternatives are most welcome. :-)
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »15.08.12 - 07:46
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    This one is for enqueuetorrent (gets around the limitation that enqueuetorrent requires mldonkey to be already running).

    Open OWB and go to Settings>Preferences>MIMETypes

    Add/Edit entry:
    Mime Type = Application/x-bittorrent /// Extension = torrent /// Action = external viewer, "s:aeTorrent", %l

    Open your favourite text editor and save the following as "s:aeTorrent" :

    Quote:

    .key local
    .bra {
    .ket }

    status >NIL: COM mlnet
    if WARN
    echo "Starting MLDonkey... please wait."
    run >NIL: execute "sys:applications/mldonkey/mldonkey"
    wait 20
    endif
    run "sys:applications:enqueue torrent/enqueuetorrent" {local}


    The two command line may require altering if your enqueuetorrent is installed elsewhere.
    Requires mldonkey and enqueuetorrent to be installed.
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »23.09.12 - 20:52
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    @Papiosaur,

    Please feel free. Only the stingiest person would try to control the release of AmigaDOS scripts :-)

    I'm really starting to appreciate how well the mimetype system works in MorphOS. combined with the use of ".key local" in scripting, you can do pretty much anything with a double-click/rmb-menu in Ambient (and OWB).
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »23.09.12 - 21:20
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Simple integration of Google translate into Odyssey (OWB) using contextual menus:

    OWB>Settings>Preferences>Contextual Menus

    Add entry:
    Category = Page
    Label = Translate Page
    Action = OPENURL "http://translate.google.com/translate?sl=auto&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=%u" NOLAUNCH

    (Make sure to press enter after entering the Action string)

    All done!

    Now you can right-click anywhere on the page, and select 'Translate Page' from the menu. It will reload the page using autotranslation into English.

    If you want translation into a different language, just alter the "tn=en" bit of the string appropriately, or visit a google translated page and look at the url.
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »04.11.12 - 01:04
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    QuickOpen

    Keyboard shortcut (eg RAmiga+O) integrating 'open' command with a pop-up requester.
    Quick & friendly way to use the 'open' command to open URLs, assigns, paths, applications, images, etc (No scary cli) from Ambient.

    NB - Not a global hotkey, only works from Ambient.

    This is a simple little tweak, but needs MUIRequeststring from Aminet to be installed:

    RMB>Settings>Ambient>Keyboard>Custom Command Hotkeys
    Add a Hotkey.
    Name 'QuickOpen'
    Hotkey 'rcommand o'
    Edit command (opens Action Editor window)
    Add an action:
    Type 'AmigaDOS'
    Command string 'execute s:quickopen' (Make sure to press enter!)
    Uncheck all boxes
    Click 'OK' to close Action Editor window
    Click 'Save' to close Ambient Settings window

    Save the following as an executable script in s:quickopen

    (assumes you have muirequeststring in sys:c )

    --------------------------------------------------

    c:muirequeststring TITLE "Open.." BODY "Enter path or URL (max length 255 characters)" >env:quickopen
    open $quickopen
    delete >NIL: env:quickopen
    ;have a beautiful time!

    [ Edited by boot_wb 09.04.2014 - 18:31 ]
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »09.04.14 - 16:23
    Profile Visit Website
  • MorphOS Developer
    zukow
    Posts: 645 from 2005/2/9
    From: Poland
    Vpdf in morphos 3.8 will finally have Save option
  • »16.01.15 - 12:19
    Profile Visit Website
  • Paladin of the Pegasos
    Paladin of the Pegasos
    NewSense
    Posts: 1513 from 2012/11/10
    From: Manchester, UK/GB
    Will VPDF, when this MOS v3.8 is released, also react and print multiple pages to one sheet?

    I mention this because I have had no success with printing multiple pages onto one page so far with this option, so I have had to revert to Adobe Acrobat/Reader on one or more other platforms I use to handle the task - which I would prefer not to have to do, but if MorphOS cannot do this at the moment then I have to opt for anothe OS that can handle this task, that is, until MorphOS can be enabled to do so.

    This maybe something to do with the Beta Printing system that is currently not completed/released, as there are no options in the Printer Prefs window as it currently just shows a 'blank' page

    Is there also likely to be an option to print to a piece of A5, or other standard, and custom paper sizes, instead of only A4 paper, as sometimes a booklet is better on A5 paper than A4 paper?

    It would also be fantastic to have a preview display, in an area of the print options window (resizeable if possible - as should the print options requester also be, which currently it is basically only horizontally sizeable, and not vertically, which ideally should also be changed to suit both dimensions with this option. So that it is possible to see the preview, as a magnified/larger preview, if necessary, by resizing the options requester window, so that you know for certain it will look just as you want the print to look like when it is actually clicked on to be printed out, but shown on screen before you click/keypress to print the PDF document, or any other document that VPDF can handle. ;-)
    MacMini 1.5GHz,64MB VRAM, PowerBooks A1138/9 (Model 5,8/9),PowerMac G5 2.3GHz(DP), iMac A1145 2.1GHz 20", all with MorphOS v3.18+,Airport,Bluetooth,A1016 Keyboard,T-RB22 Mouse,DVD-RW-DL,MiniMax,Firewire/USB2 & MacOSX 10.4/5
  • »16.01.15 - 15:00
    Profile
  • MorphOS Developer
    zukow
    Posts: 645 from 2005/2/9
    From: Poland
    If only i had more time everything could be written :).
    I have to finish updating SCANdal (undo and zoom) + new scanner drivers for MorphOS 3.8.
    Depending on MorphOS 3.8 release date i may update VPDF printing part, work on printer drivers and do many more things from my TODO (like additional Reggae decoders/encoders, pdf output from SCANdal, etc.).
  • »16.01.15 - 18:14
    Profile Visit Website
  • Paladin of the Pegasos
    Paladin of the Pegasos
    NewSense
    Posts: 1513 from 2012/11/10
    From: Manchester, UK/GB
    I understand you have limitations on your time, and I for one, really appreciate you adding so much useability to the MorphOS system with whatever you manage to implement for our benefit, including Reggae, VPDF, SCANdal, and the printing system, which I'd really like to see fully implemented - hopefully soon, with as many of the features requested by users, and of course thought of by yourself and the development team.

    I really get a lot of use out of SCANdal, and the updates you mention would be really great features for the program to have, so I really hope you manage to implement as many as you can in the limited time you have available. 8-)
    MacMini 1.5GHz,64MB VRAM, PowerBooks A1138/9 (Model 5,8/9),PowerMac G5 2.3GHz(DP), iMac A1145 2.1GHz 20", all with MorphOS v3.18+,Airport,Bluetooth,A1016 Keyboard,T-RB22 Mouse,DVD-RW-DL,MiniMax,Firewire/USB2 & MacOSX 10.4/5
  • »16.01.15 - 22:06
    Profile