[WB1.3] Call as Default tool
1 Attachment(s)
Hello.
I wrote a small utility in BlitzBasic 2.1 that displays size variants for a selected font. http://eab.abime.net/attachment.php?...1&d=1620379715 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. |
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.
|
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. |
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? |
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. |
Nice App. I like the iconify icon, did you hardcode the distance from the right hand side?
|
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 :bowdown |
Quote:
Quote:
Quote:
LoadFont 0 "FontName" WindowFont 0 NPrint "Example Text" But I suspect that I will have change to the version for print on bitmap. |
Quote:
Quote:
Code:
wbmsg.l = wbmessage ; Get pointer to Workbench message |
1 Attachment(s)
Quote:
Also try to create bootable Floppy with help "BlitzISOtoFloppy" And anyway i got an error: http://eab.abime.net/attachment.php?...1&d=1620637691 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? :shocked |
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. |
All times are GMT +2. The time now is 16:30. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.