07 May 2021, 11:46 | #1 |
Amiga
Join Date: May 2021
Location: RB
Posts: 13
|
[WB1.3] Call as Default tool
Hello.
I wrote a small utility in BlitzBasic 2.1 that displays size variants for a selected font. The utility is called from the font .info file as the default tool. I am getting the filename as an element of the argument list using the Par$(1) command in the code and work with this filename further. But there is a serious problem. Since the utility is called from another location on the disk (eg Sys:C/), the current path is changed and the filename is not found in this location. I can hard set the path to the file, for example Sys:Fonts/ and then it works of course. But this is not correct, because the file(font) can be moved anywhere and everything will stop working. Actually, the question is how to correctly get the path to the file from which the default tool was called. |
07 May 2021, 16:18 | #2 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,368
|
Ordinarily, the function to use is ParPath$(), which gives you the full path corresponding to a given argument. However, the documentation for ParPath$() says that it's OS 2.0+ only, so if you require it to run on OS 1.x, that's not going to work. It's a long time since I coded specifically for 1.3, but from memory, under dos.library from 1.x, this is a little tricky to do because ReadArgs and associated functionality was only added in 2.0.
|
07 May 2021, 18:43 | #3 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,005
|
As we are talking about running from Workbench as a default tool, I doubt that ReadArgs has anything to do with it.
Workbench presents its argument to the app as wa_Lock and wa_Name pairs. wa_Lock is a BPTR lock to the directory and wa_Name is the name of the file. So I assume Par$() in this case only uses the wa_Name part and under OS 2.0+ ParPath$() uses NameFromLock() and AddPart() to combine the directory name and the file name. However, if there was a means to get access to the wa_Lock part, then you could use CurrentDir() to change the current diectory and then access the file using wa_Name. Then you wouldn't need to care about the directory name. Even better, DOS would assure that you enter exactly the right directory. If you first turn it into a name it could be misleading as there can be multiple volumes with the same name. |
08 May 2021, 11:24 | #4 |
Amiga
Join Date: May 2021
Location: RB
Posts: 13
|
Thanks for answers. I understand that Blitz Basic running under WorkBench 1.3 has a functional limitations. Since after trying to call ParPath$(), the program just hangs.
Perhaps there are any third party libraries that could help? |
08 May 2021, 20:49 | #5 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,368
|
Thanks for the clarification Thomas
Yep, if it uses certain system calls that were only introduced in 2.0, that will limit the use of those commands and functions. The LotanArgs 3rd party library includes alternative functions for getting arguments: WBArgs will return the number of arguments passed, and wArg(x) will return the referenced argument. The documentation doesn't specify a particular OS version so it's worth trying, but it's possible that it will have the same limitations regardless. |
09 May 2021, 00:51 | #6 |
Zone Friend
Join Date: Mar 2004
Location: Middle Earth
Age: 40
Posts: 2,127
|
Nice App. I like the iconify icon, did you hardcode the distance from the right hand side?
|
09 May 2021, 09:46 | #7 | |
Amiga
Join Date: May 2021
Location: RB
Posts: 13
|
Quote:
It remains to find the correct library version and figure out how to include to the project. Could you give a small example, if it's strain to you |
|
09 May 2021, 09:59 | #8 | |
Amiga
Join Date: May 2021
Location: RB
Posts: 13
|
Thanks.
If you are talking about the third button, then this is a resident - Zoom-Daemon. It allows you to maximize the window to full screen. Quote:
LoadFont 0 "FontName" WindowFont 0 NPrint "Example Text" But I suspect that I will have change to the version for print on bitmap. |
|
09 May 2021, 23:47 | #9 | ||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,368
|
Quote:
Quote:
Code:
wbmsg.l = wbmessage ; Get pointer to Workbench message If wbmsg ; Launched from WB numargs.l = WBArgs ; Always returns at least 1, since program's path is first argument For i.w = 0 To numargs - 1 ; wArg(0) is program's own path x.l = Request( "Test", "Parameter " + Str$(i) + ":|" + wArg(i), "Ok") Next i Else NPrint "Start from Workbench!" End If End |
||
10 May 2021, 11:17 | #10 |
Amiga
Join Date: May 2021
Location: RB
Posts: 13
|
I use "Ultimate Blitz Basic 2.1 (1997)(Acid Software).iso"
Also try to create bootable Floppy with help "BlitzISOtoFloppy" And anyway i got an error: Compiler does not know wArg(i) as I understand. And it is not entirely clear to me whether this is a problem precisely because of WB1.3, or the libraries path are not correct. Maybe i need to somehow specify the lib path for example using INCLUDE in the project head? Last edited by LessNick; 10 May 2021 at 11:26. |
10 May 2021, 14:27 | #11 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,368
|
That's because your Blitz installation doesn't include the Lotan DOS library (and the Elmore libraries containing the Request() function). It looks like you're using the default installation - I think the documentation gives details on adding libraries to the setup, but it involves using a tool to add them to the "deflibs" file that contains all the commands Blitz can use. I vaguely remember there also being a way of adding libraries to a folder to add individually, but I can't remember the details... Anyway, check the documentation - the basic installation is intended for floppy-only use (and the BlitzISOToFloppy tool simply recreates the floppies from the files on the CD). As such, it's very minimal and contains only the most basic components.
If you check the Extras drawer, you should find files with updated components, such as a bigger deflibs file that I think will contain the commands you need, a better debugger and so on. Try the bigger deflibs file anyway, see how that goes. Using Include is for including other Blitz source files, not command libraries which are loaded by Blitz when it starts, and can't be loaded by your code. As an aside, is there a reason you're using OS 1.3? Using OS 2+ allows you to use a much nicer editor, AmigaGuide documentation and so on. Additionally, there's a [http://ubb.plus/]revised version of the Blitz CD ISO[/url] which includes all the latest updates as well as a fixed installer, but you really need OS 2 to get the most from it. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to set default tool? | fstltna | support.Other | 4 | 19 April 2019 21:31 |
Default tool for graphic files? | fstltna | support.Other | 5 | 22 July 2017 23:42 |
What is the default WB1.3 system font called? | Blitter | New to Emulation or Amiga scene | 9 | 12 October 2009 09:28 |
HELP! How to change icon default tool in WB | buckrogers | New to Emulation or Amiga scene | 18 | 07 March 2005 05:27 |
The icon(s) have no default tool(s) !!!! | THX1138 | support.Apps | 5 | 08 March 2003 03:00 |
|
|