Robin Posted May 5, 2009 Share Posted May 5, 2009 (edited) Hi folks...Hope someone can shed some light on this one... First off, i have a DUAL BOOT laptop with XP and VISTA I have compiled a helpdesk.exe with 7-zip that includes a setup.exe file (compiled with AutoIt) that gets executed at runtime via helpdesk.exe. Inside the setup.exe file, i have a [if @OSVersion = "WIN_VISTA" Then] function. Now, when i put the helpdesk.exe file in the "root" of drive C (This IS Vista's "root" by the way) and execute helpdesk.exe, the command in setup.exe (If @OSVersion = "WIN_VISTA" Then) doesn't recognize that its Vista...BUT, when i put helpdesk.exe in a FOLDER ( same drive ie C), the (If @OSVersion = "WIN_VISTA" Then)-command recognize its Vista...Is this some bug, or am i missing something? PS: sorry if this is not a AutoIt question, as i must admit...if i extract the embedded setup.exe and put it in the root, it DOES function propperly... Edited May 5, 2009 by Robin Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 5, 2009 Share Posted May 5, 2009 I'm sure it has to do with the path. Are you using the full path or just the name to run it? If you are using just the name, you are doing it wrong. Link to comment Share on other sites More sharing options...
BrettF Posted May 5, 2009 Share Posted May 5, 2009 I'm not too sure why that is, but try this.http://www.autoitscript.com/forum/index.ph...mp;#entry665576Both should return the currently running OS... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Robin Posted May 5, 2009 Author Share Posted May 5, 2009 (edited) I'm sure it has to do with the path. Are you using the full path or just the name to run it? If you are using just the name, you are doing it wrong.mmm...just the name...but you got me thinking there...thx to both you guys Edited May 5, 2009 by Robin Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 5, 2009 Share Posted May 5, 2009 Actually I'm sorry. I seem to have misunderstood the problem. The filenames included in the post threw me off. I'm not sure what's up there, have you tried showing a message box at certain points to confirm what the OS is listed as? Link to comment Share on other sites More sharing options...
BrettF Posted May 5, 2009 Share Posted May 5, 2009 Can you post a script that replicates your problem? What OS are you running it on? What version AutoIt? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Robin Posted May 5, 2009 Author Share Posted May 5, 2009 (edited) Can you post a script that replicates your problem?What OS are you running it on? What version AutoIt?Bare in mind this ONLY happens if running from 7-zip's helpdesk.exe...If i click on this file directly, no prob...the file still gets executed...Problem here, is it even executes the XP coding...weired, eh?Script Start=======Case $MSG = $SafeMode If @OSVersion = "WIN_VISTA" Then MsgBox(0, "", "hello") FileCopy(@ScriptDir & "\main.exe", @HomeDrive & "\main.exe", 1) Sleep(50) FileCopy(@ScriptDir & "\helpdesk.txt", @HomeDrive & "\helpdesk.txt_", 1) Sleep(50) FileCopy(@ScriptDir & "\VistaRunSafe.exe", @HomeDrive & "\VistaRunSafe.exe", 1) EndIf If @OSVersion = "WIN_XP" Then FileCopy(@ScriptDir & "\main.exe", @HomeDrive & "\main.exe", 1) Sleep(50) FileCopy(@ScriptDir & "\run.bat", @HomeDrive & "\run.bat", 1) Sleep(50) FileCopy(@ScriptDir & "\helpdesk.txt", @HomeDrive & "\helpdesk.txt_", 1) Sleep(50) $Attrib1 = FileSetAttrib(@HomeDrive & "\boot.ini", "-R+A-S-H") If FileExists(@HomeDrive & "\bootback\boot.ini") Then MsgBox(0x40, "Attention!", "Re-Preparing for Safe-Mode Restart") RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", "Runbat", "REG_SZ", @HomeDrive & "\run.bat") Else If @OSVersion = "WIN_XP" Then $file2 = DirCreate(@HomeDrive & "\bootback") FileCopy($file1, @HomeDrive & "\bootback\") MsgBox(0, "Backup!", "File backed up Successfully..Now applying Changes...") RunWait(@ScriptDir & '\bootcfg /raw "/safeboot:network" /id 1', @SystemDir & "\dllcache", @SW_HIDE) RunWait("runhelper.exe", @ScriptDir & "\", @SW_HIDE) EndIf EndIf EndIfScript End====== Edited May 5, 2009 by Robin Link to comment Share on other sites More sharing options...
Richard Robertson Posted May 5, 2009 Share Posted May 5, 2009 Ok, this doesn't make sense. If @OSVersion = "WIN_VISTA" Then ;... EndIf If @OSVersion = "WIN_XP" Then ;<<<<<<<<<<<<<<<<<<<< ;... If FileExists(@HomeDrive & "\bootback\boot.ini") Then ;... Else If @OSVersion = "WIN_XP" Then ;<<<<<<<<<<<<<<<<<< ;... EndIf EndIf EndIf Where I added arrows. You are already in an XP block, why are you checking it again? Link to comment Share on other sites More sharing options...
BinaryBrother Posted May 5, 2009 Share Posted May 5, 2009 (edited) @RichardProbably because he couldn't get it to work and was troubleshooting@RobinI have experienced similar issues using macros, try throwing the macro in a variable and asking the variable what the OS is, the following code snip-it fails on Windows Vista/7 in my testing.CODE-Removed I couldn't reproduce the bug, so I edited the code out...But throwing @IPAddress4 into a variable first, seems to work fine... Also, you may want to consider the different permissions for different directories. Is your program using #RequireAdmin, if not that is a known cause of issues in Vista machines.Just my 2cents... Edited May 5, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
BrettF Posted May 5, 2009 Share Posted May 5, 2009 Skip the rest. Try the following script. Tell us what OS you run this on. Switch @OSVersion Case "WIN_XP" $sMessage = "Windows XP" Case "WIN_VISTA" $sMessage = "Windows Vista" EndSwitch $msg = "Location = " & @ScriptFullPath & @CRLF & "OS = " & $sMessage ClipPut ($msg) MsgBox (0, "Following has been copied to clipboard", $msg) Please paste the output (done automatically) into this thread, telling us what OS you ran it on (XP or Vista). I'd say the most likely thing is a logic problem on your behalf... Cheers, Brett Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Robin Posted May 6, 2009 Author Share Posted May 6, 2009 Skip the rest. Try the following script. Tell us what OS you run this on. Switch @OSVersion Case "WIN_XP" $sMessage = "Windows XP" Case "WIN_VISTA" $sMessage = "Windows Vista" EndSwitch $msg = "Location = " & @ScriptFullPath & @CRLF & "OS = " & $sMessage ClipPut ($msg) MsgBox (0, "Following has been copied to clipboard", $msg) Please paste the output (done automatically) into this thread, telling us what OS you ran it on (XP or Vista). I'd say the most likely thing is a logic problem on your behalf... Cheers, BrettThis was done on a VISTA ULTIMATE SP 2 Thanks for the help guys..Far as I believe, its NOT a bug...like the previous poster said...some fault on my side..will recheck my code..lol Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now