topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday June 24, 2025, 7:01 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Recent Posts

Pages: prev1 ... 170 171 172 173 174 [175] 176 177 178 179 180 ... 225next
4351
General Software Discussion / Re: Why is my computer hiccuping every few seconds?
« Last post by 4wd on February 09, 2011, 10:02 AM »
Does the same thing as CCleaner, if you have CCleaner just turn it on (as mentioned here):

2011-02-10_02-59-49.jpg

Also, a couple of others I mentioned in the following post here.

EDIT: Dang it! f0dder snuck in between edits again.
4352
General Software Discussion / Re: Why is my computer hiccuping every few seconds?
« Last post by 4wd on February 08, 2011, 11:34 PM »
Just for interests sake, what version of Firefox are you using?

I'm running the nightly build of v4 and I can't say I've ever noticed anything like that.
4353
Living Room / Re: NoteSlate - mono color tablet, nice price
« Last post by 4wd on February 08, 2011, 11:25 PM »
If this product doesn't turn out to be vaporware, I'll pre-order at first opportunity.

Heck, wait until nudone buys it, ('cause he buys all new gadgets, even if they don't work), and then read his review.


 :P
4354
General Software Discussion / Re: Why is my computer hiccuping every few seconds?
« Last post by 4wd on February 08, 2011, 08:57 PM »
Well, my interpretation is:

Task Manager: Simple overall view of the current system/program status allowing you to do simple things, eg. kill/start a task.

Resource Monitor: More indepth view of what processes are doing on the system, eg. processes are broken down into CPU usage, threads, Disk usage, Memory usage, etc while still allowing you to do things such as kill them.

Process Explorer: Kind of a love child between the two above :) but doesn't include things like Disk usage/calls.

Interesting...I didn't think I had Windows Defender installed, but it is.  Furthermore, it is disabled, yet the process MsMpEng.exe is on with 34 threads going.  I looked it up and that exe is attributed to Windows Defender.  I checked again, and yes, it is disabled, so I don't get it.  i do have Microsoft Security Essentials, but that shouldn't include Defender, does it?

Once you install MSE, Defender kind of gets seconded into it and as such ceases to exist as a separate entity.  FWIW, here it has anywhere around 35 threads but 0 CPU.  If you open up MSE and turn off Real Time Protection you'll see the number of threads against MsMpEng.exe drop by about 10.
4355
General Software Discussion / Re: Why is my computer hiccuping every few seconds?
« Last post by 4wd on February 08, 2011, 08:29 PM »
You could try running the Resource Monitor, (perfmon.exe /res), and see if there is any annomalies in Disk Response time, which might give you a process and/or file to look at.

2011-02-09_13-28-38.jpg

Also ensure you're running the latest motherboard drivers and check to see if there is a later motherboard BIOS.
4356
Post New Requests Here / Re: IDEA: Movie Mode
« Last post by 4wd on February 08, 2011, 07:55 PM »
Thanks April, source added to post above.
4357
Post New Requests Here / Re: IDEA: Movie Mode
« Last post by 4wd on February 08, 2011, 05:04 PM »
The relaunching has an issue: nothing with command line parameters is being relaunched.

