Originally posted by colc
View Post
Announcement
Collapse
No announcement yet.
_SourceDrive Issue
Collapse
X
-
-
-
kingzooly if you had read the first post correctly before posting
I've got a little issue with having my app running correctly on a USB drive in WinPE. I can get the app to start and run fine but I'm using a script to display some text from a Rich Text file contained on the USB Drive
Have a good day
Leave a comment:
-
-
colc speak to me like that ever again and I will just block you, my reply didn't even say anything about USB, There source folder is the temp folder when using the webexe what will create problems later on, also you can make code that will detect if your in a preview or complied work place.
Ulrich Your a star I for got what is was called, I going to add that some where maybe in a app I not using but I keep for code snippets.
Leave a comment:
-
-
The correct way of doing this is by retrieving the contents of the SFXSOURCE: command line parameter. It is in the product documentation.
I found this code works well for using SFXSOURCE
Code:--Place in Globals --the SFXSOURCE argument is always the last table item so you can access it with Table.Count function EXESourceFolder() if _CommandLineArgs[Table.Count(_CommandLineArgs)] then if String.Left(_CommandLineArgs[Table.Count(_CommandLineArgs)], 3) == "SFX" then local strPath = String.Replace(_CommandLineArgs[Table.Count(_CommandLineArgs)], "SFXSOURCE:", "", true) strPath = String.SplitPath(strPath) return strPath.Drive..strPath.Folder end end end
Code:--Source is your drive letter eg G:\ Source = EXESourceFolder() if Source == "" then Source=_SourceFolder end Dialog.Message("Notice", "Program running from Drive"..Source, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
I use his code mainly because I change and add progs folders etc and like to preview before compiling
Leave a comment:
-
-
The correct way of doing this is by retrieving the contents of the SFXSOURCE: command line parameter. It is in the product documentation.
Occasionally you may need the location your compressed executable was launched from. For this reason a command line argument is passed into your AutoPlay application in the form: SFXSOURCE:SFE EXE NAME where "SFE EXE NAME" is the full path to the compressed executable. For example, "SFXSOURCE:C:\Temp\launcher.exe". In your AutoPlay application you can access this command line argument using the Global Variable _CommandLineArgs. If any command line arguments are passed to the compressed executable, they will also be passed into the AutoPlay application.
Ulrich
Leave a comment:
-
-
G1ggs This code is put in Globals and called from your script with search_folder()
Code:--########################################################### --#This code searches for the required folder (Program Files) in the root directory of every drive of the system --#(excluding CD-rom, net drives, and drives A and B); --########################################################### function search_folder() -- Get a list of all drives in the system tDrives = Drive.Enumerate(); for j in pairs(tDrives) do nType = Drive.GetType(tDrives[j]); -- for every drive gets its type... if nType == 2 or nType == 3 then --if type is fixed or removable, excluding CD-Rom... sFound_drive_letter = String.Left(tDrives[j], 2); -- gets its drive letter if sFound_drive_letter ~= "A:" and sFound_drive_letter ~= "B:" then -- excludes drives that normally are floppy disks root_folder_does_exist = Folder.DoesExist(sFound_drive_letter.."\\"); if root_folder_does_exist then required_folder = sFound_drive_letter.."\\your folder here"; if Folder.DoesExist (required_folder) == true then File.OpenURL (required_folder); -- opens the desired folder in that drive (if exists) end end end end end end pDrive =r equired_folder
search_folder()
RichText.LoadFromFile("richImageInfo", pDrive.."\\Folder2\\Richtextfile.rt f);
Hope this helps
Cheers
Leave a comment:
-
-
hi
kingzooly - don't please do not post rubish of cause you run exe from usb
G1ggs - you first have to detect your usb drive letter
Code:--########################################################### --This code returns Drive info --########################################################### drives = Drive.Enumerate(); for j in pairs(drives) do drive_type = Drive.GetType(drives[j]); if drive_type == 2 or drive_type == 3 then drive_letter = String.Left(drives[j], 1); -- ... takes only the drive letter (without :\) if drive_letter ~= "A" and drive_letter ~= "B" and drive_letter ~= "C" then root_folder_does_exist = Folder.DoesExist(drive_letter..":\\"); if root_folder_does_exist then Current_Serial = Drive.GetInformation(drives[j]).SerialNumber; Current_Label = Drive.GetInformation(drives[j]).Label; Current_Name = Drive.GetInformation(drives[j]).DisplayName; end end end end
Leave a comment:
-
-
Originally posted by kingzooly View PostI think your problem is here your building it as a webexe so there for it's not going to work, you need to tell it that it's running as a webexe or build it as a hdd build, I don't make webexe's anymore so don't have the code what looks up the true webexe path sorry.
Leave a comment:
-
-
I think your problem is here your building it as a webexe so there for it's not going to work, you need to tell it that it's running as a webexe or build it as a hdd build, I don't make webexe's anymore so don't have the code what looks up the true webexe path sorry.
Leave a comment:
-
-
Sorry the script is:
RichText.LoadFromFile("richImageInfo", _SourceDrive.."\\Folder1\\Folder2\\Richtextfile.rt f);
Leave a comment:
-
-
_SourceDrive Issue
Hi,
I'm new to AMS and this is my first post so apologise of I'm wrong but I'm sort of getting the hang of it.
I've got a little issue with having my app running correctly on a USB drive in WinPE. I can get the app to start and run fine but I'm using a script to display some text from a Rich Text file contained on the USB Drive using the '_SourceDrive' variable as part as the path. For example:
RichText.LoadFromFile("richImageInfo", _SourceDrive.."\\Folder1\Folder2\Richtextfile.rtf
Am I correct in thinking that '_SourceDrive' is the letter of the drive that the app was run from. For example, if the USB Drive letter was E:\ then '_SourceDrive' is defined as that letter?
If so then for some reason it's not working. In fact it thinks the '_SourceDrive' is the system drive. In this case, for WinPE, it's X:\. Even if I ran it on a Windows 7 system it defines it as C:\.
Greatly appreciate any help
Tags: None
-
Leave a comment: