
nlgma
Active Members-
Posts
41 -
Joined
-
Last visited
nlgma's Achievements

Seeker (1/7)
0
Reputation
-
Serial Pressure Floor Mat (Halloween Project)
nlgma replied to nlgma's topic in AutoIt General Help and Support
SOLVED (ONLY WORKS ON 32 BIT WINDOWS) Arduino Section I bought an Arduino UNO with some jumper wires off Amazon for $15. I downloaded and installed the Arduino software. I tried using the built in Digital Button example included with the Arduino software. I didn't have the proper resistor, however I connected jumper wires to PIN 5 to ground and PIN 2 to digital 2. When I tested the mat, the on-board LED would light up and it would light up randomly as well. After doing some research I found the following link that explained I was getting noise interference causing the code to randomly trigger http://www.instructables.com/id/Arduino-Button-Tutorial/ ////////////////////////////////////////////////////////////////////////////// // Arduino button tutorial 1. // // Demonstrates: // - detection of pressing state // // Push-button must be connected as follows: // __,__ // Pin2 ------o o------ GND // // (C) 2011 By P. Bauermeister // This example code is in the public domain. // ////////////////////////////////////////////////////////////////////////////// // Adapt these to your board and application timings: #define BUTTON_PIN 2 // Button #define DELAY 20 // Delay per loop in ms ////////////////////////////////////////////////////////////////////////////// void setup() { pinMode(BUTTON_PIN, INPUT); digitalWrite(BUTTON_PIN, HIGH); // pull-up Serial.begin(9600); } boolean handle_button() { int button_pressed = !digitalRead(BUTTON_PIN); // pin low -> pressed return button_pressed; } void loop() { // handle button boolean button_pressed = handle_button(); // do other things Serial.print(button_pressed ? "1" : "0"); // add newline sometimes static int counter = 0; if ((++counter & 0x3f) == 0) Serial.println(); delay(DELAY); }I loaded the above (slightly modified) code to the Arduino, connected jumper wires to PIN 5 to ground and PIN 2 to digital 2, stepped on the pad and magic happened. Autoit Section I downloaded the CommMG.au3 UDF and the commg.dll, however I couldn't get anything working, Why?!?!?! cause I was running a 64 bit version of windows. I installed Virtual Box and created a 32 bit VB and tested the again and magic happened. #include <arduino.au3> #include <GUIConstants.au3> #include <array.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <CommMG.au3> Local $convar = False _CommSetDllPath(@ScriptDir & "\commg.dll") $gui = GUICreate ("Arduino serial connections",500) $inut = GUICtrlCreateEdit("",10,60,200,300) $output = GUICtrlCreateEdit("",270,60,200,300,$ES_READONLY) $send = GUICtrlCreateButton("Send to Arduino",20,20) $ports = GUICtrlCreateCombo("",155,22) GUICtrlCreateLabel("Ports:" ,120,24) GUICtrlSetData($ports,_CommListports(1),_CommListports(0)) $connect = GUICtrlCreateButton(" Connect COM ",260,20) $disconnect = GUICtrlCreateButton (" Disconnect COM ",370,20) GUICtrlCreateLabel("Send edit",50,370) GUICtrlCreateLabel("Recieve edit",330,370) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $connect $ported = GUICtrlRead($ports) conecta(StringReplace($ported,"COM",""),9600) MsgBox ("","","Connected to :" &$ported) $convar = True Case $disconnect _CommCloseport() MsgBox ("","","COM Disconnected") $convar = False Case $GUI_EVENT_CLOSE _CommCloseport() Exit Case $send If $convar Then $sended = GUICtrlRead($inut) _CommSendString($sended,1) MsgBox ("","","String Send") else MsgBox ("","","Please connect to COM before sending data to it") EndIf EndSwitch $inpcom = _CommGetstring() If Not @error And StringLen($inpcom) > 0 And $inpcom <> 0 Then SplashTextOn("YOUR STANDING ON THE MAT","PLAY VIDEO","-1","-1","-1","-1",32,"Impact","36","700") If Not @error And StringLen($inpcom) > 0 And $inpcom <> 1 Then SplashOff() WEndThe above code is slightly modified and was used for testing to make sure everything was working. -
Hello, Another random project! The owner of my company wants to play the companies commercial when a computer is locked, can this be done in Autoit?
-
Serial Pressure Floor Mat (Halloween Project)
nlgma replied to nlgma's topic in AutoIt General Help and Support
OK, So I picked up a Sabrent USB 2.0 to serial adapter. I am assuming that I will need to be listening on Com4 with default settings 9600 ect... I have never scripted anything for this type of project, My thought was to monitor the com4 port and jump on the pad and see what information I can gather, then script something to listen on the port and play video when someone steps on the mat. If someone could point me in the right direction of what I am trying to do, I can write the code, please help! -
Hello, I picked up an older Pressure Floor Mat that use to be connected to a Wyse device and functioned as a auto logon / logoff switch for a kiosk. I have been working with the CommMG UDF's, with no luck. I installed a serial monitor program and still can't seem to communicate with the floor pad. A serial port was a bit difficult to locate, I currently have the floor mat connected to the docking station of the laptop. Project: Play short video when the Pressure Floor Mat is stepped on.
-
Thank you ! $Read = "C:\Users\"&@UserName&"\Desktop\Example Scripts - AutoIt Forums.url" _IECreate(IniRead($Read, "InternetShortcut", "URL", ""))
-
I'm trying to pull the URL: data from a Internet Shortcut (.url) I've tried: $details = FileGetShortcut("C:\Users\"&@UserName&"\Desktop\Example Scripts - AutoIt Forums.url") If @error Then MsgBox(0, "@error", @error) For $t = 0 to 6 MsgBox(0, "Path:", $details[$t]) Next _IECreate ($details[??])
-
A little back ground. Every morning I have to Open an excel spreadsheet click Data > Refresh all. A box pops up asking for my AD credentials. Then updates the spreadsheet with the data. I'm trying to script this, Short of mouse clicks and send commands. Is there a "excel.object.data_refresh($server,$port,$user,$password)" command that I can use?
-
I've been kicking around this script for a few weeks. It's not much but it kind of gives you and Idea of what I'm trying to do. I keep running in to little issues here and there. I would like to know if it's wroth the time to script or should I just download something ? To list a few things I want it to do: 1. List all running Processes 2. Go to a site an scrape data about the Processes (processlibrary.com) 3. Create a white list of allowed Processes 4. Create a black list of blocked Processes 5. Warning for all other Processes #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <Array.au3> _Main() Func _Main() GUICreate("List Process and PID", 400, 400) Global $hListView = GUICtrlCreateListView("", 2, 2, 394, 180) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) Global $hListKill = GUICtrlCreateListView("", 2, 222, 394, 140) _GUICtrlListView_SetExtendedListViewStyle($hListKill, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) Global $Add_White = GUICtrlCreateButton("Add to White list", 5, 375, 100, 20) Global $Add_Black = GUICtrlCreateButton("Add to Black list", 125, 375, 100, 20) Global $Kill = GUICtrlCreateButton("Kill", 250, 375, 50, 20) GUISetState() ; Add columns _GUICtrlListView_AddColumn($hListView, "Process", 100) _GUICtrlListView_AddColumn($hListView, "PID", 100) _GUICtrlListView_SetColumnWidth($hListView, 1, 50) _GUICtrlListView_AddColumn($hListView, "Executable Path", 100) _GUICtrlListView_SetColumnWidth($hListView, 2, 250) ; Add columns _GUICtrlListView_AddColumn($hListKill, "Process", 100) _GUICtrlListView_AddColumn($hListKill, "PID", 100) _GUICtrlListView_SetColumnWidth($hListKill, 1, 50) _GUICtrlListView_AddColumn($hListKill, "Executable Path", 100) _GUICtrlListView_SetColumnWidth($hListKill, 2, 250) SplashTextOn("Process List Properties...", "Please wait ...", 200, 50) Global $avRET = _ProcessListProperties() $hImage = _GUIImageList_Create(16, 16, 5, $avRET[0][0]) Global $o = 0 For $i = 1 To $avRET[0][0] _GUICtrlListView_AddItem($hListView, $avRET[$i][0], $o) _GUICtrlListView_AddSubItem($hListView, $o, $avRET[$i][1], 1) _GUICtrlListView_AddSubItem($hListView, $o, $avRET[$i][5], 2) $o = $o + 1 Next SplashOff() EndFunc ;==>_Main Global $o = 0 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $Add_White For $i = 1 To $avRET[0][0] If _GUICtrlListView_GetItemChecked($hListView, $i) = True Then MsgBox(0, _GUICtrlListView_GetItemText($hListView, $i), _GUICtrlListView_GetItemChecked($hListView, $i)) ;Add Selected Items to White List EndIf Next Case $msg = $Add_Black For $i = 1 To $avRET[0][0] If _GUICtrlListView_GetItemChecked($hListView, $i) = True Then $aItem = _GUICtrlListView_GetItemTextArray($hListView, $i) _GUICtrlListView_BeginUpdate($hListKill) _GUICtrlListView_AddItem($hListKill, $aItem[1], 0) _GUICtrlListView_AddSubItem($hListKill, $o, $aItem[2], 1) _GUICtrlListView_AddSubItem($hListKill, $o, $aItem[3], 2) _GUICtrlListView_SetItemChecked($hListView, $i, False) _GUICtrlListView_EndUpdate($hListKill) $o = $o + 1 EndIf Next Case $msg = $Kill For $i = 1 To $avRET[0][0] If _GUICtrlListView_GetItemChecked($hListKill, $i) = True Then SplashTextOn("Process Killing...", "Please wait ...", 200, 50) $aItem = _GUICtrlListView_GetItemTextArray($hListKill, $i) If ProcessExists($aItem[1]) Then ;Do ; ProcessClose($aItem[1]) ;Until ProcessExists($aItem[1]) = 0 SplashOff() EndIf EndIf Next EndSelect WEnd ;=============================================================================== ; Function Name: _ProcessListProperties() ; Description: Get various properties of a process, or all processes ; Call With: _ProcessListProperties( [$Process [, $sComputer]] ) ; Parameter(s): (optional) $Process - PID or name of a process, default is "" (all) ; (optional) $sComputer - remote computer to get list from, default is local ; Requirement(s): AutoIt v3.2.4.9+ ; Return Value(s): On Success - Returns a 2D array of processes, as in ProcessList() ; with additional columns added: ; [0][0] - Number of processes listed (can be 0 if no matches found) ; [1][0] - 1st process name ; [1][1] - 1st process PID ; [1][2] - 1st process Parent PID ; [1][3] - 1st process owner ; [1][4] - 1st process priority (0 = low, 31 = high) ; [1][5] - 1st process executable path ; [1][6] - 1st process CPU usage ; [1][7] - 1st process memory usage ; [1][8] - 1st process creation date/time = "MM/DD/YYY hh:mm:ss" (hh = 00 to 23) ; [1][9] - 1st process command line string ; ... ; [n][0] thru [n][9] - last process properties ; On Failure: Returns array with [0][0] = 0 and sets @Error to non-zero (see code below) ; Author(s): PsaltyDS at http://www.autoitscript.com/forum ; Date/Version: 12/01/2009 -- v2.0.4 ; Notes: If an integer PID or string process name is provided and no match is found, ; then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList) ; This function requires admin permissions to the target computer. ; All properties come from the Win32_Process class in WMI. ; To get time-base properties (CPU and Memory usage), a 100ms SWbemRefresher is used. ;=============================================================================== Func _ProcessListProperties($Process = "", $sComputer = ".") Local $sUserName, $sMsg, $sUserDomain, $avProcs, $dtmDate Local $avProcs[1][2] = [[0, ""]], $n = 1 ; Convert PID if passed as string If StringIsInt($Process) Then $Process = Int($Process) ; Connect to WMI and get process objects $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy, (Debug)}!\\" & $sComputer & "\root\cimv2") If IsObj($oWMI) Then ; Get collection processes from Win32_Process If $Process == "" Then ; Get all $colProcs = $oWMI.ExecQuery("select * from win32_Process") ElseIf IsInt($Process) Then ; Get by PID $colProcs = $oWMI.ExecQuery("select * from win32_Process where ProcessId = " & $Process) Else ; Get by Name $colProcs = $oWMI.ExecQuery("select * from win32_Process where Name = '" & $Process & "'") EndIf If IsObj($colProcs) Then ; Return for no matches If $colProcs.count = 0 Then Return $avProcs ; Size the array ReDim $avProcs[$colProcs.count + 1][10] $avProcs[0][0] = UBound($avProcs) - 1 ; For each process... For $oProc In $colProcs ; [n][0] = process name $avProcs[$n][0] = $oProc.name ; [n][1] = process PID $avProcs[$n][1] = $oProc.ProcessId ; [n][2] = Parent PID $avProcs[$n][2] = $oProc.ParentProcessId ; [n][3] = Owner If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName ; [n][4] = Priority $avProcs[$n][4] = $oProc.Priority ; [n][5] = Executable path $avProcs[$n][5] = $oProc.ExecutablePath ; [n][8] = Creation date/time $dtmDate = $oProc.CreationDate If $dtmDate <> "" Then ; Back referencing RegExp pattern from weaponx Local $sRegExpPatt = "\A(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?:.*)" $dtmDate = StringRegExpReplace($dtmDate, $sRegExpPatt, "$2/$3/$1 $4:$5:$6") EndIf $avProcs[$n][8] = $dtmDate ; [n][9] = Command line string $avProcs[$n][9] = $oProc.CommandLine ; increment index $n += 1 Next Else SetError(2); Error getting process collection from WMI EndIf ; release the collection object $colProcs = 0 ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher") $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet $oRefresher.Refresh ; Time delay before calling refresher Local $iTime = TimerInit() Do Sleep(50) Until TimerDiff($iTime) >= 100 $oRefresher.Refresh ; Get PerfProc data For $oProc In $colProcs ; Find it in the array For $n = 1 To $avProcs[0][0] If $avProcs[$n][1] = $oProc.IDProcess Then ; [n][6] = CPU usage $avProcs[$n][6] = $oProc.PercentProcessorTime ; [n][7] = memory usage $avProcs[$n][7] = $oProc.WorkingSet ExitLoop EndIf Next Next Else SetError(1); Error connecting to WMI EndIf ; Return array Return $avProcs EndFunc ;==>_ProcessListProperties
-
Thank you, I have it configured correctly with SciTEConfig, But the icons in windows show up as the default unknown icon verses the SciTE icon. While playing around I noticed that if I rename the SciTe.exe to anything other then SciTe.exe. (aka Copy - SciTE.exe)I can use the "Open with" and choose SciTE from the list, But the icons are still the default unknown icon. I have my autoIt3 folder installed in My Dropbox folder. Could that be causing the issue ?
-
I'm having an issue setting my .au3 files to be opened with SciTE. Windows 7 - Open With - Change Default Program When I browse to *\Autoit3\SciTE\ and choose SciTE.exe. SciTE does not seem to populate in the "Open with" window. I have already downloaded and install the newest version of both Autoit3 and SciTE. I can choose to "Open with" AutoIt3.exe. I know it's me... But help me out foo.
-
The "Need Admin mode" window has a typo in the text. The error "Asnwer" ! FYI
-
The biggest issue I have is the UDF's. I'm very thank full for those whom write them, But I have the hardest time finding them. I would like to see a UDF specific form or and easier way to locate them. I wouldn't say I write amazing code, but with the help of the forms I am able to complete 98% of my projects. Thank you all !
-
Sup all ! I could use some help with this code. When you click on File > Open and select a file. On line 45: If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu). This adds the file path to File > Recent Files. I would like to be able click on the Recent File > File path and reopen the file. #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $defaultstatus, $status, $filemenu, $fileitem, $helpmenu, $saveitem Local $infoitem, $exititem, $recentfilesmenu, $separator1, $viewmenu Local $viewstatusitem, $okbutton, $cancelbutton, $statuslabel, $msg, $file GUICreate("My GUI menu", 300, 200) Global $defaultstatus = "Ready" Global $status $filemenu = GUICtrlCreateMenu("&File") $fileitem = GUICtrlCreateMenuItem("Open", $filemenu) GUICtrlSetState(-1, $GUI_DEFBUTTON) $helpmenu = GUICtrlCreateMenu("?") $saveitem = GUICtrlCreateMenuItem("Save", $filemenu) GUICtrlSetState(-1, $GUI_DISABLE) $infoitem = GUICtrlCreateMenuItem("Info", $helpmenu) $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu, 1) $separator1 = GUICtrlCreateMenuItem("", $filemenu, 2) ; create a separator line $viewmenu = GUICtrlCreateMenu("View", -1, 1) ; is created before "?" menu $viewstatusitem = GUICtrlCreateMenuItem("Statusbar", $viewmenu) GUICtrlSetState(-1, $GUI_CHECKED) $okbutton = GUICtrlCreateButton("OK", 50, 130, 70, 20) GUICtrlSetState(-1, $GUI_FOCUS) $cancelbutton = GUICtrlCreateButton("Cancel", 180, 130, 70, 20) $statuslabel = GUICtrlCreateLabel($defaultstatus, 0, 165, 300, 16, BitOR($SS_SIMPLE, $SS_SUNKEN)) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $fileitem Then $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) EndIf If $msg = $viewstatusitem Then If BitAND(GUICtrlRead($viewstatusitem), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($viewstatusitem, $GUI_UNCHECKED) GUICtrlSetState($statuslabel, $GUI_HIDE) Else GUICtrlSetState($viewstatusitem, $GUI_CHECKED) GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf EndIf If $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton Or $msg = $exititem Then ExitLoop If $msg = $infoitem Then MsgBox(0, "Info", "Only a test...") WEnd GUIDelete() EndFunc ;==>Example
-
Thank you ... thank you ... thank you
-
Blow is an idea of what I'm trying to do. #include <GuiButton.au3> #include <GUIConstants.au3> #include <Excel.au3> $Test = GUICreate("Show / Hide", 305, 115, 320, 300) $Button0 = GUICtrlCreateButton("Open", 25, 70, 130, 30) $Button1 = GUICtrlCreateButton("Show", 155, 70, 130, 30) $Button2 = GUICtrlCreateButton("Hide", 155, 70, 130, 30) GUICtrlSetState($Button2 , $gui_Hide) $Input1 = GUICtrlCreateInput("", 25, 40, 210, 20) $Button3 = GUICtrlCreateButton("", 240, 25, 30,30, $BS_ICON) _GUICtrlButton_SetImage($Button3, "shell32.dll", 55, True) $Label1 = GUICtrlCreateLabel("Enter in the path to your excel file.", 25, 15, 215, 20) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button3 $var = FileOpenDialog("Choose a file.",@ScriptDir&"", "Excel (*.csv)|ALL (*.*)") GUICtrlSetData($Input1,$var) Case $Button0 $oExcel = _ExcelBookOpen(GUICtrlRead($Input1),0); 0 = NOT Visible | 1 = Visible Case $Button1 ;I need it to show the Excel window. GUICtrlSetState($Button1 , $gui_Hide) GUICtrlSetState($Button2 , $gui_Show) Case $Button2 ;I need it to hide the Excel window. GUICtrlSetState($Button1 , $gui_Show) GUICtrlSetState($Button2 , $gui_Hide) EndSwitch WEnd