hi all,
I am developing a script that should do some operations when I arrive at the office. No problem to do the operations, but I don't know how set the trigger. What can I use to check the location?
Thanks
Best regards.
Do specific operations when I arrive at a specific location? Topic is solved
Re: Do specific operations when I arrive at a specific location?
If the IP address at your office is static, that would do it. It is found in the built-in variable A_IPAddress1 (and 2, 3, and 4 for multiple network adaptors).
Re: Do specific operations when I arrive at a specific location?
that is a good idea, but the IP is not static. I would you the network SSID. I have found this code line:boiler wrote:If the IP address at your office is static, that would do it. It is found in the built-in variable A_IPAddress1 (and 2, 3, and 4 for multiple network adaptors).
Code: Select all
Runwait %comspec% /c netsh wlan show interface | clip,,hide
Thanks
Re: Do specific operations when I arrive at a specific location?
I didn't know this, thanks. Unfortunately, I cannot use it as I am developing a computer log, so I need to save the location of the PC and the trigger to start the log is the arrival at the officeBoBo wrote:https://joaoapps.com/autoremote/eventghost/
Re: Do specific operations when I arrive at a specific location?
If it's in the clipboard, it's in the AHK built-in variable called Clipboard, which you then can assign to a variable. Is there a reason you can't do that?serbring wrote:Unfortunately, the result of netsh is put into the clipboard and I can't do it in my code, as this line is inside a SetTimer function. Is there any way to put the network info in a variable?Code: Select all
Runwait %comspec% /c netsh wlan show interface | clip,,hide
Re: Do specific operations when I arrive at a specific location?
my script logs the name of the active windows once every 1s. In addiction, it should check the SSID. If Runwait uses the clipboard, then the clipboard is useless for any other activity as every 1s it is loaded data coming from this line:boiler wrote:If it's in the clipboard, it's in the AHK built-in variable called Clipboard, which you then can assign to a variable. Is there a reason you can't do that?serbring wrote:Unfortunately, the result of netsh is put into the clipboard and I can't do it in my code, as this line is inside a SetTimer function. Is there any way to put the network info in a variable?Code: Select all
Runwait %comspec% /c netsh wlan show interface | clip,,hide
Code: Select all
Runwait %comspec% /c netsh wlan show interface | clip,,hide
Re: Do specific operations when I arrive at a specific location? Topic is solved
Code: Select all
#NoEnv
output := cmd("netsh wlan show interface")
MsgBox % output
; Example output parsing
Loop, Parse, output, `n, `r
result .= (A_Index=3 || A_Index=4) ? A_LoopField . "`n" : ""
MsgBox % result
ExitApp
cmd(str)
{
DetectHiddenWindows, On
Run %ComSpec%,, Hide, pid
WinWait, ahk_pid %pid%
DllCall("AttachConsole", "UInt", pid)
WshShell := ComObjCreate("WScript.Shell")
oExec := WshShell.Exec(ComSpec " /k/q echo off")
oExec.StdIn.WriteLine(str . "`nexit")
cmdoutput := oExec.StdOut.ReadAll()
DllCall("FreeConsole")
Process, Close, %pid%
DetectHiddenWindows, Off
return cmdoutput
}
Re: Do specific operations when I arrive at a specific location?
Xtra wrote:HTHCode: Select all
#NoEnv output := cmd("netsh wlan show interface") MsgBox % output ; Example output parsing Loop, Parse, output, `n, `r result .= (A_Index=3 || A_Index=4) ? A_LoopField . "`n" : "" MsgBox % result ExitApp cmd(str) { DetectHiddenWindows, On Run %ComSpec%,, Hide, pid WinWait, ahk_pid %pid% DllCall("AttachConsole", "UInt", pid) WshShell := ComObjCreate("WScript.Shell") oExec := WshShell.Exec(ComSpec " /k/q echo off") oExec.StdIn.WriteLine(str . "`nexit") cmdoutput := oExec.StdOut.ReadAll() DllCall("FreeConsole") Process, Close, %pid% DetectHiddenWindows, Off return cmdoutput }
That's work. Thanks
Re: Do specific operations when I arrive at a specific location?
That's quite amazing! ThxXtra wrote:HTHCode: Select all
#NoEnv output := cmd("netsh wlan show interface") MsgBox % output ; Example output parsing Loop, Parse, output, `n, `r result .= (A_Index=3 || A_Index=4) ? A_LoopField . "`n" : "" MsgBox % result ExitApp cmd(str) { DetectHiddenWindows, On Run %ComSpec%,, Hide, pid WinWait, ahk_pid %pid% DllCall("AttachConsole", "UInt", pid) WshShell := ComObjCreate("WScript.Shell") oExec := WshShell.Exec(ComSpec " /k/q echo off") oExec.StdIn.WriteLine(str . "`nexit") cmdoutput := oExec.StdOut.ReadAll() DllCall("FreeConsole") Process, Close, %pid% DetectHiddenWindows, Off return cmdoutput }
Who is online
Users browsing this forum: CuriousDad, rc76 and 222 guests