Leaderboard
Popular Content
Showing content with the highest reputation on 08/27/2015 in all areas
-
It's there... you just don't see the menu by default. Try pressing Alt+T...1 point
-
Try this code: #include <FileConstants.au3> #include <Array.au3> #include <File.au3> ;$rootdir = "F:\scans" $rootdir = "F:\Software" $simplist = _FileListToArray($rootdir, "*.jpg",$FLTA_FILES,True) For $i = 1 To $simplist[0] FileMove ($simplist[$i],$rootdir &"\image-" &$i &".jpg") Next $full = _FileListToArrayRec($rootdir,"*.jpg" ,$FLTAR_FILES , $FLTAR_RECUR,$FLTAR_NOSORT,$FLTAR_FULLPATH) For $i = 1 To $full[0] FileCopy ($full[$i],$rootdir &"\image-" &$i + $simplist[0] &".jpg") Next $folders = _FileListToArrayRec ($rootdir,"*", $FLTAR_FOLDERS , $FLTAR_RECUR ,$FLTAR_NOSORT ,$FLTAR_FULLPATH) For $i = 1 To $folders[0] If Not StringCompare($folders[$i],$rootdir) = 0 Then FileDelete($folders[$i]) Next If that doesnt suite your needs feel free to ask1 point
-
@TheDcoder It's good to see enthusiasm, but it would make a lot more sense to learn what AutoIt features already do before making requests in Trac. I think your suggestions are generally quite good though.1 point
-
Fine, come back if you still have questions.1 point
-
For the first question, using jchd's way, here is a way to store each end of sentence character in an array : ; Possible end of sentences Local $aEndChars[] = ['.', '!', '?', '...', '…', '"'] $text = 'Possible end of a "sentence."' & @CRLF & @CRLF & 'Possible end of a sentence…' & @CRLF & @CRLF & 'Possible end of a sentence' & @CRLF & @CRLF & 'Possible end of a sentence!' & @CRLF & @CRLF & 'Last sentence.' MsgBox(0,"original text", $text) $sExpr = "(?<!" For $i = 0 To UBound($aEndChars) - 1 $sExpr &= "\Q" & $aEndChars[$i] & "\E|" Next $sExpr = StringRegExpReplace($sExpr, "\|$", "") & ")" $fixed = StringRegExpReplace($text, $sExpr & '(\R{2})', '.$1') MsgBox(0,"processed text", $fixed)1 point
-
Guy, perhaps the first ConsoleWrite below will help you see what's needed to achieve the result. $text = "Http://site.com, Www.domain.org" $result = '"' & StringRegExpReplace($text, '(?i)(https?|www)', '" & StringLower("$1") & "') & '"' ConsoleWrite($result & @LF) $result = Execute($result) ConsoleWrite($result & @LF)1 point
-
SciTE 3.5.5.101 has been updated (build 1.3.3).1 point
-
Is that what you want? $text = 'Possible end of a "sentence."' & @CRLF & @CRLF & 'Possible end of a sentence…' & @CRLF & @CRLF & 'Possible end of a sentence' & @CRLF & @CRLF & 'Possible end of a sentence!' & @CRLF & @CRLF & 'Last sentence.' MsgBox(0,"original text", $text) $fixed = StringRegExpReplace($text, '(?<![.…!"])(\r\n\r\n)', '.$1') MsgBox(0,"processed text", $fixed)2/ AutoIt != Perl To change case of results, you need Execute: $text = "Http://site.com, Www.domain.org" $result = Execute('"' & StringRegExpReplace($text, '(?i)(https?|www)', '" & StringLower("$1") & "') & '"') ConsoleWrite($result & @LF)3/ I'm not aware of such dependancy. 4/ If Not @error is always fine. 5/ PCRE as compiled into AutoIt is UTF-aware (hopefully since AutoIt strings are UTF16!). What you may need (*UCP) in case you can expect to have to benefit of the wider range of \w, \d, \b, ...1 point
-
Im not good at regexp, but i like pretending. #include <Array.au3> $text = 'Possible end of a "sentence."' & @CRLF & @CRLF & 'Possible end of a sentence…' & @CRLF & @CRLF & 'Possible end of a sentence' & @CRLF & @CRLF & 'Possible end of a sentence!' & @CRLF & @CRLF & 'Last sentence.' MsgBox(0,"original text", $text) $_aFull_Stop_missing = StringRegExp($text, '([^\!\\"\s]\w\s{2,})', 3 ) If Not @error Then _ArrayDisplay($_aFull_Stop_missing) For $i = 0 To UBound($_aFull_Stop_missing)-1 $found = $_aFull_Stop_missing[$i] $fix = stringstripws($found , 8) & "." & @CRLF & @CRLF $text = StringReplace( $text, $found, $fix, 1) Next EndIf MsgBox(0,"processed text", $text) and for urls just stringlower the whole thing..1 point
-
1) I don't understant what is the expected result of the regex. What do you want to do ? Extract sentences ? Can you give use an example of result ? 2) $text = "Http://site.com, Www.domain.org" $result = Execute('"' & StringRegExpReplace(StringReplace($text, '"', '""'), "(?i)(https?|www)", '" & StringLower(''$1'') & "' ) & '"' ) ConsoleWrite($result)1 point
-
Audio DVD and DTS CD toolbox
argumentum reacted to TheSaint for a topic
Ok, for those who would like to play, here's an early release of JPG-toM2V. I still need to add direct access to many options on the incomplete Options window. I also still need to add support for adding images and keeping them proportional by embedding on a right size background image. At the moment, the program will convert to the largest PAL size if not already, or leave as is (not recommended if intending for DVD and the like). NOTE - Your image should look a bit squashed at the correct PAL size, as it gets stretched when seen (16:9) on your Widescreen TV or Monitor. Unfortunately, you cannot just use widescreen images as is, as MuxMan etc won't accept them. And I need to add NTSC as an option, as currently only PAL is coded for. Aside from all that, it works well. To remove an image, hold down your CTRL key while clicking that item, and a removal prompt will appear. There are some other CTRL features too, like select or deselect ALL items, etc. You can, if you want, put other Frequencies in, by manually editing the Settings.ini file. Just be sure to use a pipe '|' character between each and a space between number and secs. JPG-to-M2V v1.3.zip 449.23 kB (1,014 downloads) Requirements M2V Creation - MJPEG Tools ( http://sourceforge.net/projects/mjpeg ) M2V Joining - mpgtx ( http://prdownloads.sourceforge.net/mpgtx/mpgtx.zip?download ) M2V Recoding - ffmpeg ( http://ffmpeg.zeranoe.com/builds/ ) M2V Shrinking - Requant ( http://forum.doom9.org/showthread.php?p=383217#post383217 ) Post #14 ) File Information (time & size) - MediaInfo (CLI) ( http://mediaarea.net/EN/MediaInfo ) Additional Software (for muxing) Muxing Audio & Video to DVD folder (VOB) - Muxman 0.16.8 ( http://www.videohelp.com/tools/Muxman ) Muxing Audio & Video to MKV file - MKVMerge (MKVtoolnix) ( http://www.videohelp.com/software/MKVtoolnix ) Muxing Audio & Video to M2TS file - tsMuxer ( http://www.videohelp.com/software/tsMuxeR ) P.S. Please NOTE, that this is an unfinished update, so some things are not working and some information etc is wrong. It doesn't check for remaining drive space or if the Image location might be non-writable for resized images (CD or DVD), so it can fail without advising properly ... much of that should be down to the 3rd Party programs anyway. MediaInfo Test.au31 point -
Yes, but this is not really the place to ask. Send me a PM and we can discuss a little further. I make no guarantees I will do it and the money would be donated to AutoIt instead.1 point
-
msdn uncertainty.
JohnOne reacted to jvanegmond for a topic
About the example, it's: |--------long-------| |---int---|---int---|So the integers i1 and i2 will occupy the same space as long lg. You could try it in a small example. var test = new TestExplicit(); test.i1 = 5; Console.WriteLine(test.lg); test.i2 = 100; Console.WriteLine(test.lg); Console.ReadLine();This will print 5 429496729605For the bit fields, start with a short in C#. All you care about is the size of struct in bytes so you can begin with copying the data. Once you have the data then it helps to have it defined correctly so you can easily do things with it but it's not a technical requirement. Once you have it and turns out you need it, either change the struct or bitfuck the data, using bitwise ANDs and ORs. It's possible to write a C++ dll to change the structs before you copy them but I wouldn't bother because it doesn't exactly make everything a lot easier. Maybe if you have big C++ samples to copy/paste from and you are interested only in very limited functionality.1 point -
@UEZ it is awful assembly code (is not optimized). but if you insist (lol) look: push ebp mov ebp, esp mov esi, 0 mov ecx, [ebp + 08] mov edx, [ebp + 12] mov edi, [ebp + 16] Bucle : mov eax, 0 mov ebx, 0 mov al, byte[edi + esi] sub al, 48 cmp al, 0 je Incre cmp al, 0 jb Clear cmp al, 9 ja Clear jmp Mid Clear : mov eax, 1 Mid : mov ebx, 0 add eax, esi sub eax, 1 mov bl, byte[edx + eax] mov bh, byte[edx + esi] mov byte[edx + esi], bl mov byte[edx + eax], bh Incre : inc esi loop Bucle pop ebp ret 12 Saludos1 point
-
Help Make This Slow Function Faster
CrypticKiwi reacted to Danyfirex for a topic
I forgot that Autoit Memory access is slow. so I write this just for fun and for x86. I should take less that 1 second even old Pentium Machine as mine one. $Handle1 = FileOpen("ExampleFile01.txt", 0) $Example1 = FileRead($Handle1) $Handle2 = FileOpen("ExampleFile02.txt", 0) $Example2 = FileRead($Handle2) Local $hTimer = TimerInit() Local $Salida = _Scramble($Example1, $Example2) Local $fDiff = TimerDiff($hTimer) MsgBox(0, "Time Difference", $fDiff) FileWrite("Output.txt", $Salida) FileClose($Handle1) FileClose($Handle2) Func _Scramble($CycleData, $Data) Local $lenCycleData = StringLen($CycleData) Local $lenData = StringLen($CycleData) Local $tCycleData = DllStructCreate("byte Data[" & $lenCycleData & "]") Local $tData = DllStructCreate("byte Data[" & $lenData & "]") Local $pData = DllStructGetPtr($tData) Local $pCycleData = DllStructGetPtr($tCycleData) Local $sByteArray = "0x5589E5BE000000008B4D088B550C8B7D10B800000000BB000000008A04372C303C0074253C0072063C097702EB05B801000000BB0000000001F083E8018A1C028A3C32881C32883C0246E2C55DC20C00" Local $tByteArray = DllStructCreate("byte Data[" & BinaryLen($sByteArray) & "]") $tByteArray.Data = $sByteArray $tData.Data = $Data $tCycleData.Data = $CycleData DllCallAddress("none", DllStructGetPtr($tByteArray), "int", $lenCycleData - 10, "ptr", $pCycleData, "ptr", $pData) Return $tCycleData.Data EndFunc ;==>_Scramble Saludos1 point -
Yup, very unreliable... consider using the suggestions given above. HotKeySet("{F2}", "_activate") While 1 Sleep(1000) WEnd Func _activate() WinMove("[ACTIVE]", "", 0, 0, 900, 1367) EndFunc1 point
-
Laptop Guardian
ravkr reacted to orbital_station for a topic
First of all hi, I have been reading this forum for a while now and this is my first post. I am planing to make some kind of anti theft script for my new laptop. Well more like a tool to help retrieve a stolen one. My script will have these modules, some of them I already implemented: -keyloging -screenshot taking -integrated camera recording -mail sending -runs on startup, hidden My question is, what else am I missing? What would be usefull to have? I know there are already various software packages for all this stuff but I want to learn and do it myself. If I sound like a noob, that because I am My assumption is the person who takes it will not be a programmer or very knowledgeable of programming. Just your everyday thief who will probably try to sell it or use it and not wipe/format it. Thanks1 point -
Laptop Guardian
minxomat reacted to jvanegmond for a topic
I saw a thing where if you don't press a key while your system is booting, the bootloader goes into a honeypot OS basically. You can even have the other partition with your real OS be encrypted. Then do all the bad things like constantly capturing camera input in the honeypot OS. It would be good.1 point -
Learn To Program Using FREE Tools with AutoIt
autoautoauto reacted to TheDcoder for a file
1 point -
I would have helped you with my UDF if you had showed me what you tried. Honestly it's better to show than explain, because explanations aren't all that clear than code.1 point
-
Welcome to Autoit and the forum! Seems you've missed to read the forum rules on your way in. Please do so now and you will see that game automation of any kind is not permitted here. Hope to see you soon with a legitimate question ((c) Melba23).1 point
-
1 point
-
midvalley, I had a quick play with this over the weekend, and didn't make much progress. I'm thinking the profile is OK. You can set that profile generated by windows by doing this: _Wlan_SetProfile(FileRead("My Profile.xml"), $sReason)It didn't make any difference for me though. I've double checked the back end of the _Wlan_SetProfileUserData function and all looks OK there too. I'm starting to think there may be a bug in the API (wouldn't be the first). Googling the WLAN_SET_EAPHOST_DATA_ALL_USERS flag returns jack all - which is always helpful. That being said I couldn't get the creds in the HKLM hive even through the GUI - so it could be me. Perhaps I'll try another more up-to-date machine... Cheers, Matt1 point
-
Hey MattyD, Thanks for the clarification on the iFlags. I've had a chance for further testing today, so here's what I've found. Creating a profile using this code: #include "NativeWifi.au3" #RequireAdmin Local $oProfile, $oUserData, $sReason $fDebugWifi = True _Wlan_StartSession() $oProfile = _Wlan_CreateProfileObject() With $oProfile .Name = "SSID" .SSID.Add("SSID") .Type = "Infrastructure" .Auth = "WPA2" .Encr = "AES" .Options.NonBroadcast = True .Options.ConnMode = "Automatic" .OneX.Enabled = True .OneX.AuthMode = "User" .PMK.PreAuthEnabled = True .PMK.CacheEnabled = True .EAP.BaseType = "PEAP" .EAP.Type = "PEAP-MSCHAP" .EAP.PEAP.MSCHAP.UseWinLogonCreds = False .EAP.PEAP.ServerValidation.NoUserPrompt = True .EAP.PEAP.ServerValidation.Enabled = True .EAP.PEAP.ServerValidation.ThumbPrints.Add("possible cert 1 thumbprint (we have two ACS appliances)") .EAP.PEAP.ServerValidation.ThumbPrints.Add("possible cert 2 thumbprint (we have two ACS appliances)") .EAP.PEAP.FastReconnect = True EndWith ;ConsoleWrite(_Wlan_ConvertProfile($oProfile) & @CRLF) Displays the profile in XML format - This is what gets sent to the API _Wlan_SetProfile($oProfile, $sReason, 0) $oUserData = _Wlan_CreateUserDataObject() With $oUserData .BaseType = "PEAP" .Type = "PEAP-MSCHAP" .PEAP.MSCHAP.Username = "user" .PEAP.MSCHAP.Password = "password" EndWith ;ConsoleWrite(_Wlan_ConvertUserData($oUserData) & @CRLF) _Wlan_SetProfileUserData("ACS_WLAN", $oUserData, 1) Successfully creates a profile, that looks to be configured identical to the way I would do it in the GUI. It connects and works. Logging off the user that ran the script (compiled as an X86 exe with RequireAdministrator set for the execution level) and attempting to log into a domain account fails, no logon servers available (no network connection). Logging in as another local account gets prompts for the PEAP username and password, which when typed in, gets that profile to work. Logging off and back on as another local user produces the same prompts. Performing the same configuration manually and saving the same username and password in the PEAP user authentication area works for all accounts, and prelogon. I compared the profile XMLs that get created with winmerge, they were absolutely identical in terms of the way the settings look in the GUI but the way the settings are stored in the file appears a little different. Nativewifi script: <?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>ACS_WLAN</name> <SSIDConfig> <SSID> <hex>removed</hex> <name>removed</name> </SSID> <nonBroadcast>true</nonBroadcast> </SSIDConfig> <connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <MSM> <security> <authEncryption> <authentication>WPA2</authentication> <encryption>AES</encryption> <useOneX>true</useOneX> </authEncryption> <PMKCacheMode>enabled</PMKCacheMode> <preAuthMode>enabled</preAuthMode> <OneX xmlns="http://www.microsoft.com/networking/OneX/v1"> <authMode>user</authMode> <EAPConfig> <EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig" xmlns:eapCommon="http://www.microsoft.com/provisioning/EapCommon"> <EapMethod> <eapCommon:Type>25</eapCommon:Type> <eapCommon:AuthorId>0</eapCommon:AuthorId> </EapMethod> <Config xmlns:baseEap="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1" xmlns:msPeap="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1" xmlns:eapTls="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1" xmlns:msChapV2="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1" xmlns:msPeapV2="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2" xmlns:eapTlsV2="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2"> <baseEap:Eap> <baseEap:Type>25</baseEap:Type> <msPeap:EapType> <msPeap:ServerValidation> <msPeap:DisableUserPromptForServerValidation>true</msPeap:DisableUserPromptForServerValidation> <msPeap:TrustedRootCA> removed</msPeap:TrustedRootCA> <msPeap:TrustedRootCA> removed</msPeap:TrustedRootCA> </msPeap:ServerValidation> <msPeap:FastReconnect>true</msPeap:FastReconnect> <msPeap:InnerEapOptional>false</msPeap:InnerEapOptional> <baseEap:Eap> <baseEap:Type>26</baseEap:Type> <msChapV2:EapType> <msChapV2:UseWinLogonCredentials>false</msChapV2:UseWinLogonCredentials> </msChapV2:EapType> </baseEap:Eap> <msPeap:PeapExtensions> <msPeapV2:PerformServerValidation>true</msPeapV2:PerformServerValidation> </msPeap:PeapExtensions> </msPeap:EapType> </baseEap:Eap> </Config> </EapHostConfig> </EAPConfig> </OneX> </security> </MSM> </WLANProfile> Manual Profile: <?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>ACS_WLAN</name> <SSIDConfig> <SSID> <hex>removed</hex> <name>removed</name> </SSID> <nonBroadcast>true</nonBroadcast> </SSIDConfig> <connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <autoSwitch>false</autoSwitch> <MSM> <security> <authEncryption> <authentication>WPA2</authentication> <encryption>AES</encryption> <useOneX>true</useOneX> <FIPSMode xmlns="http://www.microsoft.com/networking/WLAN/profile/v2">false</FIPSMode> </authEncryption> <PMKCacheMode>enabled</PMKCacheMode> <PMKCacheTTL>720</PMKCacheTTL> <PMKCacheSize>128</PMKCacheSize> <preAuthMode>enabled</preAuthMode> <preAuthThrottle>3</preAuthThrottle> <OneX xmlns="http://www.microsoft.com/networking/OneX/v1"> <cacheUserData>true</cacheUserData> <authMode>user</authMode> <EAPConfig><EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"><EapMethod><Type xmlns="http://www.microsoft.com/provisioning/EapCommon">25</Type><VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId><VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType><AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId></EapMethod><Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"><Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"><Type>25</Type><EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1"><ServerValidation><DisableUserPromptForServerValidation>true</DisableUserPromptForServerValidation><ServerNames></ServerNames><TrustedRootCA>Removed</TrustedRootCA></ServerValidation><FastReconnect>true</FastReconnect><InnerEapOptional>false</InnerEapOptional><Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"><Type>26</Type><EapType xmlns="http://www.microsoft.com/provisioning/MsChapV2ConnectionPropertiesV1"><UseWinLogonCredentials>false</UseWinLogonCredentials></EapType></Eap><EnableQuarantineChecks>false</EnableQuarantineChecks><RequireCryptoBinding>false</RequireCryptoBinding><PeapExtensions><PerformServerValidation xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">true</PerformServerValidation><AcceptServerName xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">false</AcceptServerName></PeapExtensions></EapType></Eap></Config></EapHostConfig></EAPConfig> </OneX> </security> </MSM> </WLANProfile> Please note that I left some options, such as a couple under .PMK out because the script profile seemed to default to what I wanted when the options were turned on. I went for the path of least-resistance in terms of specifying options. I'm 99% sure that the setuserprofiledata command works perfectly when the profile itself is created manually, I'm second guessing myself but I can half remember testing these scenarios. I guess that indicates an issue with the profile generation? On the other side, the profile works for all users once the PEAP username and password are entered manually, so that indicates that the profile works and the issue is where the userdata is being stored (per-user)?. Just to test I recompiled the EXE as x64, there was no change in the behavior. I don't know if you needed all that, but I wanted to make sure you have all the information I had in case it is necessary. I'm kinda stumped as to what I can try on my side, so if you need anything else from me, please let me know. Thanks for all your work on NativeWifi, and the help you've been giving to everyone that asked you a question regarding it. Regards.1 point
-
Hey MattyD, This worked perfectly in our image. Thank you very much. I actually just clipped it down to: #include "NativeWifi.au3" Local $oUserData $fDebugWifi = True _Wlan_StartSession() $oUserData = _Wlan_CreateUserDataObject() With $oUserData .BaseType = "PEAP" .Type = "PEAP-MSCHAP" .PEAP.MSCHAP.Domain = "Domain" ;Leave this line out if you don't wish to specify a domain .PEAP.MSCHAP.Username = "Username" .PEAP.MSCHAP.Password = "Password" EndWith ;ConsoleWrite(_Wlan_ConvertUserData($oUserData) & @CRLF) _Wlan_SetProfileUserData("Profile Name", $oUserData) Since we had the wireless profile defined in the image itself.1 point
-
Hey im working on a script as the last thing we run at work to check loads of stuff have been done activation / updates etc etc One of the things is to remove our tech wirless profile so it stops people coming near the shop and logging in etc Now the vista and above part is fine RunWait(@ComSpec & " /c " & 'netsh wlan delete profile name="profile to remove"',@SW_SHOW) but i cant use netsh in Windows XP So im looking at devcon to do that most of the stuff ive found deals with enable or disable wireless card, which i dont want to do All i want to do is remove the profile so it cant start does remove switch in devcon cover that event? e.g. below devcon remove "profile to remove" Or does it not work like that?1 point
-
hey mate, you will probably have to edit the UDF as in post #54. Then does this help? #include <wifi33a.au3> _Wlan_StartSession() Local $Profile[3][6] $Profile[0][0] = "MSCHAP" $Profile[0][3] = "WPA2" $Profile[0][4] = "AES" $Profile[0][5] = "802.1x Enabled" $Profile[1][0] = "PEAP" $Profile[1][1] = "Fast Reconnect" $Profile[1][2] = "No Quarantine Checks" $Profile[1][3] = "Don't Require Cryptobinding" $Profile[2][0] = "MSCHAP" $Profile[2][1] = "Don't Use Win Logon" Local $UserData[4] $UserData[0] = "PEAP-MSCHAP" $UserData[1] = "MyDomain" $UserData[2] = "User" $UserData[3] = "Password123" _Wlan_SetProfile($Profile) ConsoleWrite(@error & @CRLF) _Wlan_SetProfileUserData($Profile[0][0], $UserData) ConsoleWrite(@error & @CRLF) Matt1 point
-
Native Wifi Functions
Doppio reacted to readmedottxt for a topic
Thats what it was. I hate it when the obvious eludes me, I compared that line to MSDN and missed the error ...almost Local $asUserData should read Local $asUserData[4] and it works perfectly! I have one more problem - my environment has lots of non domain workstations that need wireless access at logon. In Win7, after the profile is created, this can be done by > Wireless Profile Properties > Security > Advanced Settings > Specify authentication mode: User Authentication > Save Credentials Windows will now establish wireless connectivity at the logon screen at startup, not just after logging off. The "Single Sign On" option doesn't work due to it being a non domain machine. How do I programmatically save these credentials? I've played with "netsh wlan set properties" and they only allow setting the authentication mode. netsh wlan set profileparameter name=uDev80211 authMode=userOnly I also can't find anything at this page: http://msdn.microsoft.com/en-us/library/ms706274%28v=VS.85%29.aspx How does Windows do it? Cheers1 point -
Hey Mate, The Vista/7 API will return an encrypted key unless the WLAN_PROFILE_GET_PLAINTEXT_KEY flag is present. Im guessing you'll have to do the equivalent with netsh to get that profile to work. The "network key" profile has just the hex representation of the password. I'm assuming you are using version 3.3 of the UDF? This crude example imports a WPA2-PSK AES XML profile: ;This example is for XP! #include "Wifi33b.au3" $Return = _Wlan_StartSession() If @error Then ConsoleWrite("!Err[" & @error & "] Ext[" & @extended & "] - " & $Return) Local $Profile[9] ;Just used to generate a valid profile $Profile[0] = "Test WPA2" $Profile[3] = "WPA2-PSK" $Profile[4] = "AES" $Profile[7] = "TestPassword" $ProfileXML = _Wlan_GenerateXMLProfile($Profile) ConsoleWrite("-The profile to import:" & @CRLF & $ProfileXML & @CRLF) $Return = _Wlan_SetProfileXML(-1, -1, $ProfileXML) If @error Then ConsoleWrite("!Err[" & @error & "] Ext[" & @extended & "] - " & $Return) $ProfileXML = _Wlan_GetProfileXML(-1, -1, $Profile[0]) If @error Then ConsoleWrite("!Err[" & @error & "] Ext[" & @extended & "] - " & $ProfileXML) ConsoleWrite("-The exported profile:" & @CRLF & $ProfileXML & @CRLF) $Return = _Wlan_DeleteProfile(-1, -1, $Profile[0]) If @error Then ConsoleWrite("!Err[" & @error & "] Ext[" & @extended & "] - " & $Return) _Wlan_EndSession(-1) You should also be using _Wlan_CloseHandle() instead of calling _Wlan_EndSession in that context as EndSession will close the Dll handle causing any following functions to fail. A more efficient way of doing things would be to call _Wlan_StartSession once at the start of your script and call _Wlan_EndSession at the end. (or better still from a registered exit function - if you plan to use the functions with "wait" in them!) Cheers, Matt1 point
-
Native Wifi Functions
Doppio reacted to BlackHoleSun for a topic
I tried incorporating this into a program for XP that backs up the profiles and restores them. It looks like it can back the profiles up, but I noticed it's not the same when it comes to the password as it is in my Win7 exports (using netsh). Also when I import I use the ConsoleWrite and it says it's an invalid schema. This goes for the original XP profiles as well as the Win7 profiles. In the XML outputs, Win7 has a longer password than XP and Win7 also shows it as a "passPhrase" whereas XP has it as "networkKey". Below are the 2 functions relating to backing up and restoring. Maybe I'm doing something wrong. ;~ ============================================================= Func BackupProfiles($osVersion, $user) If ($osVersion = "Win_7") Then ;Win7 code goes here If DirGetSize($user) < 0 Then DirCreate($user) EndIf RunWait("netsh wlan export profile folder=" & $user) Return -1 ElseIf ($osVersion = "Win_XP") Then ;XP code goes here If DirGetSize($user) < 0 Then DirCreate($user) EndIf _Wlan_StartSession() Local $sProfile Local $asProfileList = _Wlan_GetProfileList(-1, -1) For $i = 0 To UBound($asProfileList) - 1 $sProfile = _Wlan_GetProfileXML(-1, -1, $asProfileList[$i]) FileWrite($user & "\Wireless Network Connection-" & $asProfileList[$i] & ".xml", $sProfile) Next _Wlan_EndSession(-1) Return -1 EndIf EndFunc ;==>RestoreProfiles ;~ ============================================================= Func RestoreProfiles($osVersion) If ($osVersion = "Win_7") Then ;Win7 code goes here Local $search, $file, $netsh $search = FileFindFirstFile($userName & "\*.xml") For $i = 1 to 200 $file = FileFindNextFile($search) If @error Then ExitLoop $netsh = 'netsh wlan add profile filename="' & $userName & '\' & $file & '"' RunWait($netsh) Next FileClose($search) Return -1 ElseIf ($osVersion = "Win_XP") Then ;XP code goes here _Wlan_StartSession() Local $sProfile, $asProfileList, $nextFile Local $firstProfile = FileFindFirstFile($userName & "\*.xml") FileOpen($firstProfile) For $i = 0 To $firstProfile + 1 $nextFile = FileFindNextFile($firstProfile) FileOpen($nextFile) $sProfile = _Wlan_SetProfileXML(-1, -1, $nextFile) FileClose($nextFile) ConsoleWrite($sProfile & @CRLF) Next FileClose($firstProfile) _Wlan_EndSession(-1) Return 0 EndIf EndFunc ;==>RestoreProfiles This is the Win7 XML: <?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>SSIDNAME</name> <SSIDConfig> <SSID> <hex>SSIDHEX</hex> <name>SSIDNAME</name> </SSID> <nonBroadcast>false</nonBroadcast> </SSIDConfig> <connectionType>ESS</connectionType> <connectionMode>auto</connectionMode> <MSM> <security> <authEncryption> <authentication>WPA2PSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>passPhrase</keyType> <protected>true</protected> <keyMaterial>LongPasswordCodeHere</keyMaterial> </sharedKey> </security> </MSM> </WLANProfile> This is the XP XML: <?xml version="1.0"?> <WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"> <name>SSIDNAME</name> <SSIDConfig> <SSID> <hex>SSIDHEX</hex> <name>SSIDNAME</name> </SSID> </SSIDConfig> <connectionType>ESS</connectionType> <MSM> <security> <authEncryption> <authentication>WPA2PSK</authentication> <encryption>AES</encryption> <useOneX>false</useOneX> </authEncryption> <sharedKey> <keyType>networkKey</keyType> <protected>false</protected> <keyMaterial>ShortPasswordCodeHere</keyMaterial> </sharedKey> </security> </MSM> </WLANProfile>1 point -
_FTP_DirDelete not deleting DIR's with spaces
OhBobSaget reacted to koresho for a topic
Hello everyone, I've searched the forums and google and couldn't find anything on this issue other than to enclose the file path in quotes. MSDN makes no mention of spaces being an issue... That said, when I try to delete an FTP folder with spaces in it, the folder will not delete. Here is the relevant part of the script (I'm recursively deleting a folder). Func _FTPRemovedir($l_FTPSession, $sFTPDirectory) $rmdirgui = GUICreate("Deleting folder: " & $sFTPDirectory, 300, 200, -1, -1, -1, $WS_DLGFRAME) $rmdirtext = GUICtrlCreateInput("", 10, 10, 280, 180, $ES_MULTILINE + $ES_READONLY) GUISetState() Local $aFile, $hSearch, $sWorkingdir, $sFolderlist, $i, $bFirst, $aFolderStack[2] = [1, $sFTPDirectory] While $aFolderStack[0] > 0 $sWorkingdir = $aFolderStack[$aFolderStack[0]] $aFolderStack[0] -= 1 $aFile = _FTP_FindFileFirst($l_FTPSession, $sWorkingdir & '/*', $hSearch, $INTERNET_FLAG_NO_CACHE_WRITE) If Not @error Then $bFirst = True While 1 If $bFirst = False Then $aFile = _FTP_FindFileNext($hSearch) If @error Then ExitLoop EndIf If $aFile[1] = 16 Then; If file is a directory we are going to add it to the stack of folders we need to go through If $aFile[10] <> ".." And $aFile[10] <> "." Then ;~ If StringInStr($aFile[10], " ") Then $aFile[10] = StringReplace($aFile[10], " ", "_") $aFolderStack[0] += 1 If UBound($aFolderStack) <= $aFolderStack[0] Then ReDim $aFolderStack[UBound($aFolderStack) * 2] $aFolderStack[$aFolderStack[0]] = $sWorkingdir & "/" & $aFile[10] $sFolderlist &= $sWorkingdir & "/" & $aFile[10] & ';'; Here I am adding the folder to a list of directorys I need to delete later EndIf Else; else we delete it If StringInStr($aFile[10], "/./") = 0 And StringInStr($aFile[10], "/../") = 0 Then _FTP_FileDelete($l_FTPSession, $sWorkingdir & "/" & $aFile[10]) GUICtrlSetData($rmdirtext, @CRLF & 'File: ' & $sWorkingdir & "/" & $aFile[10] & ' Deleted', "add") Else GUICtrlSetData($rmdirtext, @CRLF & 'File: ' & $sWorkingdir & "/" & $aFile[10] & ' Skipped (In higher DIR)', "add") EndIf EndIf $bFirst = False WEnd EndIf _FTP_FindFileClose($hSearch) WEnd $aFolderStack = StringSplit(StringTrimRight($sFolderlist, 1), ';') For $i = $aFolderStack[0] To 1 Step -1 ;Here we delete all those empty folders from last to first _FTP_DirDelete($l_FTPSession, $aFolderStack[$i]) ;<--- This is the problem area. ;~ _FTP_Command($l_FTPSession, 'rmdir ' & $aFolderStack[$i]) GUICtrlSetData($rmdirtext, @CRLF & 'Directory: ' & $aFolderStack[$i] & ' Deleted', "add") Next _FTP_DirDelete($l_FTPSession, $sFTPDirectory);Delete the original directory GUIDelete($rmdirgui) EndFunc ;==>_FTPRemovedir1 point -
Hello, MattyD, Thank you for your work ! Thanks to you my Open Source project FreeWifi Manager can run on Windows Vista and Seven. Your new version is more efficient and better documented, cheers ! ------------------------------------ Bonjour, MattyD, Merci pour votre travail ! Grace à vous mon projet Open Source FreeWifi Manager peut fonctionner sous Windows Vista et Seven. Votre nouvelle version est encore plus performante et mieux documentée, bravos !1 point