XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 3:24 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: December 12th, 2014, 4:21 am 
Offline
User avatar

Joined: December 12th, 2014, 4:08 am
Posts: 2
hi, could someone please tell me how to change the following vbs (i created ;)
1) so that the widget/text1 updates every second and
2) that there is no need to use a temporary text file to store the data?
atm my widget uses the vbs at 'onload'.
thanks for any help in advance...
cheers joe

Code:
dim obj_shell, var_line, obj_cmdexec, my_string, tmpfile
Sub subfn()
    set obj_shell = createobject("WScript.Shell")
    tmpfile = ""+WidgetPath+"/tmp.txt"
    return = obj_shell.Run("%comspec% /C netsh wlan show interfaces | FIND ""Signal"" > "+tmpfile,0 ,true)
    Set fso  = CreateObject("Scripting.FileSystemObject")
    set file = fso.getFile(tmpfile)
    if file.size > 0 then
       Set file = fso.OpenTextFile(tmpfile, 1)
           my_string = file.readall()
           my_string = Mid(my_string,InStr(my_string,":")+2,Len(my_string)-InStr(my_string,":")+2)
           text1.Text = my_string
           file.Close: set fso = nothing
    else
        text1.Text = "File was empty"
    end if
set my_string = nothing
set file = nothing
End Sub

_________________
who says that there's no need to reinvent the wheel???


Top
 Profile  
 
PostPosted: December 16th, 2014, 1:09 am 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
http://msdn.microsoft.com/en-us/library ... 84%29.aspx

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
PostPosted: December 19th, 2014, 10:40 pm 
Offline
User avatar

Joined: December 12th, 2014, 4:08 am
Posts: 2
thx for the link digigamer!
i forgot to say that i already tried the exec-object. the only problem with it is that it's not possible to hide the command-shell (as far as i know).
but i managed to get rid of the update problem with an endless "do while"-loop. so this case is closed...
cheers joe

_________________
who says that there's no need to reinvent the wheel???


Top
 Profile  
 
PostPosted: December 31st, 2014, 4:35 am 
Offline
User avatar

Joined: March 8th, 2013, 10:27 pm
Posts: 353
There was a console hiding approach somewhere... I just cant find it.
Avoid endless loops as they drain the CPU, at least in JScript. ~50% CPU

_________________
Life is a myriad game... Just play it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group