Could you post or PM the ini file, (blank anything you don't want seen) ?

Ah, I think my handling of quotes was a little skewiff.

Try this one, it seems to work OK with the specific example you gave above - might need to rework it for more complicated quoting.

Have also removed the option to leave open the output CLI, (just to make the parameters in the ini file a little simpler), but if anyone wants it back, say something.

Code: AutoIt [Select]
  1. ; Filename: Movie-ize.au3
  2. #NoTrayIcon
  3. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  4. #AutoIt3Wrapper_icon=popcorn-32x32.ico
  5. #AutoIt3Wrapper_UseUpx=n
  6. #AutoIt3Wrapper_UseX64=n
  7. #AutoIt3Wrapper_Res_Icon_Add=popcorn-32x32.ico
  8. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  9.  
  10. #include <_SysTray.au3>
  11. #include <Process.au3>
  12. #include '_OsVersionInfo.au3'
  13.  
  14. Global $inifile = 'Movie-ize.ini', $tempini = 'Movie-tmp.ini', $_state = False, $_term = False
  15.  
  16. ;--- Start Tray menu stuff
  17. Opt("TrayMenuMode", 1)
  18. Opt("TrayOnEventMode", 1)
  19.  
  20. $movieon = TrayCreateItem('Movie-ize',-1,-1,1)
  21. TrayItemSetOnEvent(-1, '_movieOn')
  22. $movieoff = TrayCreateItem('De-Movie-ize',-1,-1,1)
  23. TrayItemSetOnEvent(-1, '_movieOff')
  24. $prefs = TrayCreateItem('Preferences',-1,-1,0)
  25. TrayItemSetOnEvent(-1, '_prefs')
  26. $about = TrayCreateItem('About',-1,-1,0)
  27. TrayItemSetOnEvent(-1, '_about')
  28. $exit = TrayCreateItem('Exit',-1,-1,0)
  29. TrayItemSetOnEvent(-1,'_Exit')
  30. TraySetIcon('Movie-ize.exe', 4)
  31. TraySetToolTip("Get out the popcorn 'cause it's movie time!")
  32. TrayItemSetState($movieoff, 129)
  33. TrayItemSetState($movieon, 64)
  34. ;--- End Tray menu stuff
  35.  
  36. If Not FileExists($inifile) Then
  37.         _CreateBaseIni()
  38. $kill = IniReadSection($inifile, 'Programs')
  39. $kparam = IniReadSection($inifile, 'Parameters')
  40.  
  41. If $CmdLine[0] > 0 Then $_term = True
  42. If $_term Then
  43.         _RunAndExit()  ;--- If there's a CLI argument then Run and Exit
  44.         _Initialise()  ;--- Otherwise, check for Movie-tmp.ini and initialise to movieOn state
  45.  
  46.         Sleep(1000)    ;--- Twiddle thumbs
  47.  
  48.  
  49. Func _Initialise()
  50.         If FileExists($tempini) Then
  51.                 $xterm = IniReadSection($tempini, 'Start')
  52.                 For $i = 1 To $kill[0][0]
  53.                         $kill[$i][0] = $xterm[$i][1]
  54.                 Next
  55.                 $_state = True
  56.                 TrayItemSetState($movieon, 129)
  57.                 TrayItemSetState($movieoff, 68)
  58.                 TrayItemSetState($prefs, 128)
  59.                 TraySetToolTip('System Movie-ized')
  60.         EndIf
  61.  
  62. Func _Exit()  ;--- If not Run And Exit, checks to see if in MovieOn mode and asks user if they really want to exit
  63.         If Not $_term Then
  64.                 TrayItemSetState($exit, 4)
  65.                 If $_state And (MsgBox(49, 'Movie-ize', 'System currently Movie-ized!' & @CRLF & 'Do you want to quit in this state?') = 2) Then Return
  66.         EndIf
  67.         Exit
  68.  
  69. Func _about()
  70.         TrayItemSetState($about, 4)
  71.         MsgBox(64, 'Movie-ize', 'Movie-ize v0.22')
  72.  
  73. Func _prefs()  ;--- Load the ini into users default editor and wait for exit, then re-read ini
  74.         TrayItemSetState($prefs, 4)
  75.         If Not $_state Then  ;--- If in MovieOn mode then killed program state will be lost if user edits ini....so don't! >:^(
  76.                 ShellExecuteWait($inifile)
  77.                 Sleep(1000)
  78.                 $kill = IniReadSection($inifile, 'Programs')
  79.                 $kparam = IniReadSection($inifile, 'Parameters')
  80.         Else
  81.                 MsgBox(48, 'Movie-ize', 'System currently Movie-ized,' & @CRLF & 'Preferences will be unavailable.')
  82.         EndIf
  83.  
  84. Func _movieOn()  ;--- Cycles thru program array, if there's a process match it kills it and sets corresponding element to 1
  85.         Local $i, $guineapig
  86.         If Not $_term Then
  87.                 TrayItemSetState($movieon, 129)
  88.                 TrayItemSetState($movieoff, 64)
  89.                 TrayItemSetState($prefs, 128)
  90.         EndIf
  91.         $_state = True
  92.         For $i = 1 To $kill[0][0]
  93.                 If $kill[$i][1] <> '' Then
  94.                         $guineapig = StringMid($kill[$i][1], StringInStr($kill[$i][1], '\', 0, -1) + 1)
  95.                         If ProcessExists($guineapig) Then
  96.                                 ProcessClose($guineapig)
  97.                                 $kill[$i][0] = 1
  98.                         Else
  99.                                 $kill[$i][0] = 0
  100.                         EndIf
  101.                 EndIf
  102.         Next
  103.         _RefreshSystemTray()
  104.         If Not $_term Then TraySetToolTip('System Movie-ized')
  105.  
  106. Func _movieOff()  ;--- Cycles thru program array looking for 1 element, if found tries to restart the associated program
  107.         Local $i, $exec, $wdir, $execcmd
  108.         If Not $_term Then
  109.                 TrayItemSetState($movieon, 64)
  110.                 TrayItemSetState($movieoff, 129)
  111.                 TrayItemSetState($prefs, 64)
  112.         EndIf
  113.         $_state = False
  114.         For $i = 1 To $kill[0][0]
  115.                 If $kill[$i][0] = 1 Then
  116.                         If StringLeft($kill[$i][1], 1) = '>' Then
  117.                                 $exec = StringMid($kill[$i][1], 2)
  118.                                 $wdir = StringMid($kill[$i][1], 2, StringInStr($kill[$i][1], '\', 0, -1) - 2)
  119.                                 $execcmd = '"' & $exec & '" ' & $kparam[$i][1]
  120.                                 Run(@ComSpec & ' /c "' & $execcmd & '"', $wdir, @SW_HIDE)
  121.                         Else
  122.                                 Run($kill[$i][1])
  123.                         EndIf
  124.                         Sleep(500)
  125.                 EndIf
  126.         Next
  127.         If Not $_term Then
  128.                 TraySetToolTip("Get out the popcorn 'cause it's movie time!")
  129.                 FileDelete($tempini)
  130.         EndIf
  131.  
  132. Func _CreateBaseIni()  ;--- Creates a basic ini file first time it's run
  133.         Local $i
  134.         IniWrite($inifile, 'Programs', 'Program1', 'C:\Program Files\Skype\skype.exe')
  135.         IniWrite($inifile, 'Programs', 'Program2', '>C:\Program Files\xchat\xchat.exe')
  136.         IniWrite($inifile, 'Parameters', 'Param1', '')
  137.         IniWrite($inifile, 'Parameters', 'Param2', '-d "E:\Programs Installed\xchat-pu70\settings"')
  138.  
  139. Func _TempIni()  ;--- For Run And Exit, writes a temporary ini file with initial program states, (QaD)
  140.         Local $i
  141.         For $i = 1 To $kill[0][0]
  142.                 IniWrite($tempini, 'Start', 'Start' & $i, $kill[$i][0])
  143.                 IniWrite($tempini, 'Programs', 'Program' & $i, $kill[$i][1])
  144.                 IniWrite($tempini, 'Parameters', 'Param' & $i, $kparam[$i][1])
  145.         Next
  146.  
  147. Func _RunAndExit()  ;--- If the temporary ini exists, assumes already run once and refills array with correct values before calling _movieOff
  148.         Local $i        ;--- otherwise call _movieOn then _TempIni to write list of killed programs
  149.         If FileExists($tempini) Then
  150.                 $xterm = IniReadSection($tempini, 'Start')
  151.                 $kill = IniReadSection($inifile, 'Programs')
  152.                 $kparam = IniReadSection($inifile, 'Parameters')
  153.                 For $i = 1 To $xterm[0][0]
  154.                         $kill[$i][0] = $xterm[$i][1]
  155.                 Next
  156.                 _movieOff()
  157.                 FileDelete($tempini)
  158.         Else
  159.                 _movieOn()
  160.                 _TempIni()
  161.         EndIf
  162.         _Exit()
  163.  
  164. Func _RefreshSystemTray()  ;--- The magic that clears the SysTray of dead icons courtesy of a UDF by Tuape & Erik Pilsits
  165.         $count = _SysTrayIconCount()
  166.         For $i = $count - 1 To 0 Step -1
  167.                 $handle = _SysTrayIconHandle($i)
  168.                 $visible = _SysTrayIconVisible($i)
  169.                 $pid = WinGetProcess($handle)
  170.                 $name = _ProcessGetName($pid)
  171.                 $title = WinGetTitle($handle)
  172.                 $tooltip = _SysTrayIconTooltip($i)
  173.                 If $pid = -1 Then _SysTrayIconRemove($i)
  174.         Next
  175.  
  176.         If _OsVersionTest($VER_GREATER_EQUAL, 6, 1) Then
  177.                 $countwin7 = _SysTrayIconCount(2)
  178.                 For $i = $countwin7 - 1 To 0 Step -1
  179.                         $handle = _SysTrayIconHandle($i, 2)
  180.                         $visible = _SysTrayIconVisible($i, 2)
  181.                         $pid = WinGetProcess($handle)
  182.                         $name = _ProcessGetName($pid)
  183.                         $title = WinGetTitle($handle)
  184.                         $tooltip = _SysTrayIconTooltip($i, 2)
  185.                         If $pid = -1 Then _SysTrayIconRemove($i, 2)
  186.                 Next
  187.         EndIf

UPDATE: v0.22 - Cleaned up some stupid typos, removed some stuff that I forgot.
                        - Now sets the tray menu items to disabled/enabled so you don't call things twice, (why didn't I think of that before?).
                        - Added ability to run and exit, just call it with a command line argument (writes a temp ini when it kills programs, deletes it after relaunching them).
                        - Added some comments to source, ('cause mouser told me I should).
4358
Post New Requests Here / Re: IDEA: Movie Mode
« Last post by 4wd on February 08, 2011, 01:24 AM »
Sounds good to me so far and the tray icons won't be a problem.

I'm afraid I fixed that, so you'll have to download it again from above post  :-[

I also gave it an obligatory random version number so I can keep up with myself.

There is no extra CLI window when I launch XChat that way.

Oh well, I've left in the option of leaving the output window open.
4359
Living Room / Re: which is more important, system ram or video ram?
« Last post by 4wd on February 07, 2011, 08:46 PM »
@Carol: You could save yourself UKP20 and get the 955BE, same chip as the 965BE.  Only difference is the default multiplier of the 965 is one step higher - something that can easily be rectified in the BIOS for the Black Editions.
4360
Post New Requests Here / Re: IDEA: Movie Mode
« Last post by 4wd on February 07, 2011, 06:38 PM »
Thanks, got an idea how to go about it - other than that, is it suitable for intended purpose?

eg. The method it uses to kill programs tends to leave their icons in the SysTray until you wander your mouse over them, is this a problem?

Of course, if it is a problem I don't know what I'm going to do about FIXED

While I'm at it, when running programs from command line do you want the CLI window to be open/closed/optional ?

EDIT: Try this one.

Delete the old ini file, it'll create a new one with a couple of examples.
Main things to notice are:
1) Prefix DOS, (or CLI run programs), with the '>' character;
2) Match the parameters with the programs, ie. Param1 is for Program1, etc;

Oh, if it wasn't obvious in the first post, it can handle more than 10 programs - just keep incrementing the program and parameter number.
4361
Post New Requests Here / Re: IDEA: Movie Mode
« Last post by 4wd on February 07, 2011, 04:50 PM »
Annoyed with constant popup requesters from people who want to be your Facebook friend?
Find that the latest Nigerian Prince has interrupted your movie watching by offering you a once in a lifetime offer to get wealthy?
Do dings, bells, chimes and buzzes make you miss that once in a million Call of Duty: Black Ops headshot?
Constantly find yourself openning the door for salesmen?  (Sorry, got carried away  :-[ )

Well, your prayers are answered!*

Try ***Movie-ize***, (catchy name, huh).

Comes with a money back guarantee!**

Instructions:
1) Put it anywhere
2) Run it
3) Marvel at the Tray icon
3) Select Preferences to edit the ini file, it's pretty self-explanatory: one line per program, full path required, increment the key number as you go, (ie. Program11, Program12, etc).  It throws Skype in as an example entry.

I should note that all it does is close the process, if the process pops up a requester asking for confirmation, it won't get it from this program.

EDIT: Crap!  Didn't see the command line parameter bit  :-[
I'll have a look at that.  Can you send me an example command line for it?

Removed, see post below.


* Maybe
** Disclaimer: All waranties void if this software proves useful or not.  Liability also not accepted for damage to eyesight through increased movie watching or DVT from failing to move from chair.  Warranty also considered to be void if it's used on a system it wasn't designed for, ie. mine.
4362
General Software Discussion / Re: In search of a partition identifier ...
« Last post by 4wd on February 06, 2011, 05:35 PM »
I'm not sure if the exes "compiled" by AutoIt3 conform to the standard.

Excellent!  Works in detecting CUI/GUI compiled AutoIt...now to apply my meager C knowledge in working out how they do it :)

EDIT: Here's a AutoIt conversion, not the whole file.exe program, just up to the part I was interested in.  Seems to work OK as long as the AutoIt program hasn't been UPX'd of course.

Now to turn it into a function.

Code: AutoIt [Select]
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseUpx=n
  3. #AutoIt3Wrapper_UseX64=n
  4. #AutoIt3Wrapper_Change2CUI=y
  5. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  6. ; file.au3
  7.  
  8. $maxfilesize = 8192
  9. Dim $buffer[$maxfilesize]
  10.  
  11. If $CmdLine[0] = 0 Then Exit
  12.  
  13. $hFile = FileOpen($CmdLine[1], 16)
  14. If $hFile = -1 Then
  15.         MsgBox(0, 'Error!', 'Failed to open file.')
  16.         Exit
  17. For $i = 0 To 8191
  18.         $buffer[$i] = Dec(StringMid(FileRead($hFile, 1), 3))
  19.         If @error Then ExitLoop
  20.  
  21. FileClose($hFile)
  22.  
  23. ; Test for executable
  24. If ($buffer[0]=77 And $buffer[1]=90) Or ($buffer[0]=90 And $buffer[1]=77) Then ; MZ or ZM
  25.         ConsoleWrite('DOS/Win executable')
  26.         ConsoleWrite('Not DOS/Win executable')
  27.  
  28. $offset=0
  29. $format=0
  30.  
  31. ; Test for NE/PE format
  32. $neoffset=($buffer[61] + $buffer[60]) * 256
  33. If ($buffer[$neoffset] = 78 And $buffer[$neoffset + 1] = 69) Then
  34.         $format = 3
  35.         $offset = $neoffset
  36.  
  37. $peoffset = $buffer[60]
  38. If ($peoffset > $maxfilesize) Then
  39.         $peoffset = 0
  40.  
  41. If ($buffer[$peoffset] = 80 And $buffer[$peoffset + 1] = 69) Then
  42.         $format = 1
  43.         $offset = $peoffset
  44.  
  45. If ($format = 0) Then
  46.         $i = 0
  47.         While (($format = 0) And ($i < $maxfilesize - 4))
  48.                 If ($buffer[$i] = 80) And ($buffer[$i + 1] = 69) And ($buffer[$i + 2] = 0) And ($buffer[$i + 3] = 0) Then
  49.                         $offset = $i
  50.                         $format = 2
  51.                 EndIf
  52.                 $i += 1
  53.         WEnd
  54.  
  55. ; Depending on the type of Format try to gain further information about the file
  56. If ($format = 1 Or $format = 2) Then
  57.         If ($buffer[$offset + 4] = 0 And $buffer[$offset + 5] = 0) Then ConsoleWrite(', defined as an ANY / unknown machine type executable')
  58.         If ($buffer[$offset + 4] = 76 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', i386 32bit executable')
  59.         If ($buffer[$offset + 4] = 100 And $buffer[$offset + 5] = 134) Then ConsoleWrite(', x86-64 64bit executable')
  60.         If ($buffer[$offset + 4] = 0 And $buffer[$offset + 5] = 2) Then ConsoleWrite(', Intel Itanium executable')
  61.         If ($buffer[$offset + 4] = 240 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Power PC (little endian) executable')
  62.         If ($buffer[$offset + 4] = 241 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Power PC (with floating point support) executable')
  63.         If ($buffer[$offset + 4] = 211 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Matsushita AM33')
  64.         If ($buffer[$offset + 4] = 192 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', ARM little endian')
  65.         If ($buffer[$offset + 4] = 188 And $buffer[$offset + 5] = 14) Then ConsoleWrite(', EFI byte code')
  66.         If ($buffer[$offset + 4] = 65 And $buffer[$offset + 5] = 144) Then ConsoleWrite(', Mitsubishi M32R little endian')
  67.         If ($buffer[$offset + 4] = 102 And $buffer[$offset + 5] = 2) Then ConsoleWrite(', MIPS16')
  68.         If ($buffer[$offset + 4] = 102 And $buffer[$offset + 5] = 3) Then ConsoleWrite(', MIPS with FPU')
  69.         If ($buffer[$offset + 4] = 102 And $buffer[$offset + 5] = 4) Then ConsoleWrite(', MIPS 16 with FPU')
  70.         If ($buffer[$offset + 4] = 102 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', MIPS little endian / R4000')
  71.         If ($buffer[$offset + 4] = 162 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Hitachi SH3')
  72.         If ($buffer[$offset + 4] = 163 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Hitachi SH3 DSP')
  73.         If ($buffer[$offset + 4] = 166 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Hitachi SH4')
  74.         If ($buffer[$offset + 4] = 168 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Hitachi SH5')
  75.         If ($buffer[$offset + 4] = 194 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Thumb')
  76.         If ($buffer[$offset + 4] = 105 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', MIPS little-endian WCE v2')
  77.         If ($buffer[$offset + 4] = 132 And $buffer[$offset + 5] = 1) Then ConsoleWrite(', Alpha')
  78.         If ($buffer[$offset + 4] = 104 And $buffer[$offset + 5] = 2) Then ConsoleWrite(', Motorola 68000')
  79.         If ($buffer[$offset + 4] = 144 And $buffer[$offset + 5] = 2) Then ConsoleWrite(', PA-RISC')
  80.  
  81.         If ($buffer[$offset + 23] = 32 And $buffer[$offset + 22] > 0) Then ConsoleWrite(', dll')
  82.         If ($buffer[$offset + 23] = 10 And $buffer[$offset + 22] > 0) Then ConsoleWrite(', system file')
  83.  
  84.         If ($buffer[$offset + 92] = 0 And $buffer[$offset + 93] = 0) Then ConsoleWrite(', unknown system')
  85.         If ($buffer[$offset + 92] = 1 And $buffer[$offset + 93] = 0) Then ConsoleWrite(', native')
  86.         If ($buffer[$offset + 92] = 2 And $buffer[$offset + 93] = 0) Then ConsoleWrite(', GUI')
  87.         If ($buffer[$offset + 92] = 3 And $buffer[$offset + 93] = 0) Then ConsoleWrite(', console/cmd')
  88.         If ($buffer[$offset + 92] = 7 And $buffer[$offset + 93] = 0) Then ConsoleWrite(', POSIX')
  89.  

EDIT: Got sidetracked, while it will tell how the program was compiled it still won't tell you how it was run...but at least I can make a single program that covers both compilation options.

Here's a function, returns True if compiled for GUI, False for anything else.

Code: AutoIt [Select]
  1. MsgBox(0, '', _GUITest(@ScriptFullPath))
  2.  
  3. Func _GUITest($file)
  4.         Local $maxfilesize = 8192, $hFile, $offset, $buffer, $i, $format, $neoffset, $peoffset
  5.         Dim $buffer[$maxfilesize]
  6.  
  7.         $hFile = FileOpen($file, 16)
  8.         For $i = 0 To 8191
  9.                 $buffer[$i] = Dec(StringMid(FileRead($hFile, 1), 3))
  10.                 If @error Then ExitLoop
  11.         Next
  12.         FileClose($hFile)
  13.  
  14.         $offset=0
  15.         $format=0
  16.  
  17.         $peoffset = $buffer[60]
  18.         If ($peoffset > $maxfilesize) Then
  19.                 $peoffset = 0
  20.         EndIf
  21.  
  22.         If ($buffer[$peoffset] = 80 And $buffer[$peoffset + 1] = 69) Then
  23.                 $format = 1
  24.                 $offset = $peoffset
  25.         EndIf
  26.  
  27.         If ($format = 0) Then
  28.                 $i = 0
  29.                 While (($format = 0) And ($i < $maxfilesize - 4))
  30.                         If ($buffer[$i] = 80) And ($buffer[$i + 1] = 69) And ($buffer[$i + 2] = 0) And ($buffer[$i + 3] = 0) Then
  31.                                 $offset = $i
  32.                                 $format = 2
  33.                         EndIf
  34.                         $i += 1
  35.                 WEnd
  36.         EndIf
  37.  
  38. ; Depending on the type of Format try to gain further information about the file
  39. If ($format = 1 Or $format = 2) Then
  40.         If ($buffer[$offset + 92] = 2 And $buffer[$offset + 93] = 0) Then
  41.                 Return True
  42.         Else
  43.                 Return False
  44.         EndIf
4363
General Software Discussion / Re: In search of a partition identifier ...
« Last post by 4wd on February 06, 2011, 04:25 AM »
Great!  Thanks Miles, I'll have a look at it - had a look at the WinApiEx UDF earlier but couldn't see anything.

I couldn't believe they didn't have a macro, (eg. @console), already available.

EDIT: Seems that you need to have UPX'd the compiled script for it to work...bummer!  Still, might be able to adapt it.

Found something here, ie. get the parent process - if it's explorer.exe then it was run via double-click, if it's cmd.exe it's via CLI.
4364
General Software Discussion / Re: In search of a partition identifier ...
« Last post by 4wd on February 05, 2011, 09:46 PM »
It that case, perhaps you should sign up for the AutoHK Programming School, (which I'm currently going through in AutoIt) ;)

Here's the source, (a heavily edited version of the CompInfo UDF), but I could have also used AutoIt ScriptOMatic to generate and butcher.

I took the easier route.

Code: AutoIt [Select]
  1. #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_UseUpx=n
  3. #AutoIt3Wrapper_UseX64=n
  4. #AutoIt3Wrapper_Change2CUI=y
  5. #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  6.  
  7. #region Global Variables and Constants
  8. If Not(IsDeclared("$cI_CompName")) Then
  9.         Global  $cI_CompName = @ComputerName
  10. Global Const $cI_VersionInfo            = "00.03.08"
  11. Global Const $cI_aName                          = 0, _
  12.                          $cI_aDesc                              = 4
  13. Global  $wbemFlagReturnImmediately      = 0x10, _       ;DO NOT CHANGE
  14. $wbemFlagForwardOnly            = 0x20                          ;DO NOT CHANGE
  15. Global  $ERR_NO_INFO                            = "Array contains no information", _
  16.                 $ERR_NOT_OBJ                            = "$colItems isnt an object"
  17. #endregion Global Variables and Constants
  18.  
  19. #region Boot Configuration
  20. Dim $BootConfig
  21. _ComputerGetBootConfig($BootConfig)
  22.         $error = @error
  23.         $extended = @extended
  24.         Switch $extended
  25.                 Case 1
  26.                         _ErrorMsg($ERR_NO_INFO)
  27.                 Case 2
  28.                         _ErrorMsg($ERR_NOT_OBJ)
  29.         EndSwitch
  30. #endregion Boot Configuration
  31.  
  32. #region ComputerOS Configuration
  33. Dim $OSs
  34. _ComputerGetOSs($OSs)
  35.         $error = @error
  36.         $extended = @extended
  37.         Switch $extended
  38.                 Case 1
  39.                         _ErrorMsg($ERR_NO_INFO)
  40.                 Case 2
  41.                         _ErrorMsg($ERR_NOT_OBJ)
  42.         EndSwitch
  43. #endregion ComputerOS Configuration
  44.  
  45. $CompOS = StringSplit($OSs[1][0],'|')
  46. $CompOS[0] = $BootConfig[1][0]
  47.  
  48. If $CmdLine[0] = 1 Then
  49.         Switch $CmdLine[1]
  50.                 Case 'A', 'a'
  51.                         ConsoleWrite($CompOS[0])
  52.                 Case 'O', 'o'
  53.                         ConsoleWrite($CompOS[1])
  54.                 Case 'B', 'b'
  55.                         ConsoleWrite($CompOS[3])
  56.                 Case 'S', 's'
  57.                         ConsoleWrite($CompOS[2])
  58.                 Case 'E', 'e'
  59.                         For $i = 0 To 3
  60.                                 ConsoleWrite($CompOS[$i] & @CRLF)
  61.                         Next
  62.                 Case Else
  63.         EndSwitch
  64.         $info = 'WhatBoot [A|O|B|S|E]' & @CRLF & 'Where: A - Active partition' & @CRLF & '       O - Operating System' & _
  65.                                 @CRLF & '       B - Boot partition' & @CRLF & '       S - System directory' & @CRLF & '       E - Everything'
  66.         ConsoleWrite($info)
  67.  
  68.  
  69. Func _ComputerGetBootConfig(ByRef $aBootConfigInfo)
  70.         Local $colItems, $objWMIService, $objItem
  71.         Dim $aBootConfigInfo[1][8], $i = 1
  72.  
  73.         $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
  74.         $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BootConfiguration", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
  75.  
  76.         If IsObj($colItems) Then
  77.                 For $objItem In $colItems
  78.                         ReDim $aBootConfigInfo[UBound($aBootConfigInfo) + 1][8]
  79.                         $aBootConfigInfo[$i][0]  = $objItem.Description
  80.                         $i += 1
  81.                 Next
  82.                 $aBootConfigInfo[0][0] = UBound($aBootConfigInfo) - 1
  83.                 If $aBootConfigInfo[0][0] < 1 Then
  84.                         SetError(1, 1, 0)
  85.                 EndIf
  86.         Else
  87.                 SetError(1, 2, 0)
  88.         EndIf
  89. EndFunc ;_ComputerGetBootConfig
  90.  
  91. Func _ComputerGetOSs(ByRef $aOSInfo)
  92.         Local $colItems, $objWMIService, $objItem
  93.         Dim $aOSInfo[1][60], $i = 1
  94.  
  95.         $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2")
  96.         $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
  97.  
  98.         If IsObj($colItems) Then
  99.                 For $objItem In $colItems
  100.                         ReDim $aOSInfo[UBound($aOSInfo) + 1][60]
  101.                         $aOSInfo[$i][0]  = $objItem.Name
  102.                         $i += 1
  103.                 Next
  104.                 $aOSInfo[0][0] = UBound($aOSInfo) - 1
  105.                 If $aOSInfo[0][0] < 1 Then
  106.                         SetError(1, 1, 0)
  107.                 EndIf
  108.         Else
  109.                 SetError(1, 2, 0)
  110.         EndIf
  111. EndFunc ;_ComputerGetOSs
  112.  
  113. #region ---- Internal Functions
  114. Func _ErrorMsg($message, $time = 0)
  115.         ConsoleWrite("Error! - " & $message)
  116. #endregion Internal Functions

Happy it worked  :D

You might not need the ebook, I find the examples in the help docs and throughout the AutoIt forum are usually enough to get me either headed in the right direction or almost exactly what I require.  The hard part is getting the search terms right.  Many a time I've started writing a function to do something then searched in the forum to find that it's included in a UDF so all I need is a function call  :-[

ATM I can't work out how to tell whether or not the program is run via CLI or GUI which would allow me to add both types of output.  I'm sure it's really easy but stuffed if I can find a variable, (or process), to check for so I can do it.
4365
General Software Discussion / Re: In search of a partition identifier ...
« Last post by 4wd on February 05, 2011, 05:57 PM »
Been searching for something, preferably portable, that will identify the currently active OS partition.

When you say 'active' do you mean the partition that is marked as Active that carries the MBR, (I only have one per all drives), or do you mean the current System partition ?

ie. In the picture below: The Active or the Boot partition?

2011-02-06_10-50-09.jpg

Try the attached compiled AutoIt script, it's console only, (so you can stick it in batch file or something), let me know if you want GUI instead.

D:\My Docs\AutoIt>whatboot a
\Device\Harddisk2\Partition1
D:\My Docs\AutoIt>whatboot b
\Device\Harddisk2\Partition2
D:\My Docs\AutoIt>whatboot o
Microsoft Windows 7 Home Premium
D:\My Docs\AutoIt>whatboot s
C:\Windows
D:\My Docs\AutoIt>whatboot e
\Device\Harddisk2\Partition1
Microsoft Windows 7 Home Premium
C:\Windows
\Device\Harddisk2\Partition2

D:\My Docs\AutoIt>whatboot
WhatBoot [A|O|B|S|E]
Where: A - Active partition
       O - Operating System
       B - Boot partition
       S - System directory
       E - Everything
D:\My Docs\AutoIt>

EDIT: Should have mentioned, numbering starts at 1 for partitions.
4366
Thanks for clarifying - I'll leave you to you nutz and futz now  :P
4367
Aahh...I see.....

But, (you knew that was coming didn't you), prior to XP SP2 doesn't that mean that Wireless Connection Manager, (or the window you get after hitting View Wireless Networks, whatever it's called), wasn't available?

ie. Prior to XP SP2, didn't you have to use whatever software the manufacturer provided with the adapter and as such won't what you're trying to do not work anyway?

Sorry, it's been a while since I saw anything but XP SP3 around.
4368
Note: Granted using the WiFi API 4wd mentioned above would have been a more elegant solution (simpler code & faster to pound out), however it also doesn't run on (isn't available in) Windows XP ... Which is (after all) or target platform.

Sorry if I seem to be pushing a dead donkey but I'm still not clear here, everything I've read on the Native WiFi API says it's available from XP SP2, (SP2 via patch, incorporated into SP3), onwards, (when Wireless Zero Config was introduced - I would have thought most people would be running SP3 by now), the only function not available to XP seems to be WlanGetInterfaceCapability according to MSDN.

So I would have thought that their example code for WlanEnumInterfaces would be just what's needed, (bearing in mind their note about GUIDs at the bottom which seems to make any program more convoluted than it needs to be).

I'm just trying to understand why it wouldn't run for you on XP but feel free to call me an idiot - I've been called worse  :P
4369
Post New Requests Here / Re: IDEA: Block/Unblock all network traffic button (one-click)
« Last post by 4wd on February 02, 2011, 11:42 PM »
OK, give this a try - it uses devcon to get the status and (dis|en)able the network adapter.

I don't see how it's going to work if you're blocked from (dis|en)abling via the Network Connections Control Panel but who knows, stranger things have happened.

If it doesn't work, then the only option left is to either modify the program to elevate to SYSTEM user or try and run the devcon command elevated and see what happens.

NOTES: You no longer have a choice of toggling ALL connections.

Actual fact it probably works better than NetToggle because the status is more consistantly reported but it does have a LOT less error checking ;)

REMOVED - See following posts.
4370
Post New Requests Here / Re: IDEA: Block/Unblock all network traffic button (one-click)
« Last post by 4wd on February 02, 2011, 08:12 PM »
Just for interests sake, a x64 version of devcon can be found here.

They might even go so far as providing the link to the file for you.  but the best way would be to have the program's installer offer to download the file and install it for you in case it's not installed yet.

I'm going for something a bit easier, AutoIt allows incorporating binaries as a resource into the compiled program - so it will just extract the x86/x64 version out of the compiled program as required.

Probably not exactly kosher regarding distribution license but I'm feeling too old and lazy to be bothered by the more complicated method of grabbing it from MS or the location of the x64 version, (what happens if they change the address?), and installing it.

Also, I have no idea how to write an installer and I *hate* programs that cannot be unzipped and run unless there is a very good reason.

I can't see any reason why this won't run from a flash drive when I've finished, (fingers and toes crossed).
4371
Post New Requests Here / Re: IDEA: Block/Unblock all network traffic button (one-click)
« Last post by 4wd on February 01, 2011, 08:44 PM »
Man, this adapter ID thing is totally the reason why there are no good third party network software for windows.  I've always wondered why there were no cool little software out there to improve on little annoyances like this related to networks.

It would be nice to know whether devcon worked in your situation before proceeding along this path.

Any chance you can download DEVCON, do the following in a CLI and paste the results in list.txt here?

devcon listclass net >list.txt

Then we could give you a devcon command to try and disable the adapter, if it doesn't work then there doesn't seem to be an easy way around the permissions.
4372
Post New Requests Here / Re: IDEA: Block/Unblock all network traffic button (one-click)
« Last post by 4wd on February 01, 2011, 07:09 PM »
Given permissions being set that disallow normal users from disabling the adapters, how is using devcon, (which I've used for other things), going to help?

Guess I'll have to fire up XP Pro and have a play in the Group Policy editor.

Scratch that, looks like server OS only.

Time to put the thinking cap on.

^ You are correct. There is a 32 and a 64bit version. Completely forgot about that.

The 64bit version included is for Intel Itaniums, (ia64), won't work on x64 installations.

i don't think you're a cracker failure.

I wasn't suggesting I'm a cracker failure, perish the thought, I was suggesting my next program would be a cracker failure....as in format your drive type  ;D

^Yep. That's the tricky part of the equation. You'd need to get that information somehow. If not through devcon, then some other way. I'd guess polling the registry would be how a pro would get it.

devcon listclass net >list.txt

Then string match the first 3 characters of each line to USB, PCI or BTH - should pick up almost any network hardware, giving you hardware ID, (for devcon), and adapter name, (for GUI).
4373
Post New Requests Here / Re: IDEA: Block/Unblock all network traffic button (one-click)
« Last post by 4wd on February 01, 2011, 05:28 PM »
you're right.  I'm at work, and i can't disable this connection.  I'm guessing it's a restriction put in place by our network admins. (see attachment in previous post)

Possibly, (from here):

Ability to Enable/Disable a LAN connection
Administrative Template: System
Policy Node: USER
Policy Path: Administrative Templates\Network\Network Connections
Supported On: At least Microsoft Windows 2000 Service Pack 1
Help/Explain Text: Determines whether users can enable/disable LAN connections. If you enable this setting, the Enable and Disable options for LAN connections are available to users (including nonadministrators). Users can enable/disable a LAN connection by double-clicking the icon representing the connection, by right-clicking it, or by using the File menu. If you disable this setting (and enable the Enable Network Connections settings for Administrators setting), double-clicking the icon has no effect, and the Enable and Disable menu items are disabled for all users (including administrators). Important: If the Enable Network Connections settings for Administrators is disabled or not configured, this setting will not apply to administrators on post-Windows 2000 computers. If you do not configure this setting, only Administrators and Network Configuration Operators can enable/disable LAN connections. Note: Administrators can still enable/disable LAN connections from Device Manager when this setting is disabled.
Registry Settings: HKLM\Software\Policies\Microsoft\Windows\Network Connections!NC_LanConnect

Ah well, my second crack at a coding snack has failed to live up to expectations  :(

On the bright, the third time should be a cracker, (whether cracker failure I'm not sure about).  :D

It's usually a troubleshooting reason.  The most recent example is I'm trying to troubleshoot my email program, and I don't want it accidentally sending recieving any email until all my settings are the way i like it.  because if i don't like it, I'm going to move certain files around and i don't want an email or two slipping in there during the interim, because then my last "good" files are not the latest and greatest.  So stuff like that.

I usually use the 'one size fits all' solution of unplugging the network cable. ;)
4374
Post New Requests Here / Re: IDEA: Block/Unblock all network traffic button (one-click)
« Last post by 4wd on February 01, 2011, 03:09 AM »
OK, it's had a name change, (but you can change it to anything you like), to NetToggle v0.99

WHAT:  A simple program for toggling the state, (enable/disable), of one or all of the network interfaces.   Tray icon changes to reflect current status.

REQUIREMENTS: Windows XP+SP3 (x86/x64) or later.

USAGE: On first run it will prompt for a network interface from the drop down list, select one and click Save.  Interface selected is save to an ini file in the same directory as the executable.
      
Click the LMB on the tray icon to toggle the state of the interface.
      
Click the RMB on the tray icon to open the interface selector.
      
To exit the program, click the RMB on the tray icon and then click the window Close button, (X in top right).
      
NOTES: You can rename the executable when you run it, it will prompt for an interface and save it to a new ini under the same name as the executable.  So you can run multiple copies, one for each interface.

See post here.
4375
The C# Native WiFi API thing didn't pan out as it's Vista/7 only (I'm not ready to give-up on XP just yet), so I'm polking around looking for options.

That's strange because they implemented it from XP SP2 onwards, well according to Microsoft....but then, what would they know :)

And it seems to work OK on XP-SP3 via my LANToggle program, (ie. it lists the interfaces and lets me (dis|en)able them), AutoIt of course so maybe there is a little more trickery going on.

However, I don't think it will work if the you don't use the Wireless Zero Config in Windows, (ie. the adapter uses whatever the manufacturer supplied by way of connection software).
Pages: prev1 ... 170 171 172 173 174 [175] 176 177 178 179 180 ... 225next