Getting Arguments from Workbench

Moderators: Der Wanderer, Blackbird

Getting Arguments from Workbench

Postby Daedalus » 29. August 2014, 00:12

Hi guys,
I'm having trouble getting arguments passed to my program from Workbench. I set my executable as the default tool of a file, so that my program starts with the path to that file as its argument. In the past I have only ever done this for DOS arguments and it's worked fine using the NumPars and Par$() Blitz functions. However, these functions immediately crash when the program is launched from Workbench with an argument, as does ParPath$(0,0) and (0,1).

I tried using the dos_GetWBNumArgs{} and dos_GetWBArg{} functions, but they do not give me the path to the file given as an argument - only the filename, so of course it does not work once the file is in a different directory.

I'm using OS4.1 but I also tried it under 3.9 and it crashes there too. The OS stays working but the crashed program is using a lot of CPU time.

Any ideas what I'm doing wrong? My testing code is as follows:

Code: Select all
MaxLen startarg$=512
If dos_FromWB{};NumPars>0
  xx.l=Request("Test!","From Workbench!","Ok")
  xx=Request("Test!",Str$(args)+" Arguments!","Ok")
  If args>0
    For i.l=1 To args
      xx=Request("Test!","Argument "+Str$(i)+":|'"+startarg$+"'","Ok")
    Next i
  End If

End If

User avatar
Posts: 42
Joined: 12. May 2014, 23:11
Location: Glasgow, Scotland

Return to Questions & Answers

Who is online

Users browsing this forum: No registered users and 1 guest