
nfwu
Active Members-
Posts
1,195 -
Joined
-
Last visited
Everything posted by nfwu
-
This is so old I'd forgotten about it. How to use the example provided: 1. Press Browse to go to the exe 2. Type in data you want to save to the exe 3. Press Save To retrieve the data, do the following: 1. Press Browse to go to the exe 2. The data magically appears. How does it work: To read the data out of the executable: $the_data_I_want = _BindRead(_BindLoad($path_to_exe)) To save data to the executable: _BindSave($path_to_exe, _BindSet(_BindLoad($path_to_exe), $the_data_to_save)) Work something out with that.
-
detecting network working-ness
nfwu replied to GodForsakenSoul's topic in AutoIt General Help and Support
http://www.autoitscript.com/autoit3/docs/functions/Ping.htm Ping google.com / some other pingable server every 3 minutes or so. When Ping returns 0, you are most likely disconnected from the internet. -
neogia's old guide was handy: http://www.autoitscript.com/forum/index.php?showtopic=23627 "technical" document if you're into that stuff: http://www.autoitscript.com/autoit3/pcrepattern.html
-
Incorrect. That was a one-line If statement, an EndIf is not required. That wouldn't work. The addition operator doesn't work on strings. -------------- Okay. While True Run("Conexion.cmd") ;; Here, we wait until a the window exists. WinWait("Prekybos tinklas internete - Mozilla Firefox", "") ;; Then it brings it to front, and waits for it to come to front... WinActivate("Prekybos tinklas internete - Mozilla Firefox", "") WinWaitActive("Prekybos tinklas internete - Mozilla Firefox", "") ;;Once the window exists and is in front, this would run: Send("{CTRLDOWN}w{CTRLUP}") Send("{CTRLDOWN}{SHIFTDOWN}{DEL}{CTRLUP}{SHIFTUP}") Wend Is this what you wanted?
-
Please helpwith runas over network
nfwu replied to hacksawbob's topic in AutoIt General Help and Support
I'm pretty sure you can't run a batch file directly but need a shell to do so, so here: ; Fill in the username and password appropriate for your system. Local $sUserName = "USERNAME" Local $sPassword = "PASSWORD" ; Run a command prompt as the other user. Local $pid = RunAsWait($sUserName, @ComputerName, $sPassword, 0, @ComSpec & " /c " & "\\server\share\batch.bat", @SystemDir) ; Wait for the process to close. ProcessWaitClose($pid) ; Show a message. MsgBox(0, "", "The process we were waiting for has closed.") EDIT: Typos -
Without the last backslash: RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\APcDefender")
-
Please helpwith runas over network
nfwu replied to hacksawbob's topic in AutoIt General Help and Support
RunAs("adminuser", @computername, "XXXXPASS", 0, "\\server\share\batch.bat", @SystemDir) String literals, or string data in source code, needs quotes: "". -
You want the server to loop. First ask yourself, what do you need to loop? Since you want the server to do processing then wait for another connection, you need to loop back to the part where the server accepts a connection. ; Initialize a variable to represent a connection ;============================================== $ConnectedSocket = -1 ;;; nfwu: Start an infinite loop While 1 ;Wait for and Accept a connection Do $ConnectedSocket = TCPAccept($MainSocket) Until $ConnectedSocket <> -1 ; Get IP of client connecting $szIP_Accepted = SocketToIP($ConnectedSocket) ; GUI Message Loop While 1 ; Try to receive (up to) 2048 bytes $recv = TCPRecv($ConnectedSocket, 2048) ; If the receive failed with @error then the socket has disconnected If @error Then ExitLoop ; Update the Volume Level If $recv <> "" Then SoundSetWaveVolume ($recv) WEnd ;;;nfwu: Close the previous connection before opening a new one TCPCloseSocket($ConnectedSocket) ;;;nfwu: Mark $ConnectedSocket as being invalid, so the Do...Until loop way up there that waits for a connection actually waits for a connection =P $ConnectedSocket = -1 WEnd ;;;nfwu: Jump back to the start of this loop TCPShutdown() Read my comments. Replacing the appropriate section of code in the server with this should do the trick. Feel free to ask more questions. =P
-
Is there a way to cancel a sleep() ?
nfwu replied to Mixam's topic in AutoIt General Help and Support
Something like this? HotKeySet("{f8}", "_foo") Sleep(1000000000) MsgBox(0, "", "End") Func _foo() MsgBox(0, "", "Do Stuff") EndFunc If I remember correctly, it "continues the sleep", as you say. Just run the code to find out! -
Oh, so you wanted PID by name? Func _ProcessPID($ProcessName) Local $colItems = "" Local $strComputer = "localhost" Local $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems =$objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & $ProcessName& "'") For $objItem In $colItems Return Int($objItem.ProcessID) Next EndFunc
-
{xxx up}, {xxx down} are for send. They don't work on HotKeySet. HotKeySet triggers when the key combo is released. Generator's code is the correct way, but the code has to be in a loop.
-
Spoonfeeding time! Do it like this: Func Button1() MsgBox(0,'',GuiCtrlRead($Input1)) MsgBox(0,'',GuiCtrlRead($Input2)) EndFunc Eval takes the name of the variable as a string and returns the value of that variable. You *cannot* use a string as a variable name directly, like you intended to do.
-
Func _ProcessMem_ByPID($ProcessID) Local $colItems = "" Local $strComputer = "localhost" Local $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") Local $colItems =$objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE ProcessId = '" & $ProcessID& "'") For $objItem In $colItems Local $mem=$objItem.WorkingSetSize /1024 Return Int($mem) Next EndFunc Win32_Process: http://msdn.microsoft.com/en-us/library/aa394372(VS.85).aspx
-
As for failed hardware, you should poll the hardware and check to see if any drop out. (I know how to do that on a *nix, but not a windows server) Or run automated hardware diagnostics periodically. Find a good program and automate it using AutoIt.
-
You should probably remove some rows, like those that are not necessary or not using
-
Reply to crzftx: Func _user32_MouseMove($x, $y) $pos = MouseGetPos() $xAmount = $x- $pos[0] $yAmount = $y- $pos[1] DllCall("user32.dll","none","mouse_event","long",1,"long",$xAmount,"long",$yAmount,"long",0,"long", 0) EndFunc #) edit: was bored, and did it for the heck of it.
-
What I think @op wants is to disable any new windows that show up. $ListOne = WinList () While 1 $ListTwo = WinList () For $X = 1 to $ListTwo[0][0] $found = false ;Comparing by HWND For $Y = 1 to $ListOne[0][0] If $ListOne[$Y][1] = $ListTwo[$X][1] Then $found = true ExitLoop EndIf Next If $found = false Then MsgBox(0,"","New window found: " & $ListTwo[$X][0] & @CRLF & $ListTwo[$X][1]) WinSetState( $ListTwo[$X][0], "", @SW_Disable) ExitLoop 2 EndIf Next $ListOne = $ListTwo WEnd (I haven't used AutoIt for 6 months so am rusty.) #)
-
[Solved] Need help telling USB Devices apart....
nfwu replied to Dougiefresh's topic in AutoIt General Help and Support
ChrisL's code is *supposed* to print the name physical disk (\.\PHYSICALDRIVE3) then the name disk partitions then the names of logical drives for the disk partitions (u:, v:, etc). Probabily the reason why you don't have the disk partition/logical drive information printed out is because the media is not inserted. (i.e. you don't haveSD/SM/CF cards in their respective slots) #) -
How to sort numerically a CSV file?
nfwu replied to asgarcymed's topic in AutoIt General Help and Support
;;Step 1: Read data from file into an array $filenamein = "in.csv" $filehandle = FileOpen($filenamein, 0) Dim $data[1024][2] $count = 0 While 1 $read = FileReadLine($filehandle) If @Error = -1 Then ExitLoop $read = StringSplit($read, ",") $data[$count][0] = $read[1] $data[$count][1] = $read[2] $count += 1 WEnd FileClose($filehandle) ;; Step 2: Resize the array to the correct size ReDim $data[$count][2] ;; Step 3: Preform a sort operation, in this case it is the "Bubble Sort" algorithum. $swapped = 1 While $swapped = 1 $swapped = 0 For $i = 0 to $count-2 If Number($data[$i][1]) > Number($data[$i+1][1]) Then ;;Swap values $temp1 = $data[$i][1] $temp2 = $data[$i][0] $data[$i][1] = $data[$i+1][1] $data[$i][0] = $data[$i+1][0] $data[$i+1][1] = $temp1 $data[$i+1][0] = $temp2 $swapped = 1 EndIf Next WEnd ;; Step 4: Output result to file $fileout = "out.csv" $filehandle = FileOpen ( $fileout, 2 ) For $i = 0 to $count-1 FileWriteLine($filehandle, $data[$i][0]&","&$data[$i][1]) Next FileClose($filehandle) #) -
How to click on a control in GIMP?
nfwu replied to Zoli1972's topic in AutoIt General Help and Support
GIMP already has an automation interface, called Gimp-Fu. http://www.goof.com/pcg/marc/man/Gimp/Fu.html -
Execution of the script does not continue until TTS stops speaking. That is, your program hangs there until TTS is done. You can prevent this by breaking the speech up into sentences, then testing if you need to stop each time a sentence completes. #)
-
Statistics script for Autoit source code
nfwu replied to Xenobiologist's topic in AutoIt General Help and Support
Improvements to existing: [Ff][Uu][Nn][Cc][ \t]+[a-zA-Z0-9_]*[ \t]+\(.*\) (?i)#[ \t]*include[ \t]*[<"][ \t]*(.*?\.au3)[ \t]*[>"] ;;Spaces are allowed between # and include #) -
The code after the GUI will run AFTER you exit the While loop. #include <GUIConstants.au3> #include <Inet.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Berto\Desktop\LAN Share Gui.kxf $Form1 = GUICreate("LAN share", 324, 165, 503, 456, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xFFFFFF) $Button1 = GUICtrlCreateButton("Trimite", 16, 120, 137, 33, 0) $Button2 = GUICtrlCreateButton("Accepta", 17, 68, 137, 33, 0) $Button3 = GUICtrlCreateButton("Exit", 212, 110, 97, 41, 0) $Input1 = GUICtrlCreateInput("AInput1", 16, 24, 137, 21) $Label1 = GUICtrlCreateLabel("Introdu IP", 16, 8, 50, 17) GUICtrlSetBkColor(-1, 0xFFFFFF) $Button4 = GUICtrlCreateButton("Selecteaza fisier\folder", 168, 24, 145, 25, 0) $Progress1 = GUICtrlCreateProgress(168, 64, 145, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### TCPStartup ( ) $PublicIP = _GetIP() TCPListen($PublicIP, 26222) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
-
Use the FlowScript API: http://cocoon.apache.org/2.1/userdocs/flow/api.html var value = cocoon.request.getAttribute("res_name"); Edit: The more common case would be that there would be a PHP script spitting out the JS on the other end. Edit2: Or look at this once it comes back up again: Passing Query String Parameters to External java script: http://feather.elektrum.org/book/src.html #)
-
I did mine the lazy way: (Change the following: metisclient.sourceforge.net, file=stuffs.txt, and some other stuff) $stuff = _URLEncode(FileRead(@ScriptDir&"\stuff.txt"), 1) $payload = "action=save&file=stuffs.txt&text="&$stuff&"&Save=Save" $send = "POST /file_reciever.php HTTP/1.1"&@CRLF& _ "Host: metisclient.sourceforge.net"&@CRLF& _ "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3"&@CRLF& _ "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"&@CRLF& _ "Accept-Language: en-us,en;q=0.8,zh;q=0.5,ja;q=0.3"&@CRLF& _ "Accept-Encoding: gzip,deflate"&@CRLF& _ "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"&@CRLF& _ "Keep-Alive: 300"&@CRLF& _ "Connection: keep-alive"&@CRLF& _ "Content-Type: application/x-www-form-urlencoded"&@CRLF& _ "Content-Length: "&Stringlen($payload)&@CRLF&@CRLF&$payload $sock = TCPConnect(TCPNameToIP("metisclient.sourceforge.net"), 80) If @error Then MsgBox(0, @error, @ScriptLineNumber) TCPSend($sock, $send) If @error Then MsgBox(0, @error, @ScriptLineNumber) $stuff = "" while Not @error $stuff &= TCPRecv($sock, 1000000) WEnd TCPShutdown() If @error Then MsgBox(0, @error, @ScriptLineNumber) MsgBox(0, "Please Check for any errors:", StringLeft($stuff, 1000)) MsgBox(0, "", "Complete") And the PHP code is sth like this: <?php $file = str_replace ('"', '', $_REQUEST['file']); $action = str_replace ('"', '', $_REQUEST['action']); if($action == '') $action = "edit"; if($file == '') $file = "stuffs.txt"; echo "<title>Nfwu's Online File Editor - "; echo $file; echo '</title>'; if ($action == "save"){ if (strpos($file, "..")) die("can't open file"); $fh = fopen("./".$file, 'w') or die("can't open file"); fwrite($fh, $_REQUEST['text']); fclose($fh); echo '<b>File Saved.</b><br>'; } $handle = fopen($file, "r"); $contents = fread($handle, filesize($file)); fclose($handle); echo '<form method="post" action="oe.php" enctype="application/x-www-form-urlencoded">'; echo '<input type="hidden" name="action" value="save" />'; echo 'File: '.$file; echo '<input type="hidden" name="file" value="'; echo $file; echo '" />'; echo '<textarea name="text" rows="20" cols="65" wrap="virtual" style="width:100%">'; echo $contents; echo '</textarea>'; echo '<input type="submit" name="Save" value="Save" />'; echo "</form>"; Note: If you're going to send something other than text files you should convert them to hex or something first, then convert them back at the other end. #)