
ttleser
Active Members-
Posts
138 -
Joined
-
Last visited
Everything posted by ttleser
-
Holy crap that worked. I didn't even think about using |more. What made you think of that Mhz? Thanks!
-
Any thoughts as to why I can have the output redirected to a file in DOS. You can open the file in notepad and view the "E test2.bat" but if you pull in the contents of the file in AutoIT, you can't see "E test2.bat" unless you had saved it in notepad? Could it be that the data in the text file as well as the stream in AutoIT is.... I'm going to fumble around on this..... is in a different format (UTF 16, ASCI, Binary) or something that AutoIT can't pick up on? I'm grasping at straws as to why that part of the stream isn't readable. Any thoughts on this?
-
John, I tried the script you just posted and got the same result. So you guys know, I'm ignoring the If StringinStr portion of the script causing it's looking for text that isn't what I need. I think you're not understanding what part in the output I'm interested in. In the output example listed below (the correct output), the Red text is what I'm interested in. The Red text is what is being cut off on Windows XP only. The text that says "New files added to this directory will not be encrypted" isn't what I'm interested in. Listing C:\ New files added to this directory will not be encrypted. E Test2.txt The console output shows: Listing C:\ New files added to this directory will not be encrypted. which it should show: Listing C:\ New files added to this directory will not be encrypted. E Test2.txt The "E" before Test2.txt means the file is encrypted, it would be a "U" if it weren't. I've attached a screenshot of my Windows XP desktop that shows a DOS window where I ran the cipher command (by itself it shows all files in the current directory and their encryption status) and cipher 1.txt that shows the encryption status of just that file. The screenshot also shows John's code (with filename change) with it's output. it also shows the files in c:\ in Windows explorer (note the file is green, which means it's encrypted).
-
Tried: $Foo = Run(@ComSpec & ' /c cipher.exe "test2.txt"', "c:", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $Foo = Run(@ComSpec & ' /c cipher.exe "c:test2.txt"', "c:", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) The working directory in this example is c: which is where the test2.txt file is stored which should suffice... However, I had also tried doing '/c cipher.exe "c:test2.txt"' as well, results were the same.
-
Again, keep in mind this problem is happening on Windows XP only, Windows 7 is fine. OK, got an update on this. I tried my script again, but changed it so that the run command would look like this: $foo = Run(@Comspec & "/c cipher.exe test2.txt >> c:output.txt","c:",@SW_HIDE) Then later in the code I did _FileReadtoArray("c:output.txt",$Array) _ArrayDisplay($Array) My thought was to have DOS output the results of the cipher command to a text file then I would just read that text file and see what it said. The Array showed the same results as previous attempts: Listing C: New files added to this directory will be encrypted. However, get this. If I use notepad to open the output.txt file, it shows what I would have expected it to show: Listing C: New files added to this directory will not be encrypted. E test2.txt Why is it that _FileReadToArray didn't pick up on the extra lines?... Once I opened the output.txt in Notepad and re-saved it... the _FileReadToArray did pick up on the last lines.
-
No. The files I'm testing are on my desktop which my code allows for.
-
I got it to work fine in Windows 7... the problem is that Windows XP isn't behaving the same. Windows XP is the one that's truncating the last few lines of the output.
-
That doesn't work either. It was reporting the file as not encrypted when it actually is encrypted. So I rem'd out the IF section and did: msgbox(0,"test",stdoutread($PID,1)) instead and again it's cutting off the bottom. The $stderr_merged or $stdout_child.... can someone explain how it works exactly? I've used stdoutread before, but I don't really understand how it works. Does specifying $stdout_child in the run line state that I'm intending to look at the output at some point, so have the data in memory until I need it (stdoutread in a loop)??
-
Really? What does it show? You do need the extension in the filename. If you type "cipher" at the CMD prompt in....say... your documents directory, it'll show you all the files and folders (not subfolders) and their encrypted/unencrypted state. We're running "professional" at work, however this works for Windows 7 home edition too. So: c: cdusersYOURIDDesktop Cipher
-
Greetings all. Need some help understanding what's happening here. I've got a simple script that will determine if a file is encrypted or not, but I'm having issues with it working in Windows XP however it works fine in Windows 7. To find out if a file is encrypted is an easy thing to find out. If you open up a CMD prompt, change to the directory with the file and type "cipher FILENAME" it will report back whether or not it's encrypted: C:\Users\c0006767\Desktop>cipher test2.txt Listing C:\Users\c0006767\Desktop\ New files added to this directory will be encrypted. E test2.txt C:\Users\c0006767\Desktop> The "E" in front of the return data indicated it's "E"ncrypted, a "U" would indicate "U"nencrypted. This command works fine on both Windows XP and Windows 7. Cipher.exe has been part of Windows since Windows 2000. My script works great in Windows 7, however in Windows XP it's cutting off the "E test2.txt" part of the output, so the return looks like this: Listing C:\Users\c0006767\Desktop\ New files added to this directory will be encrypted. Again, if I open up a CMD prompt and try it that way directly, it displays what it should. I've tried different ways for the while loop, while 1 v.s. while processexists($foo), netiher seem to help Windows XP. For both operating systems, I'm an administrator. Here's the script: #include <Constants.au3> #RequireAdmin $Foo = Run(@ComSpec & ' /c cipher.exe "test2.txt"', "c:\", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line2 $line2 = "" $Temp2 = "" While 1 $line2 &= StdoutRead($Foo) If @error Then ExitLoop WEnd While 1 $line2 &= StderrRead($Foo) If @error Then ExitLoop WEnd Sleep(3000) msgbox(0,$What,$line2,1) Thoughts?
-
Creating Multiple Check boxes based on a loop
ttleser replied to ttleser's topic in AutoIt GUI Help and Support
Ok, so did I offend you guys? -
Creating Multiple Check boxes based on a loop
ttleser replied to ttleser's topic in AutoIt GUI Help and Support
I thought "4" (since it showed up as a value in the $CheckBoxes array) would be the handle for that control. If the "4" isn't a handle, then what exactly is it? So I guess I went about it wrong, hence why I'm asking for help. So let's start at the beginning. How do I dynamically create checkboxes based on sectionnames in an INI file and be able to retrieve the states using a loop to create them? -
I've searched the forums and found several articles but I guess I'm missing the idea of being able to create multiple checkboxes in a loop. Ok, let me revise that. I can create them fine, but I'm struggling to understand how to interact with the checkboxes. I want to create a GUI to read one INI file, creating checkboxes based on the sections in that INI file. This I'm able to do. However, I can't figure out how to read or set the state of the checkbox. Here's a sample script so far. Keep in mind I've been playing with different things to see what results are to try other things to see if I can change the state of a checkbox or read the state, but nothing is helping. The script isn't the cleanest thing in the world right now due to the troubleshooting I'm doing. Here's some of the code (Not All): #include <GUIConstantsEx.au3> #Include <File.au3> #Include <Array.au3> #include <String.au3> #include <EditConstants.au3> #include <Constants.au3> Dim $CheckBoxes[2], $OutputArray[2][2], $objWMIService, $CheckBoxArray[2][2] $b = 2 $Sections = IniReadSection(@ScriptDir&"\GWPInfo.ini","Options") ;_ArrayDisplay($Sections) GUICreate("GWPInfo",300,300) GuiCtrlCreateLabel("The helpdesk will advise which options to choose.",10,20,280,20) ;$Basic = GUICtrlCreateCheckbox("Basic",10,40,100,20) For $a = 1 to $Sections[0][0] If StringInStr(($a/2),".") > 0 Then ;ConsoleWrite($Sections[$a][0]&@CRLF) ReDim $CheckBoxes[$a+1] ReDim $CheckBoxArray[$a+1][2] $CheckBoxes[$a] = GUICtrlCreateCheckbox($Sections[$a][0],10, $b * 20,100,20) $CheckBoxes[0] = $a $CheckBoxArray[0][0] = $a $CheckBoxArray[$a][0] = $Sections[$a][0] ;ConsoleWrite("1"&@CRLF) $CheckBoxArray[$a][1] = $CheckBoxes[$a] ;ConsoleWrite("2"&@CRLF) $b = $b + 1 ConsoleWrite("$CheckBoxes[$a] for "&$Sections[$a][0]&" = "&$CheckBoxes[$a]&@CRLF) Else ;ConsoleWrite($Sections[$a][0]&@CRLF) ReDim $CheckBoxes[$a+1] ReDim $CheckBoxArray[$a+1][2] $CheckBoxes[$a] = GUICtrlCreateCheckbox($Sections[$a][0],160, $b * 20,100,20) $CheckBoxes[0] = $a $CheckBoxArray[0][0] = $a $CheckBoxArray[$a][0] = $Sections[$a][0] ;ConsoleWrite("3"&@CRLF) $CheckBoxArray[$a][1] = $CheckBoxes[$a] ConsoleWrite("$CheckBoxes[$a] for "&$Sections[$a][0]&" = "&$CheckBoxes[$a]&@CRLF) ;ConsoleWrite("4"&@CRLF) EndIf Next _ArrayDisplay($CheckBoxes,"$Checkboxes") ;_ArrayDisplay($CheckBoxArray,"$CheckboxArray") For $f = $CheckboxArray[1][0] to $CheckboxArray[0][0] + $CheckboxArray[1][0] If $CheckBoxArray[$f][0] = "Basic" Then ConsoleWrite("Found Basic"&@CRLF) ConsoleWrite("Basic's GUI ID = "&$CheckBoxArray[$f][1]&@CRLF) ;GuiCtrlSetState($CheckBoxes[$CheckBoxArray[$f][1]],$GUI_CHECKED) GuiCtrlSetState($CheckBoxes[4],$GUI_CHECKED) GuiCtrlSetState($CheckBoxes[$CheckBoxArray[$f][1]],$GUI_DISABLE) ExitLoop EndIf Next $Start = GUICtrlCreateButton("START",110,230,80,40,0x0001) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $Start ;_ArrayDisplay($CheckBoxes,"$CheckBoxes") GatherBasic() For $c = 2 to $Sections[0] If $CheckBoxes[$c] And BitAND(GUICtrlRead($CheckBoxes[$c]), $GUI_CHECKED) = $GUI_CHECKED Then EndIf Next ExitLoop Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Func GatherBasic() ;Do something EndFunc Here's the INI: [Options] Basic=Basic.ini Network=Network.ini SAP=SAP.ini When you run it, it'll display the array of $checkboxes that'll show: [0] > 3 [1] > 4 [2] > 5 [3] > 6 Closing out the array will show: $CheckBoxes[$a] for Basic = 4 $CheckBoxes[$a] for Network = 5 $CheckBoxes[$a] for SAP = 6 Found Basic Basic's GUI ID = 4 L:\Utilities\GWPInfo\GWPInfo.au3 (52) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: GuiCtrlSetState($CheckBoxes[4],$GUI_CHECKED) GuiCtrlSetState(^ ERROR Now, again keep in mind that the original line it's error'ing out on looked like GuiCtrlSetState($CheckBoxes[$CheckBoxArray[$f][1]],$GUI_CHECKED). I changed it to GuiCtrlSetState($CheckBoxes[4],$GUI_CHECKED) just to see if my syntax was wrong (which it may still be). Did I setup the Checkboxes wrong?
-
AutoIT Macros - Running Multiple Macros in a loop
ttleser replied to ttleser's topic in AutoIt General Help and Support
Thanks Brewman, the execute command is exactly what I needed. I looked through the help file and even looking at the description for execute and it didn't look obvious to me that it was what I needed. Thanks much! -
All, I'm writing a script for my company that our helpdesk will have end-users run when they call with problems. The script will obtain some basic information from the system but will have checkboxes to allow it to check other things. For example, one checkbox may be for more network information, driver version, IP, subnet, etc.. Another checkbox will obtain the version of SAP on the system. This way if the issue the user called on was about SAP, the helpdesk would tell the user to put a checkmark in the SAP box. The program would gather the "basic" information, plus stuff about SAP. I'm looking for a way to be able to run multiple AutoIT macros in a for/next loop. The thought is to have a script read a INI file and run all the AutoIT macros specified and store the outputs in an array to be outputted later. This will allow me to store the INI on a network share and I can customize what data I want to obtain rather than hard coding it into the program and updating the program all the time. A sample INI would look like this: [Basic] ComputerName = @ComputerName Operating System = @OSVersion Service Pack = @OSServicePack IP Address 1 = @IPAddress1 IP Address 2 = @IPAddress2 [Network] Driver= The function is this: Func GatherBasic() $BasicArray = IniReadSection(@ScriptDir&"\GWPInfo.ini","Basic") ;_ArrayDisplay($BasicArray) ;msgbox(0,"test",$BasicArray[0][0]) ReDim $OutputArray[$BasicArray[0][0]+1][2] For $d = 1 to $BasicArray[0][0] ;msgbox(0,"test",$d) $OutputArray[$d][0] = $BasicArray[$d][0] $OutputArray[$d][1] = $BasicArray[$d][1] _ArrayDisplay($OutputArray) Next EndFunc This would simply store in the array: ComputerName | @Computername I know I could simply do this, but that defeats me being able to add more stuff on the fly: $OutputArray[1][0] = "ComputerName" $OutputArray[1][1] = @ComputerName (which would be "TEST COMPUTER"
-
In the sample script below, I want to be able to have the $Radio_SearchEntireDrive radio button always disabled. However, I want to setup the script so that once someone begins typing in the $ComputerName input that the EntireDrive radio button gets enabled. Of course I want it disabled if the user deleted anything in the $ComputerName input. The below script works, but only if I click off the $ComputerName field, which isn't what I'm looking. Anyone have any thoughts? #include <GUIConstants.au3> #include <WindowsConstants.au3> GUICreate("test",400,300) GuiCtrlCreateLabel("UserName",10,10,110,20) $UserName = GUICtrlCreateInput("",130,10,100,20) GuiCtrlCreateLabel("ComputerName",10,50,110,20) $ComputerName = GUICtrlCreateInput("",130,50,100,20) $Radio_SearchProfileOnly = GUICtrlCreateRadio("User Profile Only?",250,10,100,20) GUICtrlSetResizing(-1,$GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKSIZE) GuiCtrlSetState(-1,$GUI_CHECKED) $Radio_SearchEntireDrive = GUICtrlCreateRadio("Entire Drive?",250,50,100,20) GuiCtrlSetState(-1,$GUI_DISABLE) GUISetState(@SW_SHOW) While 1 Sleep(50) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $ComputerName GuiCtrlSetState($Radio_SearchEntireDrive,$GUI_ENABLE) EndSelect WEnd
-
Thanks GeoSoft. That works great.
-
Thanks guys, that definately gets me the time. How about getting the remaining text too, as in "mins remaining"?
-
Having trouble extracting the time from a string. Here's an example of the string at a certain point in the progress: I want to be able to extract the time from that line (11:31 in this case) and populate a GUI label with it as it's changing. I've been trying to figure out how to make a regular expression that works, but nothing is getting just the time itself. I'd like to be able to get the time if it's HH:MM:SS. Ideally I'd like to grab the "mins" or secs" text afterwards too. Can someone help me with the correct expression? Sample code so far: $fLine = "[ 73% ] Applying progress: 11:31 mins remaining" $fPercentage = StringRegExpReplace($fLine,"^.*\[\s*(\d+)%\s*\].*$","$1"); This gets the percentage just fine. $fTimeRemaining = StringRegExpReplace($fLine,"^.*\[\s*(\d+)%\s*\].*$","$1:$2"); This isn't getting me the time (which could be HH:MM:SS) msgbox(0,"Time Remaining",$fTimeRemaining)
-
Progress bar when applying WIM image file
ttleser replied to Catdaddy's topic in AutoIt General Help and Support
Björn Kaiser, I just tried your test script modifying it slightly for a different WIM file and a different destination directory and while the progress window does appear, neither the progress indicator moves nor does the any seconds appear other than zero. It does appears to apply the image to my destination directory, but after about 10-20 seconds I'll get a not-responding for the AutoIt script. I did find out my DLL is 6.1.7600.16385 Here's the script I was using: Opt("MustDeclareVars", 1) #include <wimgapi.au3> ;~ #include <DllCallback.au3> Dim $fhandle, $vhandle, $imageinfo, $i, $pProgress $pProgress = DllCallBackRegister ("_Progress", "int", "dword;lparam;wparam;ptr") ConsoleWriteError("DllCallBack error: " & @error & @CRLF & "_DllCallBack rc: " & $pProgress & @CRLF) $pProgress = DllCallbackGetPtr($pProgress) ProgressOn("Wimgapi.dll","Applying image ...") Apply("c:\PanasonicBootWim\boot.wim", "c:\test\") ;Apply("d:\distribution\Images\XP\GWPXP82.wim", "c:\test") ;~ ProgressOn("Wimgapi.dll","Capturing image ...") ;~ Capture("c:\temp\test.wim", "C:\temp\1\") DllCallBackFree($pProgress) ProgressOff() Func _Progress($1,$2,$3,$4) If $1 = 38008 Then ProgressSet($2,"Remaining time : " & Int($3 / 1000) & " seconds") EndIf ;~ If $1 = 38008 Then ConsoleWrite("_Progress: " & @CRLF & $1 & @CRLF & $2 & @CRLF & $3 & @CRLF & $4 & @CRLF) ;~ EndIf Return $wim_msg_success ;~ Return 0 EndFunc Func Apply($wim,$sPath) Local $rc_apply, $rc_close, $rc_shutdown, $lhandle, $rc_temppath $fhandle = _wim_createfile ($wim, $wim_generic_read) ;~ ConsoleWrite("_wim_createfile : " & $fhandle & @CRLF) $rc_temppath = _wim_settemporarypath($fhandle,@TempDir) ;~ ConsoleWrite("_wim_settemporarypath : " & $rc_temppath & @CRLF) $lhandle = _wim_loadimage ($fhandle,1) ;~ ConsoleWrite("_wim_loadimage : " & $lhandle & @CRLF) _wim_registermessagecallback($fhandle,$pProgress) $rc_apply = _wim_applyimage ($lhandle, $sPath) ;~ ConsoleWrite("_wim_applyimage : " & $rc_apply & @CRLF) _wim_unregistermessagecallback($fhandle,$pProgress) $rc_close = _wim_closehandle ($lhandle) ;~ ConsoleWrite("_wim_closehandle : " & $rc_close & @CRLF) $rc_close = _wim_closehandle ($fhandle) ;~ ConsoleWrite("_wim_closehandle : " & $rc_close & @CRLF) $rc_shutdown = _wim_shutdown () ;~ ConsoleWrite("_wim_shutdown : " & $rc_shutdown & @CRLF) EndFunc ;==>Apply Func Capture($wim,$sPath) $fhandle = _wim_createfile ($wim,$wim_generic_write,$wim_create_always,$wim_flag_verify,$wim_compress_xpress) ;~ $imageinfo = _wim_getimageinformation ($fhandle) ;~ ConsoleWrite("-- ImageInfo createFile" & @CRLF & UBound($imageinfo) & @CRLF) ;~ For $i = 0 To UBound($imageinfo) - 1 ;~ ConsoleWrite("$imageinfo[" & $i & "]: " & $imageinfo[$i] & @CRLF) ;~ Next ;~ _wim_setimageinformation ($fhandle, $imageinfo[3], $imageinfo[1]) _wim_registermessagecallback($fhandle,$pProgress) $vhandle = _wim_captureimage ($fhandle, $sPath) _wim_unregistermessagecallback($fhandle,$pProgress) ;~ $imageinfo = _wim_getimageinformation ($vhandle) ;~ ConsoleWrite("-- ImageInfo catureImage" & @CRLF & UBound($imageinfo) & @CRLF) ;~ For $i = 0 To UBound($imageinfo) - 1 ;~ ConsoleWrite("$imageinfo[" & $i & "]: " & $imageinfo[$i] & @CRLF) ;~ Next ;~ _wim_setimageinformation ($vhandle, $imageinfo[3], $imageinfo[1]) _wim_closehandle ($vhandle) _wim_closehandle ($fhandle) _wim_shutdown () EndFunc ;==>Capture Here's a snippit of the output I was getting in the console: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\ImageXProgressTest.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>11:56:10 Starting AutoIt3Wrapper v.2.0.1.24 Environment(Language:0409 Keyboard:00000409 OS:WIN_7/ CPU:X64 OS:X86) >Running AU3Check (1.54.19.0) from:C:\Program Files\AutoIt3 +>11:56:10 AU3Check ended.rc:0 >Running:(3.3.6.1):C:\Program Files\AutoIt3\autoit3.exe "E:\ImageXProgressTest.au3" _WIM_Startup rc: 1 DllCallBack error: 0 _DllCallBack rc: 1 _WIM_CreateFile rc: 7035896 UBound $create: 7 _WIM_SetTemporaryPath rc: 1 _WIM_LoadImage rc: 7039752 _WIM_RegisterMessageCallback rc: 0 _Progress: 38009 10518488 4908908 0x00000000 _Progress: 38009 7710040 4908804 0x00000000 _Progress: 38009 8883400 4908700 0x00000000 _Progress: 38009 10788600 4908596 0x00000000 _Progress: 38009 9747864 4908492 0x00000000 _Progress: 38009 8897008 4908700 0x00000000 _Progress: 38009 8892208 4908596 0x00000000 _Progress: 38009 8883512 4908492 0x00000000 _Progress: 38009 8892312 4908596 0x00000000 _Progress: 38009 8887544 4908492 0x00000000 _Progress: 38009 8883288 4908596 0x00000000 _Progress: 38009 8887664 4908492 0x00000000 _Progress: 38009 8870928 4908804 0x00000000 _Progress: 38009 10772328 4908908 0x00000000 _Progress: 38009 7520536 4908804 0x00000000 _Progress: 38009 8871016 4908700 0x00000000 _Progress: 38009 8897104 4908596 0x00000000 _Progress: 38009 8887424 4908492 0x00000000 I'm assuming by looking at your code that $2 is the actual percentage correct? Looking at the output, one of the 2nd set of numbers is 8897104 , a little high for a percentage Thoughts? -
Greeting all, Kip, this UDF looks pretty cool. I'm hoping to put it to good use. I've got a few questions if anyone would be willing to help me out here. Please keep in mind I'm new to programming, so the code may appear "spagetti like", I'll try to refine it later. I'm writing 2 scripts... Script "A" (Server script) will run on my file server and will: 1. Detect when a thumb drive is inserted in a USB port (on the server) then 2. Ping "key" systems and those that are successfully pinged, launch client script on those systems using PSEXEC then 3. Make sure one "specific" client has established a connection to the server, wait at most 10min for it to connect, and if after 10min it hasn't connected make sure least one other remote client has a connection to the server then 4. Send message to client(s) letting them know the thumb drive was inserted on date/time and that backup has begun then 5. Begin backing up data from a server hard drive to the thumb drive then 6. Store various backup events into a variable and export those on the fly to connected clients (or the entire "log of events" to newly connected clients) then 7. Finish backup, using Microsoft's devcon utility "disconnect" the thumb drive then 8. Send message to clients it's safe to remove the thumb drive. 9. Once thumb drive has been removed, send message to all clients telling them the thumb drive was removed, ok to close client program. Script "B" (Client(s) script) will run possible multiple clients. 1. Establish connection to server. 2. Send it's computername to server for it to evaluate if the connecting client is the "specific" client it really wants. 3. Receive event messages from the server I've gotten the thumb drive detection/backup portion working good, just need help on the following. I need the server and clients to talk back and forth to each other (clients to server, server to clients, not clients to clients). I basically want that "specific" client to send it's computername to the server, that way the server will know its connected so it can either proceed with the backup OR wait 10min and take whatever other clients are connected before proceeding with the backup. Basically I've got 1 person that is responsible for backups, but a few "key" others would like to make sure the server is backed up (receiving status updates from the server). If that 1 "specific" person is off on that day, one of those "key" others would be responsible for performing the backup, hence the message would need to be sent to them. I'd need help understanding how the _TCP_Server_ClientList() function works, can someone provide an example of it's usage? Here are the example scripts, that I've modified, in an attempt to understand how to make the client and server talk BACK AND FORTH. I've only setup the client script (unsuccessfully) to be able to send text back to the server via a GUI-Input and using a send button. I think the script isn't working because of the "Select - Case" function for detecting if the button was pushed. I played around with various ideas, none of which has made it work. Can someone tell me/correct what I'm doing wrong? Don't forget that I'd also like an example on the _TCP_Server_ClientList() function.. Thanks much!!!! Server Script #include "TCP.au3" #include "array.au3" $hGui = GUICreate("Client Messages",300,200,100,100) GUISetState(@SW_SHOW) $Edit = GuiCtrlCreateEdit("",5,5,290,190) $hClient = _TCP_Client_Create(@IPAddress2, 89); Create a client to allow the server to act as a client for receiving messages from actual clients, used a different port hoping that would allow it to work. $hServer = _TCP_Server_Create(88); A server. Tadaa! _TCP_RegisterEvent($hServer, $TCP_NEWCLIENT, "NewClient"); Whooooo! Now, this function (NewClient) get's called when a new client connects to the server. _TCP_RegisterEvent($hServer, $TCP_DISCONNECT, "Disconnect"); And this,... this will get called when a client disconnects. _TCP_RegisterEvent($hServer, $TCP_RECEIVE, "Received") $msg = GUIGetMsg() While 1 sleep(5) WEnd Func Received($hSocket, $sReceived, $iError); And we also registered this! Our homemade do-it-yourself function gets called when something is received. GUICtrlSetData($Edit, $sReceived) EndFunc Func NewClient($hSocket, $iError); Yo, check this out! It's a $iError parameter! (In case you didn't noticed: It's in every function) GUICtrlSetData($Edit,"New client connected."&@CRLF&"Sending Greeting to Client") _TCP_Send($hSocket, "Hello New Client"&@CRLF) _TCP_Send($hSocket, "This is the 2nd Message"&@CRLF) EndFunc Func Disconnect($hSocket, $iError); Damn, we lost a client. Time of death: @Hour & @Min & @Sec :P GUICtrlSetData($Edit,"Client disconnected.") EndFunc Client Script #include "TCP.au3" #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGui = GUICreate("Server Messages",300,225,100,305) GUISetState(@SW_SHOW) $Edit = GuiCtrlCreateEdit("",5,5,290,190) GuiCtrlCreateLabel("Message",5,202,50,20) $Message = GUICtrlCreateInput("",55,200,180,20) $SendButton = GUICtrlCreateButton("Send",240,200,50,20) $hClient = _TCP_Client_Create(@IPAddress1, 88); Create the client. Which will connect to the local ip address on port 88 $hServer = _TCP_Server_Create(89) _TCP_RegisterEvent($hClient, $TCP_RECEIVE, "Received"); Function "Received" will get called when something is received _TCP_RegisterEvent($hClient, $TCP_CONNECT, "Connected"); And func "Connected" will get called when the client is connected. _TCP_RegisterEvent($hClient, $TCP_DISCONNECT, "Disconnected"); And "Disconnected" will get called when the server disconnects us, or when the connection is lost. $msg = GUIGetMsg() ;Try to do a "select - case" to recognize if the button was pushed, read the data and send it to the server. Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $SendButton _TCP_RegisterEvent($hClient, $TCP_Send, "SendMessage") EndSelect While 1 Sleep(5); just to keep the program running WEnd Func SendMessage($hSocket, $iError); Yo, check this out! It's a $iError parameter! (In case you didn't noticed: It's in every function) _TCP_Send($hSocket, GuiCtrlRead($Message)&@CRLF) EndFunc Func Connected($hSocket, $iError); We registered this (you see?), When we're connected (or not) this function will be called. If not $iError Then; If there is no error... GUICtrlSetData($Edit, "Connected!") Else; ,else... GUICtrlSetData($Edit, "Could not connect. Are you sure the server is running?") EndIf EndFunc Func Received($hSocket, $sReceived, $iError); And we also registered this! Our homemade do-it-yourself function gets called when something is received. GUICtrlSetData($Edit, $sReceived) Func Disconnected($hSocket, $iError); Our disconnect function. Notice that all functions should have an $iError parameter. GUICtrlSetData($Edit, "Connection closed or lost.") EndFunc
-
Actually it doesn't. Doesn't it defeat the purpose of having a Autoit script that'll modify tags for them NOT to work in one of the players, like WMP? I was able to modify the tags using another program I've got but it'll only do one file at a time. I've got some audiobooks that I ripped from CD and wanted to change the tags around using a homemade script so that it was more organized, so the script would be able to handle a lot. Is it something wrong with the DLL?
-
Hey Xenobiologist, I've got a problem that after I modify even one tag, say Artist (though it'll happen with any others) that it won't play in Windows Media Player anymore. I get the following error: Windows Media Player 9 - The input media format is invalid. Windows Media Player 11 - Windows Media Player encountered a problem while playing the file. For additional assistance... blah blah blah I opened the original file before modification with the tags and it opened and played fine. I opened both files within WMP and did a properties on each file. The modified file appears to have dropped it's BIT RATE, where the unmodified file shows 192kbps. I'm wondering if this loss of what the bit rate is is causing the issue. I've tried the modified file in Winamp or a audio editor and it opens and plays fine. I've modified my original code to make a simplier one to make sure it wasn't my original code, but it still happens with the simple code. Here's my simple code: _DLLstartup() _setID3Tag("E:\Audio\Malloreon Bk 1 - Guardians of the West\A Prologue\test.mp3", 'LeadArtist', "test") _DLLshutdown() Func _setID3Tag($h_file, $detail, $value) Local $oId3 = ObjCreate("CDDBControl.CddbID3Tag") If Not IsObj($oId3) Then SetError(1) Return 0 EndIf ; False means open for read-write $oId3.LoadFromFile ($h_file, False) Switch $detail Case 'TitleAlbum' $oId3.Album = $value Case 'LeadArtist' $oId3.LeadArtist = $value Case 'Title' $oId3.Title = $value Case 'TrackPosition' $oId3.TrackPosition = $value Case 'Year' $oId3.Year = $value Case 'Genre' $oId3.Genre = $value Case 'Comments' $oId3.Comments = $value Case 'Label' $oId3.Label = $value Case 'FileID' $oId3.FileId = $value Case 'IRSC' $oId3.ISRC = $value Case 'CopyrightHolder' $oId3.CopyrightHolder = $value Case 'CopyrightYear' $oId3.CopyrightYear = $value Case 'PartOfSet' $oId3.PartOfSet = $value Case 'Movie' $oId3.Movie = $value Case 'BeatsPerMinute' $oId3.BeatsPerMinute = $value Case Else SetError(2) Return 0 EndSwitch $oId3.SaveToFile ($h_file) Return 1 EndFunc ;==>_setID3Tag Func _DLLstartup($DLLpath = '') If $DLLpath = Default Or $DLLpath = '' Then $DLLpath = @ScriptDir & '\cddbcontrol.dll' RunWait('regsvr32 /s ' & '"' & $DLLpath & '"') EndFunc ;==>_DLLstartup Func _DLLshutdown($DLLpath = '') If $DLLpath = Default Or $DLLpath = '' Then $DLLpath = @ScriptDir & '\cddbcontrol.dll' RunWait('regsvr32 /u /s ' & '"' & $DLLpath & '"') EndFunc ;==>_DLLshutdown Thoughts??
-
Is there a way to use the _setID3Tag function to clear a specific tag? I've tried > _setID3Tag($file,'TrackPosition'.'') but it still leaves the current value in. I'd prefer not to clear it by using a space character. Thanks