get expressvpn status on load

Post

Posted
Rating:
#1 (In Topic #1349)
Regular
theyikes is in the usergroup ‘Regular’
 Hi guys! Ok this is doing my head in. I'm trying to get a message on the form load telling me what the current status of expressvpn is. From a terminal; i can type in expressvpn status. Is there any way of getting the status in a message box in Gambas 3?

I'd appreciate any help.
Online now: No Back to the top

Post

Posted
Rating:
#2
Banned
She'll or Exec

Code (gambas)

  1. Dim sResult As String
  2.  
  3. Shell "expressvpn status 2>&1" Wait To sResult
  4. Message(sResult)
  5. ' Note: the 2>&1 redirects any error output from stderr to stdout
  6.  

Code (gambas)

  1. Dim sResult As String
  2.  
  3. Exec ["expressvpn", "status"] Wait To sResult
  4. Message(sResult)
  5.  
  6.  

Some software (like ffmpeg) demand more of a terminal and just won't work with Shell or Exec if there's no process handler.

For these we need to do it through an input/output handler.

Code (gambas)

  1.  
  2. Public Sub GetVPNStat()
  3.  
  4.   Dim hProc As Process
  5.   hProc = Exec ["expressvpn", "status"] For Input Output As "VPNStatus"
  6.  
  7.  
  8. Public Sub VPNStatus_Read()
  9.  
  10.   Dim sText As String
  11.   sText = Read #Last, Lof(Last)
  12.  Message(sText)
  13.  
  14.  
  15. Public Sub VPNStatus_Error(Text As String)
  16.  
  17.  Message.Error(Text)
  18.  
  19.  
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
cage is in the usergroup ‘Regular’
 If your using this at startup that may be your problem.  I ran into the same problem when I was making a program to let me know if there were updates available . It just would not work correctly and never showed that updates were available. It worked fine through the IDE but not in practice. I figured it out and had to put a delay (Sleep) in the program so that it wouldn't start until the internet connection was established.  Once I did that the program worked as expected. BTW I used Shell to run the command. Hope that helps.
Online now: No Back to the top

Post

Posted
Rating:
#4
Regular
theyikes is in the usergroup ‘Regular’
hey bruceSteers! That worked perfectly. You must have been coding for AGES!!! I aspire to be you.
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Regular
thatbruce is in the usergroup ‘Regular’

theyikes said

hey bruceSteers! That worked perfectly. You must have been coding for AGES!!! I aspire to be you.

What old and living on an island? Hahahahhaaaaah hahahaaahaha  :D

Online now: No Back to the top

Post

Posted
Rating:
#6
Banned

thatbruce said

theyikes said

hey bruceSteers! That worked perfectly. You must have been coding for AGES!!! I aspire to be you.

What old and living on an island? Hahahahhaaaaah hahahaaahaha  :D

I'm pretty sure he means dashing and supremely handsome ;)  :lol:
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Guru
cogier is in the usergroup ‘Guru’
cogier is in the usergroup ‘GambOS Contributor’
 What's wrong with living on an island? We are all very nice, you know!!!
Online now: No Back to the top
1 guest and 0 members have just viewed this.