Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Arguments from Workbench
#1
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:
MaxLen startarg$=512
#support_cliargs=1
If dos_FromWB{};NumPars>0
  xx.l=Request("Test!","From Workbench!","Ok")
  args.l=dos_GetWBNumArgs{}
  xx=Request("Test!",Str$(args)+" Arguments!","Ok")
  If args>0
    For i.l=1 To args
      startarg$=dos_GetWBArg{i-1}
      xx=Request("Test!","Argument "+Str$(i)+":|'"+startarg$+"'","Ok")
    Next i
    ;startarg$=Par$(1)
    ;xx=Request("Test!",startarg$,"ok")
  End If

End If

Thanks!
Zitieren


Nachrichten in diesem Thema

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste