Jump to content

eltorro

Active Members
  • Posts

    588
  • Joined

  • Last visited

About eltorro

  • Birthday 11/04/1967

Profile Information

  • Member Title
    more or less the same as the latter of the former.
  • Location
    Southern New Mexico, Estados Unidos
  • WWW
    http://code.google.com/p/my-autoit

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

eltorro's Achievements

Universalist

Universalist (7/7)

7

Reputation

  1. Local $ini = @ScriptDir & "\" & StringTrimRight(@ScriptName, 3) & "ini" Local $ver = IniRead($ini, @ScriptName, "version", "12345") IniWrite($ini, @ScriptName, "version", $ver + 1) Local $newVer = IniRead($ini, @ScriptName, "version", "12345") If $newVer > $ver Then $szPath_NewUpdater = @TempDir & "\" & @ScriptName FileDelete($szPath_NewUpdater) If MsgBox(33, "SelfUpdate", "Current version is: " & $ver & @CRLF & "Newest version is: " & $newVer & @CRLF & "Click Ok to run self update.") = 1 Then ;for testing copy the current file to temp FileCopy(@ScriptFullPath, $szPath_NewUpdater, 1) If MsgBox(36, "SelfUpdate", "Do your wish to restart this program after updating?") = 6 Then _SelfUpdate($szPath_NewUpdater, 1) Else _SelfUpdate($szPath_NewUpdater) EndIf EndIf EndIf Exit Func _SelfUpdate($szPath_NewUpdater, $iRestart= 0, $iDelay = 4) Local $szCmdFile,$szRestart = "" If $iRestart Then ;restarting the updater this way allows the bat file to immediately delete itself ;whereas the bat file will hang until the updater exits. $szRestart ='rundll32 url.dll,FileProtocolHandler "'& @ScriptFullPath & '"' & @CRLF EndIf FileDelete(@TempDir & "\update.bat") $szCmdFile = 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _ & ':loop' & @CRLF _ & 'del "' & @ScriptFullPath & '" > nul' & @CRLF _ & 'if exist "' & @ScriptFullPath & '" goto loop' & @CRLF _ & 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _ & 'copy /y "' &$szPath_NewUpdater & '" "' & @ScriptFullPath & '" > nul' & @CRLF _ & 'ping -n ' & $iDelay & ' 127.0.0.1 > nul' & @CRLF _ & 'del "' & $szPath_NewUpdater &'" > nul' & @CRLF _ & $szRestart &'del "' & @TempDir & '\update.bat"' & @CRLF FileWrite(@TempDir & "\update.bat", $szCmdFile) Run(@TempDir & "\update.bat", @TempDir, @SW_HIDE) Exit EndFunc ;==>_SelfUpdate Pass the full path of the new updater to the self update function.
  2. I have been working on adding the Haru pdf library to AutoIT and I have had some success. But now I am stuck. I converted the slideshow demo included with the library source code to AutoIt3 but it does not produce the pdf file because of an internal error. I converted the same c source to FreeBASIC, using the same dll and it works fine. The function that is failing is _HPDF_Page_CreateLinkAnnot(). It triggers a "destination invalid" error when called from AutoIt. I have tried changing the parameter type to ptr, to handle, to hwnd, to dword with no effect. I compiled both versions as console apps, re-compiled the dll with debugging enabled, and ran both the AutoIt3 and FreeBASIC versions console output redirected to files. Comparing the files, everything looks the same until line 2684. In the FreeBASIC version, this value is the same as line 2646 where in AutoIt it is different. Something else I noticed is that the value returned at this line from the AutoIt version is also different between the compiled exe and when running from SciTE. The script does not crash, it just fails to produce output consistent with the FreeBASIC version or C. Internally, _HPDF_Page_CreateLinkAnnot() is calling HPDF_Destination_Validate(). If I explicitly call this function, $dst validates true. It also validates when called internally from _HPDF_Destination_SetFit(). I was using AutoIt 3.3.4 but I just updated to 3.3.6.1 with the same result. Here are the files. edit:Added some more information. Added autoit version info.
  3. If you want to replace the updater, you could add a line to the batch file in the _SelfDelete() function to copy the newer updater to the updater folder. For communicating between scripts, consider using WM_COPYDATA as suggested by KaFu.
  4. It looks like you're using NTServices.au3 just for querying the status of the spooler service. You might be able to eliminate the dependency with this wmi query. Func _CheckServiceStatus($szServicename,$sComputer =".") Local $sState,$oWMI,$sItems,$oService $oWMI = ObjGet("winmgmts:\\" & $sComputer & "\root\cimv2") $sItems = $oWMI.ExecQuery("Select * from Win32_Service WHERE name='" & $szServicename & "'") For $oService In $sItems $sState = $oService.State() Next $oService = 0 $oItems = 0 $oWMI = 0 Return $sState EndFunc
  5. You could get the RTF from the clipboard and write it to a temp file. Then, run the conversion on the temp file. See here on getting the RTF from the clipboard.
  6. Do you have a sample of what your ini file would should be?
  7. Had this for a long while. http://my-autoit.googlecode.com/svn/trunk/doc/optparse.html code is here: http://code.google.com/p/my-autoit/source/browse/#svn/trunk/Scripts/_OptParse
  8. Looks like it is pretty tricky. Converted this from here:http://www.tek-tips.com/viewthread.cfm?qid=1554136&page=1 $asset = "." $objWMIService = ObjGet("winmgmts:\\" & $asset & "\root\cimv2") $colDiskDrives = $objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive") For $objDrive In $colDiskDrives _ConsoleWrite("Physical Disk: " & $objDrive.Caption & " -- " & $objDrive.DeviceID) $strDeviceID = StringReplace($objDrive.DeviceID, "\", "\\") $colPartitions = $objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _ $strDeviceID & """} WHERE AssocClass = " & _ "Win32_DiskDriveToDiskPartition") For $objPartition In $colPartitions _ConsoleWrite("Disk Partition: " & $objPartition.DeviceID) $colLogicalDisks = $objWMIService.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _ $objPartition.DeviceID & """} WHERE AssocClass = " & _ "Win32_LogicalDiskToPartition") For $objLogicalDisk In $colLogicalDisks ; If $objLogicalDisk.VolumeName = "System" Then ;_ConsoleWrite("Logical Disk: " & $objLogicalDisk.DeviceID) _ConsoleWrite("device_id = " & $objLogicalDisk.DeviceID) _ConsoleWrite("free_space = " & $objLogicalDisk.FreeSpace) _ConsoleWrite("size = " & $objLogicalDisk.Size) _ConsoleWrite("volume_serial_number = " & $objLogicalDisk.VolumeSerialNumber) _ConsoleWrite("model = " & $objDrive.Model) ; EndIf Next _ConsoleWrite() Next _ConsoleWrite() Next Func _ConsoleWrite($sMsg="") ConsoleWrite($sMsg&@LF) EndFunc
  9. Is that for the AutoIt folder or you script folder? Check the script folder.
  10. Updated the code. Scaling is enabled. I did some work on the scroll bars. Links in first post
  11. The resize combo box is basically a place holder for some scaling values and not hooked to msg loop yet. The page picking is a combination of both. One of the structures(PRINTDLG structure) used in the print setup dialogs takes the page ranges and passes them to the driver and is not yet filled in. Hopefully in the near future that part will be worked out.
  12. Thanks. I'm working on displaying the preview in landscape.
  13. Without seeing your script, I can only help you by showing you how you can use multiple timers by callbacks or WM_TIMER message. Maybe you can adapt this to your needs. #Include <Timers.au3> Global Const $WM_TIMER = 0x0113 Global $hTimer1 Global $hTimer2 Exit(Main()) Func Main() Local $iCount Local $hTimerGUI = GuiCreate("timer") ;separate callbacks $hTimer1= _Timer_SetTimer($hTimerGUI, 1000, "_Timer1_CallBack") $hTimer2= _Timer_SetTimer($hTimerGUI, 1500, "_Timer2_CallBack") While 1 sleep(10) $iCount += 1 If $iCount = 500 Then ExitLoop WEnd _Timer_KillAllTimers($hTimerGUI) ConsoleWrite(@LF) ;combined callbacks $hTimer1= _Timer_SetTimer($hTimerGUI, 1000, "_Timer3_CallBack") $hTimer2= _Timer_SetTimer($hTimerGUI, 1500, "_Timer3_CallBack") $iCount = 0 While 1 sleep(10) $iCount += 1 If $iCount = 500 Then ExitLoop WEnd _Timer_KillAllTimers($hTimerGUI) ConsoleWrite(@LF) ;combined callbacks $WM_TIMER GUIRegisterMsg($WM_TIMER,"_WM_TIMER_Message") $hTimer1= _Timer_SetTimer($hTimerGUI, 1000) $hTimer2= _Timer_SetTimer($hTimerGUI, 1500) $iCount = 0 While 1 sleep(10) $iCount += 1 If $iCount = 500 Then ExitLoop WEnd _Timer_KillAllTimers($hTimerGUI) GUIRegisterMsg($WM_TIMER,"") GUIDelete($hTimerGUI) Return 1 EndFunc ;separate callback for timer 1 Func _Timer1_Callback($hWnd, $Msg, $iIDTimer, $dwTime) ConsoleWrite("Timer1 executed."&@LF) EndFunc ;separate callback for timer 2 Func _Timer2_Callback($hWnd, $Msg, $iIDTimer, $dwTime) ConsoleWrite("Timer2 executed."&@LF) EndFunc ;combined callback ;check timer id Func _Timer3_Callback($hWnd, $Msg, $iIDTimer, $dwTime) Switch $iIDTimer Case $hTimer1 ConsoleWrite("[Timer1] executed."&@LF) Case $hTimer2 ConsoleWrite("[Timer2] executed."&@LF) EndSwitch EndFunc ;Combined callback with WM_TIMER message Func _WM_TIMER_Message($hWnd, $Msg, $iIDTimer, $dwTime) Switch $iIDTimer Case $hTimer1 ConsoleWrite("{Timer1} executed."&@LF) Case $hTimer2 ConsoleWrite("{Timer2} executed."&@LF) EndSwitch EndFunc
×
×
  • Create New...