Jump to content

olmanRvr

Active Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by olmanRvr

  1. Thanks Very much Bowmore!! Now it is working fine.Issue is SOLVED.For others having similar issue here is the correct code. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=e:\projectbzt\usrprefs.kxf $usrPrefs = GUICreate("User Preferences", 531, 271, 317, 119) GUISetBkColor(0xD6D8C7) $Group1 = GUICtrlCreateGroup("Group1", 19, 7, 242, 68) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $radio_AbsP = GUICtrlCreateRadio("Abselute Value", 83, 24, 105, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) $radio_RelP = GUICtrlCreateRadio("Relative Value", 68, 47, 120, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) $edit_AbsP = GUICtrlCreateEdit("", 190, 21, 65, 21, $ES_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xC4C7AD) GUICtrlSetState(-1,$GUI_HIDE) $edit_RelP = GUICtrlCreateEdit("", 190, 45, 65, 22, $ES_CENTER) GUICtrlSetData(-1, 100) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xC4C7AD) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $radio_AbsP,$radio_RelP $isradioAbsChk=GUICtrlRead($radio_AbsP);checked=1,not checked=4 $isradioRelChk=GUICtrlRead($radio_RelP);checked=1,not checked=4 If $isradioAbsChk = 1 Then GUICtrlSetState($edit_AbsP,$GUI_SHOW) GUICtrlSetState($edit_RelP,$GUI_HIDE) Else GUICtrlSetState($edit_AbsP,$GUI_HIDE) GUICtrlSetState($edit_RelP,$GUI_SHOW) EndIf EndSwitch WEnd
  2. Hi Bowmore, Thanks for the quick reply.Tried out your code but still both the edit ctrls visible as before.Below is the full code including the code you have proposed.Please have a look. thanks olmar #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=e:\projectbzt\usrprefs.kxf $usrPrefs = GUICreate("User Preferences", 531, 271, 317, 119) GUISetBkColor(0xD6D8C7) $Group1 = GUICtrlCreateGroup("Group1", 19, 7, 242, 68) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $radio_AbsP = GUICtrlCreateRadio("Abselute Value", 83, 24, 105, 17, BitOR($GUI_SS_DEFAULT_RADIO,$BS_RIGHTBUTTON,$BS_RIGHT)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) $radio_RelPos = GUICtrlCreateRadio("Relative Value", 68, 47, 120, 17, BitOR($GUI_SS_DEFAULT_RADIO,$BS_RIGHTBUTTON,$BS_RIGHT)) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x0000FF) $edit_AbsP = GUICtrlCreateEdit("", 190, 21, 65, 21, $ES_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xC4C7AD) $edit_RelP = GUICtrlCreateEdit("", 190, 45, 65, 22, $ES_CENTER) GUICtrlSetData(-1, 100) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xC4C7AD) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $radio_AbsP $isradioChk=GUICtrlRead($radio_AbsP);checked=1,not checked=4 If $isradioChk = 1 Then GUICtrlSetState($edit_AbsP,$GUI_SHOW) GUICtrlSetState($edit_RelP,$GUI_HIDE) Else GUICtrlSetState($edit_AbsP,$GUI_HIDE) GUICtrlSetState($edit_RelP,$GUI_SHOW) EndIf Case $usrPrefs EndSwitch WEnd
  3. I want to show or hide a edit control depending if a radio button is checked or not.The following Autoit code appears semantically ok but not working.Can anyone please help? thanks olmar While 1 $nMsg = GUIGetMsg() $isradioChk=GUICtrlRead($radio_AbsP);checked=1,not checked=4 Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $isradioChk If $isradioChk<==1 Then GUICtrlSetState($edit_AbsP,$GUI_SHOW) GUICtrlSetState($edit_RelP,$GUI_HIDE) Else GUICtrlSetState($edit_AbsP,$GUI_HIDE) GUICtrlSetState($edit_RelP,$GUI_SHOW) EndIf Case $usrPrefs EndSwitch WEnd
  4. Hi, I would hard code these values(Hd srnum&timestamp) into the code for each user, basically to bind it to a single machine for a predefined period.Hence in the last moment, after user clicks download button,these values are fetched and incorporated into the script & then compiled .Which will, then be downloaded. But thanks for your reply olmar
  5. Hi kylomas, Tried the code you have shown.Yes, it is showing the timestamp in a GUI window.Problem arises when I add the following line:- ConsoleWrite("value is: "&$sOutput&@CRLF) ConsoleWrite fails to write the value.Same issue occurs when writing the value of $sOutput to a text file.Weird thing is if I replace the timeStampSecs.exe with genKeyNum.exe it works fine !! Any idea, anyone please? example below: ;Only difference to the previous function is that another exe file is invoked Func runExegenKeyNum();the exe fetches the physical drive number Local $iPID = Run(@scriptdir & "\genKeyNum.exe", "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) Local $sOutput While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop Sleep(10) WEnd MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) ConsoleWrite("value is; "&$sOutput&@CRLF) Return $sOutput EndFunc runExegenKeyNum() ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;code for genKeyNum.exe Func gtSrNo() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" Global $Output="" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $oItm In $colItems $Output = $Output & $oItm.SerialNumber & @CRLF Next ConsoleWrite($Output&@CRLF) Return $Output;$Output is the serial; number EndFunc
  6. Read stream of run call to timeStampSecs.exe .But still getting blank output(in consoleWrite.See code below:-- #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> Func readStream() Local $iPID = Run("timeStampSecs.exe", "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) Local $sOutput While 1 $sTemp = StdoutRead($iPID) $sTemp &= StderrRead($iPID) ; Exit the loop if the process closes or StdoutRead returns an error. If @error Then ExitLoop Else $sOutput &= $sTemp EndIf Sleep(10) WEnd MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) ConsoleWrite("ts is: "&$sOutput&@CRLF) Return $sOutput EndFunc readStream()
  7. Instead of Run used RunWait as per Jos .Same issue--- writing PID numbers in place of the time stamp as wanted.Also removes quotes from fileclose like "$hFile"-->$hFile but doesn't help. Working on reading the return stream(as per Melba23's suggestion). see you.........
  8. Hi, Thanks for the quick reply.Let me try your suggestion .Will let you know olmar
  9. I have a compiled script :-timeStampSecs.exe which returns timestamp in seconds. I call it in FileWrite to write the time stamp in a text file.But it writes some other values instead of the timestamp. Please help. thanks olmar The script is below:- $kNum=run("timeStampSecs.exe","",1); also tried with flags 2,4,8,10 $hFile=FileOpen("timeStamp.txt",2) FileWrite($hFile,"the key is: "&$kNum) FileClose("$hFile") ;Code of thetimeStampSecs.exe:- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #include <Date.au3> Func secFromEpoch() Local $ts=_DateDiff( "s","1970/01/01 00:00:00",_NowCalc()) $ts=String($ts) ConsoleWrite("timeStamp is: "&$ts&@CRLF) Return $ts EndFunc secFromEpoch()
  10. Hi czardas, Absolutely great!!! It is working!! This is what i wanted.Issue SOLVED Changed assignment of $getStr FROM $getStr=getStr() TO $getSr= StringStripWS(gtSrNo(), 8) Thanks a whole lot olmar
  11. Hi, As per your suggestion changed the values to binaries:- $constSr=StringToBinary($constSr) $getSr=StringToBinary($getSr) But again the strings don't match.Also tried czardas's suggestion for using "=" instead of "==" to compare the strings.No success.I noticed if the constant $constSr is assigned the value from a function call it works(code below).But for my purpose I need to hard code it.Any suggestion please. thanks chkCond() Func chkCond() Local Const $constSr=gtSrNo2();assigns value instead of hard coding Local $getSr=gtSrNo() Local $ans $ans= StringCompare($constSr, $getSr) If $ans==0 Then MsgBox(0,0,"same") Else MsgBox(0,0,"different") EndIf ConsoleWrite("The machine serial is:--------- "&$getSr&@CRLF) ConsoleWrite("The CONST serial is:--------- "&$constSr&@CRLF) If $constSr==$getSr Then MsgBox(0,0,"Same") Else MsgBox(0,0,"Not Same") EndIf EndFunc Func gtSrNo();returns physical hard disc serial num $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $oItm In $colItems $strPowerManagementCapabilities = $oItm.PowerManagementCapabilities(0) $Output = $Output & $oItm.SerialNumber & @CRLF Next Else Msgbox(0,"WMI Output","Pl No WMI Objects Found for class: " & "Win32_DiskDrive" ) Endif Return $Output EndFunc ;Func gtSrNo2() is exact copy of "Func gtSrNo()" .Copy paste Func gtSrNo() below
  12. (code given below) I m trying to compare the physical hard drive number returned by a autoit function to the same number hard coded in to the script by using stringcompare and also “==” operator.I expected the result of the comparison would produce a “match” but stringcompares returns non-zero(not equal).However consolewrite outputs the same values.Cant figure out what the mistake is. Will greatly appreciate any help Thanks olmar #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <Date.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> chkCond() Func chkCond() Local $constSr="2020202020202020202059205337544c41335452" Local $getSr=String(gtSrNo()) Local $ans $ans= StringCompare($constSr, $getSr) MsgBox(0,0,"const str is:"&$constSr&@CRLF&"machi str is:"&$getSr) MsgBox(0,0,"Result is: "&$ans&@CRLF) ConsoleWrite("The machine serial is:--------- "&$getSr&@CRLF) ConsoleWrite("The CONST serial is:--------- "&$constSr&@CRLF) If $constSr==$getSr Then MsgBox(0,0,"Same") Else MsgBox(0,0,"Not Same") EndIf EndFunc Func gtSrNo();returns physical hard disc serial num $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $oItm In $colItems $strPowerManagementCapabilities = $oItm.PowerManagementCapabilities(0) $Output = $Output & $oItm.SerialNumber & @CRLF Next Else Msgbox(0,"WMI Output","Pl No WMI Objects Found for class: " & "Win32_DiskDrive" ) Endif Return $Output EndFunc
  13. Hi Everybody, I think the manufacturer's HDD Serial is good for this scenario ,it is unique & stable.The script below fetches the physical HD sr.num.The idea is 1)to upload the Sr.num to the server.2)Then include this script(gtSrNo()) a the start of the script-to-protect(main script) & call it before running the main script.3)Check its return value(the serial num) against the one saved at the server. Question: Can the Sr num be uploaded to server from client? Can it be matched against the Sr num generated each time the script is run by the client? I will be very very thankful if some one can help out. cheers olmar Func gtSrNo() $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $oItm In $colItems $strPowerManagementCapabilities = $oItm.PowerManagementCapabilities(0) $Output = $Output & $oItm.SerialNumber & @CRLF Next Else Msgbox(0,"WMI Output","Pl No WMI Objects Found for class: " & "Win32_DiskDrive" ) Endif ConsoleWrite("The serial ni is "&$Output&@CRLF) Return $Output EndFunc gtSrNo()
  14. Hi, Thanks for your reply.I have this script compInfo2.au3 om the desktop, which I want to compile programatically. The compiler(Auto2Exe.exe) is at ---->Program Files\Autoit3\Auto2Exe\Auto2Exe.exe. Script1 is just running compInfo2.au3 and outputs the results,but not compiling it. Script2 as shown below(of TheoFox) is working perfectly. ;SCRIPT2 = @DesktopDir & '\compInfo2.au3' $sPathAut2Exe = @ProgramFilesDir & "\AutoIt3\Aut2Exe\Aut2exe.exe" If Not FileExists($sPathAut2Exe) Then MsgBox(4096, "Error", "Aut2Exe not found") $sScript = @DesktopDir & '\compInfo2.au3' If Not FileExists($sScript) Then MsgBox(4096, "Error", "Script not found") If Not @Compiled Then Run($sPathAut2Exe & ' /IN "' & $sScript & '" /COMP 4') Else MsgBox(4096, "Ops", "I'm already compiled!") EndIf So issue may be considered resolved. Thanks a lot TheoFox & Jos for all the help. cheers olmar
  15. Hello Everybody, I have a .au3 script.I'm trying to compile this script(compinfo2.au3) by the following code(2 different scripts).Running these shows no error but the .au3 file is not compiled.Please someone help me. ;SCRIPT1 Local $LocationAut2Exe = @ProgramFilesDir &'\AutoIt3\Aut2Exe\Aut2Exe.exe' Run(' "C:\Users\pradeep\Desktop\compInfo2.au3' & $LocationAut2Exe & 'C:\Users\pradeep\Desktop\compInfo2.exe "?') ;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ;SCRIPT2 ShellExecute ( @ScriptDir & '\Aut2Exe\Aut2exe.exe', ' /in "' & @Scriptdir & '\compInfo2.au3" /comp 4' )
  16. Hi pluto41, Many thanks for your reply.I tried your revised version.But there are errors. @ECHO OFF ->"undefined macro" and for vol c: > comp_id.txt ->"Statement cannot be just an expression".Attaching snap shot(not showing the includes).Any idea why the errors? cheers olmar
  17. Hi there!! The following snippet gets the HDD serial number through a bat file.The bat file writes to a text file from which the sr. num. is retrieved by the Autoit script.In every run the HDD sr. num. is written successfully to comp_id.txt.But .au3 script acts inconsistently.It fail frequently (though succeeds occasionally) to retrieve the sr.no.. Can any one please help remove this inconsistent behavior ? here is the code: #include <constants.au3> #include <WinAPIFiles.au3> #include <MsgBoxConstants.au3> Func getHDDNum() Run("gtSrNumHDD.bat") While FileExists("comp_id.txt")==False Sleep(100) WEnd Sleep(100) Local $hddNum=FileReadLine("comp_id.txt",2) ConsoleWrite ("sr no is: "&$hddNum&@CRLF) MsgBox(0,"",$hddNum); ConsoleWrite ("sr no is: "&$hddNum&@CRLF) EndFunc getHDDNum() FileDelete("comp_id.txt") the .bat file code: @ECHO OFF::writes to file comp_id.txt wmic diskdrive get serialnumber > comp_id.txt I will greatly appreciate any help olmar
  18. Hi all, I have just found the auCGI module while searching for ways to put autoit code in the net.I have installed auCGI,Web .au3 and the abyss server.All woking fine.But I can't figure out where to (in which file) write the code or how to upload code from my computer.I want to test this(enclosed below) script:- Func greet() Run("notepad.exe") sleep(200) WinActivate("Untitled - Notepad","") ControlSetText("Untitled - Notepad","",15,"Hello Welcome to my Web page!!") EndFunc greet() Can anyone please help ! thanks olma nR
  19. Hi Everybody, I want to host an application written in .au3 on web. But don't know how to go about it.Can someone please help me take the first few steps ? What kind of web hosting site is best for this ? Will I have to translate the code to PHP or some other sever side language ? These are some of the questions coming to mind. Any help will be greatly appreciated. thanks olmanRvr
  20. Yeah, pretty old post.But I thank him for the code any way...... olmanR
  21. Hi dcop, Thanks for the code. I will try it out and get back. cheers olmanR
  22. HI All, Moving this question(regarding handling of msctls_statusbar32 to a new thread. thanks & cheers olmanR
  23. Hi, msctls_statusbar32 is quite a common windows control. Autoit is expected to be able to handle it. The info tool is able to select it and returns class,id etc.But not seeing any text in it. Can anyone tell what the matter is? Or is there other ways to do it. thanks & cheers olmanR
  24. Hi, All, I am trying to read Text from a status bar( class : msctls_statusbar32 ),so that a particular string would trigger my script.But the info tool is unable to read/extract any text or data from it.I tried StatusBarGetText but no success. Searched the net for 2 days again with no result. Could any one help on this? thanks & cheers olmanR
  25. `Hi Guys Sorry for the delayed post. Been working on my code, given below which is working fine. thanks for all the help & support cheers olmanR Func setQty() Static Local $sta =True if $sta=True Then $sta=False Local $SYM=ControlGetText("try - DP0280","NSE",2657) Local $prc=ControlGetText("try - DP0280","NSE",2639);price Local $magn=Call("getMarg","$SYM") Local $QTY=1000/$prc*$magn $QTY = Round($QTY) ControlSetText("try - DP0280","NSE",2640,$QTY);qty EndIf EndFunc
×
×
  • Create New...