zbarimg Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Kide2009
Posts: 3
Joined: 06 Feb 2020, 18:46

zbarimg

06 Feb 2020, 18:51

how can i take the value of zbarimg.exe and put it on a variable (the value of the code).
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: zbarimg  Topic is solved

07 Feb 2020, 20:07

I wrapped a function a couple years back that I used with windows zbarimg.exe.
Not sure if it still works:

Code: Select all

zbarpath 	= ; *full path to zbarimg.exe*
imgpath 	= ; *full path to barcode image*

command 	= "%zbarpath%" --raw "%imgpath%"
value 		:= GetStdOutAll( command )

msgbox % value

GetStdOutAll( cmd )
{
	DetectHiddenWindows On
	Run 	% ComSpec,, Hide, pid
	WinWait % "ahk_pid " pid

	DllCall( "AttachConsole", "UInt", pid )

	WshObj 	:= ComObjCreate( "WScript.Shell" )
	Exec 	:= WshObj.Exec( cmd )
	StdOut	:= Exec.StdOut.ReadAll()

	DllCall( "FreeConsole" )
	Process Close, % pid

	Return StdOut
}
Kide2009
Posts: 3
Joined: 06 Feb 2020, 18:46

Re: zbarimg

07 Feb 2020, 22:59

your code working perfectly , i use it also for zbarcam

Code: Select all

#Warn,UseUnsetLocal
#NoEnv
#SingleInstance Force
SetBatchLines,-1

ZBarFilePath:="C:\Program Files (x86)\ZBar\bin\zbarcam.exe"

command 	= "%ZBarFilePath%" --raw "%imgpath%"
value 		:= GetStdOutAll( command )

msgbox % value

GetStdOutAll( cmd )
{
	DetectHiddenWindows On
	Run 	% ComSpec,, Hide, pid
	WinWait % "ahk_pid " pid

	DllCall( "AttachConsole", "UInt", pid )

	WshObj 	:= ComObjCreate( "WScript.Shell" )
	Exec 	:= WshObj.Exec( cmd )
	StdOut	:= Exec.StdOut.ReadAll()

	DllCall( "FreeConsole" )
	Process Close, % pid

	Return StdOut
}
Kide2009
Posts: 3
Joined: 06 Feb 2020, 18:46

Re: zbarimg

07 Feb 2020, 23:16

your code is working but is it possible to get the value directly while zbarCAM is running ( your code is working with it also but i don't want to get the value after closing it , constant update to the value)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5, RandomBoy and 352 guests